简体   繁体   English

如何在命令行中使用addr2line

[英]how to use addr2line in commandline

how to use addr2line? 如何使用addr2line? i have a program that gives the backtrace of last 10 addresses that it visited before crash. 我有一个程序,它提供崩溃前访问过的最后10个地址的回溯。 but if i use these address to addr2line like 但如果我使用这些地址addr2line喜欢

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? 是否有一种特殊的方式来编译使用addr2line,就像我们使用ggdb来使用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
$ 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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