无法在gdb中加载共享库 [英] Cannot load shared libraries in gdb

查看:150
本文介绍了无法在gdb中加载共享库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 gdb 中运行应用程序,但似乎我的debbuger出现了问题.我无法以所有尝试的方式加载共享库.

I'm trying to run application in gdb but it seem's I have problem with debbuger. I cannot load shared libraries all the ways I've tried to.

库存储在/usr/local/lib64 中,并且环境还可以:

Libraries are stored in /usr/local/lib64 and environment is ok:

echo $LD_LIBRARY_PATH
/usr/local/lib64:/home/user/lib

当我在 gdb 中运行称呼时,会发生以下情况:

When I run appllication in gdb, the following happens:

(gdb) set solib-search-path /usr/local/lib64
(gdb) show solib-search-path The search path for loading non-absolute
shared library symbol files is /usr/local/lib64. 
(gdb) info sharedlibrary No shared libraries loaded at this time.

我无法设置任何断点来调试我的应用程序,但是与此同时,应用程序在gdb中运行正常,并且调试符号正在从二进制文件中读取!

and I can't set any breakpoint to debug my app, but at the same time app is running ok in gdb and debug symbols are reading from binaries!

我想,问题与权限有关,但不知道确切的位置.

I guess, the problem is related with permissions but don't know exactly where it is.

为避免造成任何误解,我应该注意到我的应用程序运行良好,并且对共享库的访问没有任何麻烦.

To avoid any misunderstanding, I should notice that my application runs good and I don't have any troubles with access to shared libraries.

推荐答案

当我在gbd中运行应用程序时,会发生以下情况:

When I run appllication in gbd, the following happens:

您还没有真正运行该应用程序,因此目前没有加载共享库"是正确的,并且已预期.

You haven't actually run the application yet, so "no shared libraries loaded at this time" is correct and expected.

您需要实际执行GDB run 命令.

You need to actually execute the GDB run command.

更新:

我可以执行运行命令,这很奇怪.

I can execute run command and that's a strange thing.

不,这不是一件奇怪的事情.您没有问题,一切都按预期进行.

No, it's not a strange thing. You don't have a problem, everything is working as expected.

我猜您的 real 问题是您无法在应用程序正在使用的共享库中设置断点.解决该问题的方法是:

I am guessing that your real problem is that you can't set breakpoints in shared libraries that your application is using. A solution for that problem is to do this:

gdb /path/to/app
(gdb) start

# Application stops at main.
# You can now set any breakpoint you want.
(gdb) break foo.c:123

这篇关于无法在gdb中加载共享库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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