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

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

查看所有标签

猜你喜欢:

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

Processing语言权威指南

Processing语言权威指南

Casey Reas、Ben Fry / 张静 / 电子工业出版社 / 2013-10-1 / 139.00

本书介绍了可视化艺术中的计算机编程概念,对开源编程语言Processing作了非常详尽的阐述。学生、艺术家、设计师、建筑师、研究者,以及任何想编程实现绘画、动画和互动的人都可以使用它。书中的大部分章节是短小的单元,介绍Processing的语法和基本概念(变量、函数、面向对象编程),涵盖与软件相关的图像处理、绘制,并且给出了大量简短的原型程序,配以相应的过程图像与注释。书中还有一些访谈文章,与动画......一起来看看 《Processing语言权威指南》 这本书的介绍吧!

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

在线压缩/解压 CSS 代码

随机密码生成器
随机密码生成器

多种字符组合密码

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

HTML 编码/解码