Delayed Symbol Resolving

喜欢而已 提交于 2021-02-11 15:02:31

问题


I am working on some diagnostic tools to help locate memory issues on an embedded ARM platform. Due to memory constraints, I can't load all symbols for all libraries on the unit itself. What information do I need to save to be able to resolve symbols later on a different machine?

The machine where I will resolve the symbols is an x86 machine that has a cross toolchain and gdb with all the symbol packages needed. What would I use to resolve the symbols in a batch from this information I've saved in my diagnostic output? Is there a library or API for doing the resolving?


回答1:


The following information is related to Android. Some of it parts are also compiled into ELF files for ARM architecture so it may be useful in your case.

Building process looks like this:

  1. Everything is compiled with debug information (gcc -g ...)
  2. Then all binaries are stripped and packed into system image. But original not-stripped version for every binary file remains in a build directory.
  3. System image is flashed on the target device.

So to resolve symbols from diagnostic output you can use arm-linux-androideabi-addr2line. Example:

${CROSS_COMPILE}addr2line --demangle -f -e PATH_TO_NOT_STRIPPED_BINARY ADDRESS

Additional information can be found it this question: How to use addr2line.

I also prepared a very simple python script which automates this process: decode_callstack.py (it works with Android diagnostic output and you need to change PREFIX variable before use)



来源:https://stackoverflow.com/questions/14402248/delayed-symbol-resolving

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!