简体   繁体   English

带有存档文件的 addr2line

[英]addr2line with archive files

I am trying to use addr2line with a archive file libdpdk.a我正在尝试将addr2line与存档文件libdpdk.a一起使用

I have a backtrace:我有一个回溯:

backtrace returned: 7
0: 0x46fd05 ./build/ip_pipeline(bt+0x25) [0x46fd05]
1: 0x42a163 ./build/ip_pipeline() [0x42a163]
2: 0x46ff21 ./build/ip_pipeline(rte_eal_init+0x171) [0x46ff21]
3: 0x439629 ./build/ip_pipeline(app_init+0x709) [0x439629]
4: 0x42b3ff ./build/ip_pipeline(main+0x5f) [0x42b3ff]
5: 0x7f101166b830 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7f101166b830]
6: 0x42d009 ./build/ip_pipeline(_start+0x29) [0x42d009]

I tried the following command:我尝试了以下命令:

addr2line  0x46fd05 -f -e ../../build/lib/librte_eal.a

addr2line: ../../build/lib/librte_eal.a: cannot get addresses from archive

The expected output should be a name of the function in the backtrace at address 0x46fd05 or 0x46fd05 depending on which address I pass.预期的 output应该是地址0x46fd050x46fd05的回溯中的 function 的名称,具体取决于我通过哪个地址。 Currently there is no symbol name associated with this address.目前没有与该地址关联的符号名称。

Any suggesstions.任何建议。

I have compiled the code using -rdynamic我已经使用-rdynamic编译了代码

Putting a side the reason for choosing.a/.so, The 'addr2line' should be used with the binary that was executed.将选择.a/.so 的原因放在一边,“addr2line”应该与已执行的二进制文件一起使用。 The reason is that the backtrace addresses are specific to a binary.原因是回溯地址特定于二进制文件。

The same static (.a) library will usually be loaded into different addresses in different binaries.同一个 static (.a) 库通常会被加载到不同二进制文件中的不同地址。 This is true with '.so' (especially, position-independent code) - but in many cases, Linux will attempt to reuse already mapped '.so' files, so that the actual addresses are the same. '.so' (尤其是与位置无关的代码)确实如此 - 但在许多情况下,Linux 将尝试重用已映射的 '.so' 文件,以便实际地址相同。

Bottom line - from the man page - use the executable name.底线 - 来自手册页 - 使用可执行文件名称。

--exe=filename
           Specify the name of the executable for which addresses should be translated. 
           The default file is a.out.

Some practical note - when using '.so' - you want to execute the addr2line on a system that has the same executable, shared objects, and LD_LIBRARY_PATH.一些实用注意事项 - 使用 '.so' 时 - 您希望在具有相同可执行文件、共享对象和 LD_LIBRARY_PATH 的系统上执行 addr2line。 If there are different '.so' on your development and on production, the addresses may not match.如果您的开发和生产中有不同的“.so”,地址可能不匹配。

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

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