简体   繁体   中英

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 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. eg

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM