addr2line not showing line numbers
Shachar Shemesh via Digitalmars-d
digitalmars-d at puremagic.com
Sat Aug 5 23:20:28 PDT 2017
Title pretty much says it all. True whether I use -g or -gc, for both
dmd and ldc2.
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
Shachar
More information about the Digitalmars-d
mailing list