使用 gdbserver 调试共享库 [英] Debugging shared libraries with gdbserver

查看:17
本文介绍了使用 gdbserver 调试共享库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在目标和 CodeSourcery IDE 上使用 gdbserver.我的硬件是带有 omap3530 的 gumstix.

I am using gdbserver on target and CodeSourcery IDE. My hardware is a gumstix with a omap3530.

我可以在我的主应用程序中单步执行代码,但是如果我尝试单步执行共享库中的函数,我会得到内存地址并且调试器会终止.

I can step through code in my main application but if I attempt to step into a function in a shared library I get memory address and a debugger terminates.

这是我的库,已编译并复制到目标系统上的/lib 文件夹.(它确实有调试符号)我试图使用 .gbdinit 文件来设置 solib-absolute-prefix/lib

This is my library that is compiled and copied to the /lib folder on the target system.(it does have debug symbols) I have attempted to use the .gbdinit file to set solib-absolute-prefix /lib

以下是来自 gdb 跟踪的警告:

Here are the warnings from the gdb trace:

903,056 13-gdb-set sysroot-on-target /lib
903,065 13^done
903,065 (gdb) 
903,065 14-target-select remote 192.168.1.101:2345
903,114 =thread-group-started,id="i1",pid="42000"
903,114 =thread-created,id="1",group-id="i1"
903,115 15-list-thread-groups --available
903,120 16-list-thread-groups
903,128 &"warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code."
903,128 &"
"

导致

903,395 &"Error while mapping shared library sections:
"
903,397 &"/lib/libCoreLib.so: Invalid argument.
"
903,399 =library-loaded,id="/lib/libCoreLib.so",target-name="/lib/libCoreLib.so",hostname="/lib/libCoreLib.so",low-address="0x0",high-address="0x0",symbols-loaded="0",thread-group="i1"

推荐答案

只要调试机器也是开发机器,就可以使用宿主机上安装的库进行调试.在这种情况下,您使用 set sysroot 而不是 set sysroot-on-target.例如:

You can debug with the library installed on your host, provided the debugging machine is also the development machine. In that case, you use set sysroot instead of set sysroot-on-target. For example :

set sysroot /home/username/.../rootfs/

其中 /home/username/.../rootfs/ 包含目标文件系统的副本

where /home/username/.../rootfs/ contains a copy of your target filesystem

我认为您还应该指定 / 而不是 /lib

I think you should also specify / instead of /lib

这篇关于使用 gdbserver 调试共享库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆