简体   繁体   English

GDB核心转储:通过build-id查找可执行文件

[英]GDB core dump: Find executable by build-id

Is it possible to make gdb automatically find the corresponding executable file? 有可能让gdb自动找到相应的可执行文件吗? I have extracted the debug symbols and put them in the /usr/lib/debug/.build-id/ directory. 我已经解压缩了调试符号并将它们放在/usr/lib/debug/.build-id/目录中。 When I start gdb with gdb /usr/bin/executable core everything is working fine. 当我用gdb /usr/bin/executable core启动gdb时,一切正常。 All debug symbols for the executable and all shared libraries are automatically loaded because gdb knows about the build-id and automatically loads it. 可执行文件和所有共享库的所有调试符号都会自动加载,因为gdb知道build-id并自动加载它。

$ gdb /usr/bin/executable core
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/executable...Reading symbols from /usr/lib/debug/.build-id/b7/fada8ba917de74a6055647f3ac205dee1615c8.debug...done.

However, when I just start gdb and load the core file, no debug symbols are loaded. 但是,当我刚启动gdb并加载核心文件时,不会加载任何调试符号。

(gdb) core-file core
[New Thread 10822]
[New Thread 10812]
Core was generated by `/usr/bin/executable'.
Program terminated with signal 6, Aborted.
#0  0xb7790424 in __kernel_vsyscall ()

Running gdb with strace shows that it doesn't even try to find them. 使用strace运行gdb表明它甚至没有尝试找到它们。 The core file includes the build-id, so I guess gdb should be able to find it... 核心文件包含build-id,所以我猜gdb应该能够找到它...

$ eu-unstrip -n --core core
0x8048000+0x25d000 b7fada8ba917de74a6055647f3ac205dee1615c8@0x8048178 - - [exe]
0xb7790000+0x1000 da7bd9bbfe599f7e9b644d684db983c4b34d8f31@0xb77901ec . - linux-gate.so.1
0xb7771000+0x19000 242ae1f2965ed161f3715858d7792019963b57fd@0xb7771164 /lib/i686/cmov/libpthread.so.0 - libpthread.so.0
0xb7768000+0x9000 06a49519b1ede0f79596e4b0cd07d2beba43b2dc@0xb7768164 /lib/i686/cmov/librt.so.1 - librt.so.1
0xb7672000+0xf5000 9daf5aac9ccc9281f2805639c3f87731beae5548@0xb7672144 /usr/lib/libstdc++.so.6 - libstdc++.so.6
0xb764c000+0x26000 696d5fb148fe51609203903d470a8f85d458cd17@0xb764c164 /lib/i686/cmov/libm.so.6 - libm.so.6
0xb762e000+0x1e000 d2a7edbd5dafabb7bb90198eeb58013342c589f0@0xb762e104 /lib/libgcc_s.so.1 - libgcc_s.so.1
0xb74e7000+0x147000 2124040143ac9f7478cc16b474b1cfdfe2c45353@0xb74e7184 /lib/i686/cmov/libc.so.6 - libc.so.6
0xb7791000+0x1d000 5a6fc3cf12f68887cbf22da3a9785d00f7d91c41@0xb7791124 /lib/ld-linux.so.2 - ld-linux.so.2

Is there a way to make gdb look for the debug files of the executable without providing the executable that caused the core dump? 有没有办法让gdb查找可执行文件的调试文件而不提供导致核心转储的可执行文件?

You can try loading debug symbols directly with: 您可以尝试直接加载调试符号:

(gdb) symbol-file /tmp/your_debug_symbols.dbg

But I don't think that coredump itself is enough for GDB, the executable needs to be provided for it to understand the core dump. 但我不认为coredump本身对GDB来说已经足够了,需要提供可执行文件才能理解核心转储。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM