2014-03-18 131 views
2

也许,我误解了一些东西,但我不能让GDB去读取调试库。 我在命令行做的是:gdb7.7不加载共享库

gdb 
file problem_exec 
b main 
r 

GDB停在:

(gdb) r 
Starting program: /Users/.../problem_exec 

Breakpoint 1, main (argc=<error reading variable: Could not find the frame base for "main(int, char**)".>, argv=<error reading variable: Could not find the frame base for "main(int, char**)".>) 

没有共享库:

(gdb) info shared 
No shared libraries loaded at this time. 

最后一个命令给出:“没有共享库加载的

我的.gdbinit样子:

# file .gdbinit 
set stop-on-solib-events 1 
# stop gdb from stepping over functions and output diagnostics 
set step-mode on 
set breakpoint pending on 
set env DYLD_LIBRARY_PATH path1:path2:path3 
#automatically load shared libraries (on/off): 
set auto-solib-add on 

我相信,一个可执行文件对共享库的调试版本链接(总共有大约30个库,但一个我很感兴趣的是绝对编译调试模式)。我检查它otool -L problem_exec

如果我运行程序,它会直到我要调试的库运行时错误,但我无法步调一致。
我缺少的东西?

p.s.我在os-x上运行Gdb的自编译版本。

更新:它可能与此problem有关。

回答

2

set stop-on-solib-events 1

通过该设置,GDB应该停止加载任何共享库之前

当你这样做:

file problem_exec 
b main 
r 
    ... where is GDB stopped? 
info shared 

如果GDB停止在main,然后共享库应该被加载。但如果它在动态加载程序中停止(正如我所期望的那样),那么它们应该是而不是加载还是

+0

我更新了这些问题,似乎它停在了main,但是没有共享的libs被加载 – Denis