Search code examples
linuxdebuggingstackdumpdmd

Print function names from crash information


My program (which is compiled with DMD, a D compiler, on Linux) is crashing, and printing information like:

./program() [0x807aff8]
./program() [0x807aea9]

How can I convert the addresses of the functions to its names? I've compiled my program with the -debug and -g so it should include the required debugging information, I just don't know how to use it.

(PS: This is something simple but I can't seem to find how to do it. Probably not using the right search terms).


Solution

  • Have a look at the addr2line utility

    $ gcc -g s.c
    $ addr2line 0x400855    
    s.c:42