Utility to determine if ELF binary is built with debug sections

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

内容简介: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

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

查看所有标签

猜你喜欢:

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

高效团队开发

高效团队开发

[日] 池田尚史、[日] 藤仓和明、[日] 井上史彰 / 严圣逸 / 人民邮电出版社 / 2015-7 / 49.00

本书以团队开发中所必需的工具的导入方法和使用方法为核心,对团队开发的整体结构进行概括性的说明。内容涉及团队开发中发生的问题、版本管理系统、缺陷管理系统、持续集成、持续交付以及回归测试,并且对“为什么用那个工具”“为什么要这样使用”等开发现场常有的问题进行举例说明。 本书适合初次接手开发团队的项目经理,计划开始新项目的项目经理、Scrum Master,以及现有项目中返工、延期问题频发的开发人......一起来看看 《高效团队开发》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器