开发者

how to use addr2line in commandline

开发者 https://www.devze.com 2023-03-06 00:05 出处:网络
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

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
$ 
0

精彩评论

暂无评论...
验证码 换一张
取 消