如何调试包含在libtool脚本中的程序? [英] How to debug a program wrapped in a libtool script?
问题描述
我有一个涉及
- 共享库的项目,即:
mylib.so
- (测试)程序使用这些共享库,即:
test_mylib
- shared libraries ie:
mylib.so
- (test) program using these shared libraries ie:
test_mylib
当我尝试在 test_mylib
上运行 gdb
时,会打印:
When I try to run gdb
on test_mylib
, it prints:
"test_mylib": not in executable format: File format not recognized
当我直接使用真实程序( .libs / test_mylib
)时,仍然抱怨:
When I use the real program (.libs/test_mylib
) directly instead, it still complains:
.libs/test_mylib: can't load library 'libhello.so.0'
如何运行gdb调试我的程序?
How Can I run gdb to debug my program ?
推荐答案
是我几天前遇到的问题,还没有关于SO的通用答案。只有特殊情况。以下是我在此页面上找到的答案: http://www.gnu.org/软件/ libtool / manual / html_node / Debugging-executables.html
This is problem I ran into a couples of days ago and there is no generic answer on SO yet. Only special cases. Here is the answer I found on this page: http://www.gnu.org/software/libtool/manual/html_node/Debugging-executables.html
在程序安装之前,系统不知道在哪里查找共享对象。它们通常位于其源文件夹的 .libs
子目录中。
Until the program is installed, the system does not know where to look for the shared objects. They usually lies in .libs
sub-directory of their source folder.
Libtool生成一个方便的脚本,以便在实际安装完成之前进行调试(谁想要在之前安装错误软件,调试它
Libtool generates a convenience script to allow debugging before the actual installation is done (who wants to install buggy software before, debug it after?)
幸运的是,生成的脚本为此提供了一个帮助器:
Fortunately, the generated script provides a helper for this:
libtool --mode=execute gdb test_mylib
这篇关于如何调试包含在libtool脚本中的程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!