linux 中的调试符号文件

本文介绍了一种生成调试符号信息的方法,通过使用objcopy工具完成debug信息的分离与关联。具体步骤包括正常链接可执行文件、仅保留调试信息并创建debug文件、剥离调试信息生成精简版可执行文件、将debug信息链接回精简版可执行文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装软件的时候,经常会发现有一些 -dbg 的包,比如 iceweasel-dbg,软件包信息中指出这个包中包含了 iceweasel 的调试符号信息。那么调试符号信息是如何生成的呢,生成的调试符号信息又如何使用呢?

看了 strip 的 manual,发现有这样一个功能:

--only-keep-debug    removing contents of any sections that would not be stripped by --strip-debug  and  leaving  the debugging sections intact.

正是生成 debug symbol 的方法,manual 里面详细介绍了如何制作 debug symbol 文件,并且将 stripped 的可执行文件和 debug 文件关联起来的办法。

1.<Link the executable as normal.  Assuming that is is called>
"foo" then...

2.<Run "objcopy --only-keep-debug foo foo.dbg" to>
create a file containing the debugging info.

3.<Run "objcopy --strip-debug foo" to create a>
stripped executable.

4.<Run "objcopy --add-gnu-debuglink=foo.dbg foo">
to add a link to the debugging info into the stripped executable.
阅读(232) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值