Utility to determine if ELF binary is built with debug sections

栏目: IT技术 · 发布时间: 3年前

内容简介:This projectDebug sections in ELF binary usually are generated using theThe program is looking for the existence of sections with name starting with

elfdbg

About

This project elfdbg is a utility program to quickly identify if an ELF binary is built with debug sections

Debug sections in ELF binary usually are generated using the -g flag with the compiler. The compiler adds the new .debug_* sections in the binary.

The program is looking for the existence of sections with name starting with .debug_ to determine if the binary has been built with debug information.

The ELF format is a well-known standard. ELF TIS reference specification is available here and as a FreeBSD elf(5) man page.

Usage

This is intented to be used in shell script in order to avoid using file(1) and parsing the output like below:

`file /path/to/binary | awk '/debug_info/{print $2}'` != 'ELF'

To determine if binary has been built with debug, use the following:

if elfdbg -q /path/to/binary; then
        echo "No symbols"
    else
        echo "Binary with debug symbols"
fi

On FreeBSD, you can easily identify the binary packages with missing debug using similar one-liner:

pkg info -a -l|grep local/bin/|while read a; do echo $a: `elfdbg $a`; done

Build and install

The Makefile use the standard BSD Makefile to build the program.

make && sudo make install

If your on Linux, use make -f GNUMakefile to specify the GNU Makefile.

Test

The tests cases are implemented using the FreeBSD test suite framework with kyua and Kyuafile .

make test

History

  • 2015 I wrote this using libelf elf(3) and gelf(3) API f4b470b
  • 2020 I rewrote this without relying on libelf API 1960d10

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

触点管理

触点管理

[德] 安妮·M·许勒尔(Anne M. Schuller) / 于嵩楠 / 中国人民大学出版社 / 2015-12-1 / 49.00元

我们所处的时代正经历着巨大的变革,变得越来越数字化、复杂化和社会化。互联网浪潮猛烈冲击着传统商业世界,数字原住民队伍不断壮大,改变了企业的内外生态环境;金字塔式结构正在瓦解,组织变得越来越网络化和扁平化;员工接管了企业的话语权,我们比任何时期都更需要员工的忠诚,并期望他们表现出更加自主的创造力和协作精神。 在数字化商业世界里,公司内部员工与组织和领导之间接触点的数量直线上升,任何真相都无法对......一起来看看 《触点管理》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具