交叉编译环境的linaro-gdb可以用了,结果打开core文件,显示堆栈都是??
aarch64-linux-gun-gdb ./test core
warning: /lib/libpthread.so.0': Shared library architecture unknown is not compatible with target architecture aarch64.
warning:'/lib/libdl.so.2': Shared library architecture unknown is not compatible with target architecture aarch64.
warning: /lib/librt.so.1': Shared library architecture unknown is not compatible with target architecture aarch64.
warning: /lib/libstdc++.so.6': Shared library architecture unknown is not compatible with target architecture aarch64.
warning: /lib/libm.so.6': Shared library architecture unknown is not compatible with target architecture aarch64.
warning: /lib/libgcc_s.so.1': Shared library architecture unknown is not compatible with target architecture aarch64.
warning: /lib/libc.so.6': Shared library architecture unknown is not compatible with target architecture aarch64.
warning: Could not load shared library symbols for /lib/ld-linux-aarch64.so.1.
Do you need "set solib-search-path" or "set sysroot"?
varning: Loadable section ",note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELE segments
Core was generated by './vdevicemonitor'.
Proaram terminated with sianal SIGABRT, Aborted.
#0 0x000040002b80cld4 in ?? () from /lib/libc.so.6
1.实际显示??的原因就是它提示的原因。 就是它在交叉环境下找不到这个平台的动态库,无法加载。( 其实我理解它本身有可能继续加载堆栈的,因为使用x /200a $sp 还是可以看档当前进程文件自身带的符号表的。 只是gdb发现前面的加载不了后面的也就不加载了)。
2.解决的方法实际提示中也给了。 就是用一下set solib-search-path或set sysroot配置一下动态库搜索路径,让他知道到哪里去搜索就好。
前提是现有动态库。 可以到对应的arm系统里把缺少的动态库挨个按照文件结构下载好。
然后用set sysroot /home/test/arm_lib。 然后gdb就会重新加载符号表,然后堆栈也就有了。O(∩_∩)O哈哈~。
正常情况下,set sysroot /home/test/arm_lib执行之后会触发动态库重新加载。倘若没有重新加载,应该就是文件目录放错了。 可以通过info sharedlibrary确认下动态库目录然后改改路径。
试了下set solib-search-path好像不太好使,不过感觉二者功能差不多,可能没有用对姿势吧。