]> sbz's 6dev Repos - elfdbg/.git/blame - README.md
Update readme
[elfdbg/.git] / README.md
CommitLineData
f4b470b9 1# elfdbg
1960d10e
SB
2
3## About
4
5This project _elfdbg_ is a utility program to quickly identify if an ELF binary
6is built with [debug sections](https://en.wikipedia.org/wiki/Debug_symbol)
7
8Debug sections in ELF binary usually are generated using the `-g` flag with the
9compiler. The compiler adds the new `.debug_*` sections in the binary.
10
11The program is looking for the existence of sections with name starting with
12`.debug_` to determine if the binary has been built with debug information.
13
14The [ELF][ELF] format is a well-known standard. ELF TIS reference specification
15is available [here][spec] and as a FreeBSD [elf(5)][man] man page.
16
99eb933a
SB
17## Usage
18
19This is intented to be used in shell script in order to avoid using file(1) and
20parsing the output like below:
21
22```shell
23`file /path/to/binary | awk '/debug_info/{print $2}'` != 'ELF'
24```
25
26To determine if binary has been built with debug, use the following:
27
28```shell
29if elfdbg -q /path/to/binary; then
30 echo "No symbols"
31 else
32 echo "Binary with debug symbols"
33fi
34```
35
36On FreeBSD, you can easily identify the binary packages with missing debug
37using similar one-liner:
38
39```shell
40pkg info -a -l|grep local/bin/|while read a; do echo $a: `elfdbg $a`; done
41```
42
1960d10e
SB
43## Build and install
44
45The Makefile use the standard BSDMakefile to build the program.
46
47```
48make && sudo make install
49```
50
51## Test
52
53The tests cases are implemented using the FreeBSD test suite framework with
54[kyua](https://github.com/jmmv/kyua) and [Kyuafile](./tests/Kyuafile).
55
56```
57make test
58```
59
60## History
61
62* _2015_ I wrote this using libelf elf(3) and gelf(3) API
63 [f4b470b](https://github.com/sbz/elfdbg/commit/f4b470b)
64* _2020_ I rewrote this without relying on libelf API
99eb933a 65 [1960d10](https://github.com/sbz/elfdbg/commit/1960d10)
1960d10e
SB
66
67[ELF]: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
68[spec]: http://refspecs.linuxbase.org/elf/elf.pdf
69[man]: https://www.freebsd.org/cgi/man.cgi?query=elf&sektion=5