[m-users.] Debugger, setting initial breakpoint not triggering

Julien Fischer jfischer at opturion.com
Wed Dec 14 12:11:01 AEDT 2022


Hi Sean,

On Tue, 13 Dec 2022, Sean Charles (emacstheviking) wrote:

> So according to the documentation then, what
> does --enable-hlc-low-level-debug-grades actually do for me if it
> isn't provding me with a debug grade for hlc?

The .ll_debug grades prepare the C code generated by the Mercury
compiler for debugging with a C debugger (e.g. gdb).  As Zoltan
mentioned the main use for this is debugging issues in the Mercury->C
code generator.

The other use case for them, and this is probably why the option
--enable-hlc-low-level-debug-grades exists, is debugging Mercury code
that contains substantial amounts of C code (e.g. via pragma
foreign_proc) at the C level.

Mercury-level debugging is not supported by the high-level C backend at
all. In order to use the Mercury debugger you will need to compile your
code using a debug grade with the the low-level C backend, e.g.:

      asm_fast.gc.debug
      reg.gc.debug
      none.gc.debug

etc.

(Since you appear to be using clang, only the last of those will work.)

...

> After some playing around I came up with this configuration line:
> 
> ./configure --enable-hlc-low-level-debug-grades --disable-java-grade --enable-additional-libgrades=none.gc,none.gc.debug
> 
> and then managed to select none.gc coupled with the --debug flag, resulting in a build that now triggers the expected operation of mdb:


The '--debug' flag is an endless source of confusion and we have been
intending to change its behaviour.

What it currently does is paste ".debug" on to the current grade.
So for example, if your Mercury installation has been configured to use
"hlc.gc" as its default grade and you do this:

     $ mmc --debug foo.m

Then the compiler will attempt to compile that program in the grade
hlc.gc.debug (which will result in a error somewhere along the process
since that is not supported).

I suggest instead outputting the installed grades using
--output-stdlib-grades (as you have done) and then picking
one that contains either the "debug" or "decldebug" component
(But not "ll_debug!) and then explitily invoke the compiler with
that.

(Or install a debug grade if one is not present.)

Julien.


More information about the users mailing list