how to use addr2line in commandline
how to use addr2line? i have a program that gives the backtrace of last 10 addresses that it visited before crash. but if i use these address 开发者_StackOverflow中文版to addr2line like
addr2line -e test [address]
it just gives me
??:0
is there a special way to compile to use addr2line like we use ggdb to use gdb?
You need to have some debugging information compiled in to your executable. e.g.
$ gcc t.c # debug information not requested
$ gdb ./a.out
...
(gdb) break main
Breakpoint 1 at 0x400588
(gdb) q
$ addr2line -e a.out 0x400588
??:0 # no information returned
$ gcc -g t.c # default debug information requested with -g
$ addr2line -e a.out 0x400588
t.c:4 # line information returnedd
$
精彩评论