Some experiments around compiling the most used Dwarf information (ELF debug data) directly into assembly.
Find a file
2018-10-23 16:15:40 +02:00
benching Cleanup work tree with gitignores 2018-08-08 14:36:53 +02:00
env env/apply: fix deactivate 2018-07-04 18:13:19 +02:00
shared Handle rbx 2018-06-22 09:15:10 +02:00
src Makefile: change libs order to ease compilation 2018-10-23 16:15:40 +02:00
stack_walker Use max(uintptr_t) as error, not assert(0) 2018-06-13 19:13:33 +02:00
stack_walker_libunwind Add a libunwind-powered stack_walker 2018-05-18 11:33:39 +02:00
stats stats: various modifications 2018-08-08 14:38:41 +02:00
tests Add a libunwind-powered stack_walker 2018-05-18 11:33:39 +02:00
.gitignore Add two csmith benching scripts 2018-06-04 15:07:38 +02:00
compare_sizes.py compare_sizes: compare to original program size 2018-07-02 12:44:27 +02:00
extract_pc.py Refactor extract_pc 2018-05-11 13:09:58 +02:00
generate_eh_elf.py Can generate PC holes in eh_elfs 2018-07-04 18:14:30 +02:00
LICENSE Initial commit 2018-04-20 11:33:48 +02:00
Makefile Add python script to compile easily 2018-04-25 17:33:59 +02:00
README.md Update README 2018-08-17 20:58:02 +02:00
shared_python.py Add auxiliary eh_elfs directories 2018-06-22 08:56:20 +02:00

Dwarf Assembly

A compiler from DWARF unwinding data to native x86_64 binaries.

This repository also contains various experiments, tools, benchmarking scripts, stats scripts, etc. to work on this compiler.

Dependencies

As of now, this project relies on the following libraries:

These libraries are expected to be installed somewhere your compiler can find them. If you are using Archlinux, you can check these PKGBUILDs.

Scripts and directories

  • ./generate_eh_elf.py: generate .eh_elf.so files for a binary (and its dependencies if required)

  • ./compare_sizes.py: compare the sizes of the .eh_frame of a binary (and its dependencies) with the sizes of the .text of the generated ELFs.

  • ./extract_pc.py: extracts a list of valid program counters of an ELF and produce a file as read by dwarf-assembly, deprecated.

  • benching: all about benchmarking

  • env: environment variables manager to ease the use of various eh_elfs in parallel, for experiments.

  • shared: code shared between various subprojects

  • src: the compiler code itself

  • stack_walker: a primitive stack walker using eh_elfs

  • stack_walker_libunwind: a primitive stack walker using vanilla libunwind

  • stats: a statistics gathering module

  • tests: some tests regarding eh_elfs, deprecated.

How to use

To compile eh_elfs for a given ELF file, say foo.bin, it is recommended to use generate_eh_elf.py. Help can be obtained with --help. A standard command is

./generate_eh_elf.py --deps --enable-deref-arg --global-switch -o eh_elfs foo.bin

This will compile foo.bin and all the shared objects it relies on into eh_elfs, in the directory ./eh_elfs, using a dereferencing argument (which is necessary for perf-eh_elfs).

Generate the intermediary C file

If you're curious about the intermediary C file generated for a given ELF file foo.bin, you must call dwarf-assembly directly. A parameter --help can be passed; a standard command is

./dwarf-assembly --global-switch --enable-deref-arg foo.bin

Beware! This will generate the C code on the standard output.