[m-users.] mercury-rotd-2019-01-03: --debug appears to be broken

Julien Fischer jfischer at opturion.com
Thu Feb 14 10:47:05 AEDT 2019


Hi,

On Wed, 13 Feb 2019, Volker Wysk wrote:

> I try to compile this "hello world" program with debugging enabled:
>
> :- module hello.
> :- interface.
> :- import_module io.
> :- pred main(io::di, io::uo) is det.
> :- implementation. 
> main(!IO) :-  io.write_string("Hello there!\n", !IO).
>
> With this command:
>
> mmc --debug hello.m
>
> This results in these messages:
>
> mkinit: error opening file `/usr/local/mercury-rotd-2019-01-03/lib/mercury/
> modules/asm_fast.gc.debug/mer_rt.init': No such file or directory
> mkinit: error opening file `/usr/local/mercury-rotd-2019-01-03/lib/mercury/
> modules/asm_fast.gc.debug/mer_std.init': No such file or directory
> mkinit: error opening file `/usr/local/mercury-rotd-2019-01-03/lib/mercury/
> modules/asm_fast.gc.debug/mer_browser.init': No such file or directory
> mkinit: error opening file `/usr/local/mercury-rotd-2019-01-03/lib/mercury/
> modules/asm_fast.gc.debug/mer_mdbcomp.init': No such file or directory
>
> To me this looks like a bug.

It's not a bug, it's just that the '--debug' option doesn't do what you
think it does**.  Specifically, what it *does* do is add the .debug
grade component to the current grade (asm_fast.gc) and attempt to
compile the program in that grade (asm_fast.gc.debug).  The issue above
is that the Mercury libraries are not installed in that grade in your
installation.

(** We're aware that this behaviour isn't that useful and what users
usually want is an option that says "compile my program for use with
the debugger"; work on this is currently incomplete.)

To prepare a program for debugging, you will need to compile your
program in a grade that *is* installed on your system.  Use:

     $ mmc --output-libgrades

to see what grades are installed on you system.  You will need one
that contains the ".debug" or ".decldebug" component.  On my system
the output of the above command looks like:

    csharp
    java
    asm_fast.gc.profdeep.trseg.stseg
    asm_fast.gc.trseg.debug.stseg
    erlang
    hlc.gc.trseg
    asm_fast.gc
    hlc.gc

To prepare a program for debugging on my system I would do:

     $ mmc --grade asm_fast.gc.trseg.debug.stseg hello

Note that if you use the '--make' option, you will get a more useful
message in the presence of missing library grades.  For example,

     $ mmc --debug --make hello

would give:

     mercury_compile: error: the Mercury standard library cannot
         be found in grade asm_fast.gc.debug.

Julien.


More information about the users mailing list