您的位置:首页 > 其它

How to make seperate debuginfo file

2017-10-25 00:00 288 查看
Some versions of Linux allow you to place debugging information in a separate file. These files, which can have any name, are called gnu_debuglink files. Because this information is stripped from the program's file, it almost always greatly reduces the size of your program. In most cases, you would create gnu_debuglink files for system libraries or other programs for which it is inappropriate to ship versions have debugging information.

you create an unstripped executable or shared library, you can prepare the gnu_debuglink file. Here's an overview:

Create a .debug copy of the file. This second file will only contain debugging symbol table information. That is, it differs from the original in that it does not contain code or data. Create this file on Linux systems that support the --add-gnu-debuglink and --only-keep-debug command-line options. If objcopy -- -help mentions --add-gnu-debuglink, you should be able to create this file. See man objcopy for more details.
Create a stripped copy of the image file, and add a .gnu_debuglink section to the stripped file that contains the name of the .debug file and the checksum of the .debug file.
Distribute the stripped image and .debug files separately. The idea is that the stripped image file will normally take up less space on the disk, and if you want the debug information, you can also install the corresponding .debug file.

The following example creates the gnu_debuglink file for a program named hello. It also strips the debugging information from hello:

objcopy --only-keep-debug hello hello.gnu_debuglink.debug

objcopy --strip-all hello hello.gnu_debuglink

objcopy --add-gnu-debuglink=hello.gnu_debuglink.debug \

hello.gnu_debuglink
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: