ELF 的 gnu_debuglink 部分给了我奇怪的名字
我使用过 Ubuntu 20.04.3,当我运行时,
readelf --string-dump=.gnu_debuglink /usr/bin/cp
我得到了奇怪的调试文件名,同时期待类似 cp.debug 的内容。
String dump of section '.gnu_debuglink':
[ 0] 674b3a5e9ca27e34cf3517aa997ba91ce6e0a0.debug
[ 31] k`-
这是原始的 Ubuntu 映像,根本没有修改。 这有什么原因吗?
I've used Ubuntu 20.04.3, and when I run
readelf --string-dump=.gnu_debuglink /usr/bin/cp
I got weird debug filename while expecting something like cp.debug
String dump of section '.gnu_debuglink':
[ 0] 674b3a5e9ca27e34cf3517aa997ba91ce6e0a0.debug
[ 31] k`-
This is the original Ubuntu image, no modification at all.
Is there any reason for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个名字没有什么奇怪的。
有两种常见方案可用于关联程序和该程序的调试信息——程序名称或其链接器构建 ID。
您可以使用 readelf -n /usr/bin/cp 找到链接器 build-id。以下是我系统上的输出:
您的 cp 版本的链接器构建 ID 很可能是 674b3a5e9ca27e34cf3517aa997ba91ce6e0a0。
对于可能出现在多个不同名称下的程序,使用链接器 build-id 特别方便(仅使用程序名称,您将必须创建调试信息的多个副本(或链接))。
另外,如果程序更新,其链接器构建 ID 将会更改,因此调试器不可能加载“过时的”调试信息。
There is nothing weird about this name.
There are two common schemes for associating the program and debug info for that program -- name of the program, or its linker build-id.
You can find linker build-id with
readelf -n /usr/bin/cp
. Here is the output on my system:Chances are, the linker build-id for your version of
cp
is674b3a5e9ca27e34cf3517aa997ba91ce6e0a0
.Using linker build-id is especially convenient for programs which can appear under several different names (where using just the program name you would have to create several copies (or links) of the debug info).
Also, if the program is updated, its linker build-id will change, and so there is no chance that the "stale" debug info would be loaded by the debugger.