GDB无法加载,因此文件和错误没有这样的文件或目录 [英] GDB failed to load so files and errors No such file or directory

查看:899
本文介绍了GDB无法加载,因此文件和错误没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将带有高山linux的核心文件加载到Docker容器内的GDB中。
最初,我的gdb抱怨找不到二进制文件,然后我按照此讨论 gdb在启动程序期间,代码127 退出并安装了libc6-compat,即使我有64位linux,并且我的二进制解释器是64位 [请求程序解释器: /lib64/ld-linux-x86-64.so.2]

I am loading a core file into GDB inside a docker container with alpine linux. Initially my gdb complained about binary not found, then i followed this discussion gdb During startup program exited with code 127 and installed libc6-compat, even though I have a 64-bit linux and my interpreter for the binary is 64-bit [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]

这确实有效,但是现在我遇到了同样的错误。这样的文件。我可以看到.so文件位于solib-search-path上设置的路径中,但是gdb没有加载任何库,并且抱怨没有这样的文件或目录。

That actually worked but now i get the same error for the .so files. I can see that .so files are in the path set on solib-search-path but gdb did not load any of the libraries and complains No such file or directory.

二进制文件在生产主机上运行,​​库位于路径
中,我通过设置solib-search-path

binary runs on a production host where the libraries are in the path I am running the binary on a development host by setting the solib-search-path

ldd在开发主机上运行二进制文件二进制表示未找到期望的库,因为这是开发主机

ldd binary says libraries not found which is expected since this is a development host

推荐答案


binary在生产主机所在的库所在的路径上,我通过设置solib-search-path

binary runs on a production host where the libraries are in the path I am running the binary on a development host by setting the solib-search-path

在开发主机上运行二进制文件是您的问题所在。

There is your problem right here.

solib-search-path GDB 会查找库。

不会影响二进制文件本身,二进制文件使用标准系统库路径编译,在 DT_RPATH LD_LIBRARY中_PATH 环境变量来搜索共享库。

In no way does that setting affect the binary itself, which uses either standard system library path, compiled-in DT_RPATH, or LD_LIBRARY_PATH environment variable to search for shared libraries.

通常, solib-search-path 仅应在分析来自其他主机的核心转储时设置(GDB需要访问生成核心转储时使用的确切库)。不必在运行本地二进制文件时设置 solib-search-path - GDB可以通过询问运行时加载器的位置来自动推断出库的位置。

Usually, solib-search-path should only be set when you are analyzing a core dump that came from some other host (GDB needs access to the exact libraries that were used when the core dump was generated). Setting solib-search-path while running a local binary should never be ncessary -- GDB can automatically deduce where the libraries are by asking the runtime loader where they are.


ldd二进制文件表示未找到库,因为这是开发主机,因此是预期的

ldd binary says libraries not found which is expected since this is a development host

如果 ldd 这样说,那么当然您将无法运行二进制文件(在GDB外部)

If ldd says that, then of course you will not be able to run the binary (inside of outside GDB).

这篇关于GDB无法加载,因此文件和错误没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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