Some experiments around compiling the most used Dwarf information (ELF debug data) directly into assembly.

Théophile Bastian e5693328e2 DwAsm: check global bounds 1 year ago
benching b9c6f748ce Add python benchmark 1 year ago
env b3c5b647b5 env/apply: fix deactivate 2 years ago
shared 12e749f542 Handle rbx 2 years ago
src e5693328e2 DwAsm: check global bounds 1 year ago
stack_walker 81b3419690 Use max(uintptr_t) as error, not assert(0) 2 years ago
stack_walker_libunwind df2d6179a8 Add a libunwind-powered stack_walker 2 years ago
stats 6629de9a3e stats: various modifications 2 years ago
tests df2d6179a8 Add a libunwind-powered stack_walker 2 years ago
.gitignore 715a8f371a Add two csmith benching scripts 2 years ago
LICENSE c3109c60f4 Initial commit 2 years ago
Makefile 31f811eca4 Add python script to compile easily 2 years ago 730d964ac5 Update README 2 years ago 4181dd828a compare_sizes: compare to original program size 2 years ago 13ebe46df2 Refactor extract_pc 2 years ago 382914d193 Generate_eh_elf: apply black 1 year ago 21dcd7969e Add auxiliary eh_elfs directories 2 years ago

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.


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 files for a binary (and its dependencies if required)
  • ./ compare the sizes of the .eh_frame of a binary (and its dependencies) with the sizes of the .text of the generated ELFs.
  • ./ 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 Help can be obtained with --help. A standard command is

./ --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.