如何使用 only-keep-debug 反转 objcopy 的条带?
在现代 Linux 中,几乎所有对象都被剥离并分成两部分(两个文件)。第一个是可执行文件本身,第二个是从原始 ELF 中剥离出来的调试符号。此类文件是通过
objcopy --only-keep-debug original.elf binary.dbg
mv original.elf binary
objcopy --strip-debug binary
如何将 binary
和 binary.dbg
合并到带有调试信息的 ELF 文件中创建的?我想重新创建未剥离的原始二进制文件。它可以不逐字节等于原来的,但里面必须有调试符号。
PS 是的,我知道 gnu.debuglink
部分,但它不适用于某些调试器(etnus)和反汇编器(objdump 无法恢复符号信息)
In modern linux almost all objects are stripped and splitted in two parts (two files). First is executable itself and second is debug symbols, stripped out from original ELF. Such files are created with
objcopy --only-keep-debug original.elf binary.dbg
mv original.elf binary
objcopy --strip-debug binary
How can I merge binary
and binary.dbg
into ELF file with debugging info? I want to recreate unstripped, original binary. It can be not byte-to-byte equal to the original, but it must to have a debug symbols inside.
PS Yes, I know about gnu.debuglink
section, but it doesn't work for some debuggers (etnus) and disassemblers (objdump can't restore symbols info)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于 ELF,
elftils
包包含一个名为eu-unstrip
的工具来完成这项工作。在您的示例的上下文中:eu-unstrip binary binary.dbg
binary.dbg
现在同时具有二进制和调试符号。如果我能找到任何文档,我会提供对文档的引用...For ELF, the
elfutils
package contains a tool calledeu-unstrip
that does the job. In the context of your example:eu-unstrip binary binary.dbg
binary.dbg
now has both the binary and debug symbols. I'd include a reference to documentation if I could find any...您可以使用 eu-unstrip 实用程序将调试符号与可执行文件合并。
You can use
eu-unstrip
utility which merges debug symbols with executables.