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

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

问题描述

我在目标和CodeSourcery IDE上使用gdbserver。我的硬件是一个带有omap3530的软件。



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



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

以下是gdb trace的警告:

  903,056 13-gdb -set sysroot-on-target / lib 
903,065 13 ^ done
903,065(gdb)
903,065 14-target-选择远程192.168.1.101:2345
903,114 =线程组启动,id =i1,pid =42000
903,114 =线程创建,id =1,group-id = i1
903,115 15-list-thread-groups --available
903,120 16-list-thread-groups
903,128&警告:无法找到动态链接器断点函数。 nGDB将无法调试共享库初始化程序\\\
and跟踪exp合法加载的动态代码。
903,128&\\\

导致

  903,395&映射共享库区段时出错:\ n
903,397&/ lib / libCoreLib.so:无效参数.\\\

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。例如:

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

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

我想你应该指定 / 而不是 / lib


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.

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

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.\nGDB will be unable to debug shared library initializers\nand track explicitly loaded dynamic code."
903,128 &"\n"

Which leads to

903,395 &"Error while mapping shared library sections:\n"
903,397 &"/lib/libCoreLib.so: Invalid argument.\n"
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"

解决方案

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/

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

I think you should also specify / instead of /lib

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

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