www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17727] New: addr2line does not understand debug info

https://issues.dlang.org/show_bug.cgi?id=17727

          Issue ID: 17727
           Summary: addr2line does not understand debug info
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: shachar weka.io

gdb, for some reason, does manage to show line numbers, but only sort of:
$ cat d.d
import std.stdio;

void main() {
    writeln("Hello, world");
}

$ dmd -g -gc d.d
$ gdb d
GNU gdb (Ubuntu 7.12.50.20170314-0ubuntu1.1) 7.12.50.20170314-git
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from d...done.
(gdb) break main
Breakpoint 1 at 0x463c4
(gdb) run
Starting program: /tmp/scratch/d
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, 0x000055555559a3c4 in main ()
(gdb) bt


argc=1, argv=0x7fffffffddb8, init=<optimized out>,
    fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdda8)
at ../csu/libc-start.c:291


 Important Point <<<<<<<<<<<<<<<<<<<<<<
(gdb) step Single stepping until exit from function main, which has no line number information. Hello, world __libc_start_main (main=0x55555559a3c0 <main>, argc=1, argv=0x7fffffffddb8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdda8) at ../csu/libc-start.c:325 325 ../csu/libc-start.c: No such file or directory. (gdb) kill Kill the program being debugged? (y or n) y (gdb) delete 1 (gdb) break d.d:4 Breakpoint 2 at 0x555555599c64: file d.d, line 4. (gdb) run Starting program: /tmp/scratch/d [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Breakpoint 2, _Dmain () at d.d:4 4 writeln("Hello, world"); (gdb) bt (gdb) quit A debugging session is active. Inferior 1 [process 15126] will be killed. Quit anyway? (y or n) y $ addr2line -e d 0x555555599c64 ??:0 $ dmd -v DMD64 D Compiler v2.074.1 To summarize: gdb can break on function name, but cannot single step from that point, as it claims it has no line information. It can break on file:line combination. addr2line cannot convert that address into a file:line This issue is a possible duplicate of 8841 --
Aug 06 2017