【问题标题】:gdb7.7 does not load shared librariesgdb7.7 不加载共享库
【发布时间】:2014-03-18 22:48:40
【问题描述】:

也许,我误解了一些东西,但我不能让 Gdb 读取调试库。 我从命令行做的是:

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 question_exec

检查了它

如果我运行程序,它会一直运行到我要调试的库中出现运行时错误,但我无法介入。
我错过了什么吗?

附言我在 os-x 上运行自编译版本的 Gdb。

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

【问题讨论】:

    标签: gdb


    【解决方案1】:

    set stop-on-solib-events 1

    使用该设置,GDB 应该在加载任何共享库之前停止。

    当你这样做时:

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

    如果 GDB 在 main 处停止,则应加载共享库。但是如果它在动态加载器中停止(正如我所期望的那样),那么它们应该被加载

    【讨论】:

    • 我更新了问题,似乎它停在了主要的地方,但无论如何都没有加载共享库
    猜你喜欢
    • 2019-02-10
    • 2018-04-07
    • 2019-04-17
    • 1970-01-01
    • 1970-01-01
    • 2012-06-19
    • 1970-01-01
    • 1970-01-01
    • 2015-08-06
    相关资源
    最近更新 更多