Bug 17727 – addr2line does not understand debug info

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2017-08-07T04:37:20Z
Last change time
2019-08-30T16:28:03Z
Assigned to
No Owner
Creator
Shachar Shemesh
See also
https://issues.dlang.org/show_bug.cgi?id=8841

Comments

Comment #0 by shachar — 2017-08-07T04:37:20Z
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 #0 0x000055555559a3c4 in main () #1 0x00007ffff73f33f1 in __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:291 #2 0x0000555555599b5a in _start () >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 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 #0 _Dmain () at d.d:4 (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
Comment #1 by shachar — 2017-08-07T04:39:04Z
Also see discussion at http://forum.dlang.org/thread/[email protected] It seems that the "break main" issue is unrelated to the debug info, and is because it has another symbol with the name "main".
Comment #2 by r.sagitario — 2019-08-30T16:28:03Z
The trouble here is that `b main` stops at auto-generated C main, but no source is available for this (but can have overlapping line number info with other code). This is described in https://issues.dlang.org/show_bug.cgi?id=19039 for Windows, too. *** This issue has been marked as a duplicate of issue 19039 ***