在 "No shared libraries loaded at this time" 的情况下是否可以获取回溯?

Is it possible to get the backtrace in the case where "No shared libraries loaded at this time"?

我得到 "No shared libraries loaded at this time",当我给出 "info share" 命令时,我还在 gdb 上加载了符号文件和核心。但通常 coredump 应该根据其相应的应用程序加载共享库。我已经指定了 solib-search-path,GDB 在搜索符号时将在其中查找共享库。

在"No shared libraries loaded at this time"的情况下是否可以获取回溯?

gdb>info sharedlibrary
No shared libraries loaded at this time.
gdb> bt
#0  0xb6d1f232 in ?? ()
#1  0xb6d25ddc in ?? ()
#2  0xb6d25ddc in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

非常感谢,提前。

I'm getting "No shared libraries loaded at this time"

最常见的原因:二进制不匹配。

让我们将主机定义为您所在的机器 运行 GDB,并将目标定义为发生核心转储的机器。

  • 如果主机 == 目标,您可能已经为 GDB 提供了与崩溃的可执行文件不匹配的主可执行文件,或者
  • 系统库(尤其是 libc)已更新,或者
  • host != 目标和系统库在主机和目标之间不同。

I have specified the solib-search-path

在加载 core 后指定 solib-search-path 无效。改为这样做:

gdb ./a.out
(gdb) set solib-search-path /path/to/libs
(gdb) core core  # load core *after* setting solib-search-path

使用 set verbose on 可能有助于准确显示 GDB 正在尝试加载哪些库(如果有的话)。