Awesome Open Source
Awesome Open Source

Ghidra2Dwarf

Inspired by: dwarfexport

Contributions are welcome, feel free to open an issue if something is broken.

Ghidra2Dwarf is a ghidra plugin that allows to exports informations (such as functions, decompiled code, types) from ghidra to dwarf sections inside ELF binaries.

More specifically it exports inside a source file named ${program}_dbg.c all the decompiled functions, and create an ELF binary named ${program}_dbg that can be used to do source code level debugging.

Example:

Inside gdb now you can use:

  1. list <function> to display the function's source code.
  2. n to step one source code line instruction.
  3. ni to step one assembly instruction.
  4. p variable to print the variable's value.

Install

  • Unzip the latest release.
  • In the script manager -> script directories add the extracted directory:

Run

Run ghidra2dwarf.py inside the script manager:

Headless mode

This mode only works in ghidra 9.1.2 at the moment https://github.com/NationalSecurityAgency/ghidra/issues/2561

Linux

If you saved the project and ghidra is closed, you can launch ghidra2dwarf.sh to run ghidra in headless mode and export the dwarf informations:

$ ./src/ghidra2dwarf.sh <Project directory> <Project name> <Binary path> <Binary>
$ # Example: ./src/ghidra2dwarf.sh ~/.local/share/ghidra/ TEST ~/CTF/ chall

Windows

TODO



Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Python (807,639
Headless Browsers (3,280
Sections (2,699
Capture The Flag (2,480
Reverse Engineering (2,312
Elf (1,798
Decompiler (592
Pwn (517
Ghidra (140
Ghidra Plugin (23
Dwarf (22
Ghidra Scripts (18