In the absence of both of the grade modifiers in this group,
the Mercury compiler generates executables that cannot be debugged,
because they do not include the information needed
for the operation of the Mercury debugger,
whose name is mdb
Debugging.
.debug
.decldebug
Compiling programs in a grade that includes
either the .debug
or the .decldebug
grade modifier
generates executables that can be debugged using mdb
.
Invoking mdb
on such executables lets users do
the kinds of things that people do with C debuggers such as gdb
(set breakpoints, step forward e.g. one call at a time,
and print the values of variables, amongst others),
as well as the kinds of things that people do with debug mode in Prolog:
(such as jump back from the end of a call to its beginning).
The difference between them is that
the declarative debugging aspects of ‘mdb’
will work only with ‘.decldebug’.
While both .debug
and .decldebug
increase the size of the executable and reduce its speed,
both the size increase and the speed reduction
is larger with .decldebug
than with .debug
.
Both of these grade modifiers are compatible only with LLDS base grades.