This functionality exports Ghidra’s Program information into a DWARF file. This exported information include function’s names, types, stack variables etc.
You can use this extension in different ways as documented below: This extension provides a DWARF exporter that can be used by right clicking on the binary to export, then: From the You can also use the Java API from a (headless) script to export a given Ghidra’s Program: This extension tries to convert as much as possible Ghidra’s internal binary representation into DWARF structures, but this support can’t be exhaustive so here is an overview of what is exported and what is not. ghidra.program.model.listing.Program Function Data Variables Types Comments ghidra.program.model.listing.Function Name Addresses range Parameters Type of parameters Return type Stack variables Types of stack variables Comments CodeUnits ghidra.program.model.listing.Data Name Type Address Comments ghidra.program.model.data.DataType Any types not mentioned here are not supported. https://github.com/NationalSecurityAgency/ghidra/issues/2687Project Manager¶
Export > Format > DWARF:
CodeBrowser¶
CodeBrowser tool, you can left click on the LIEF menu and select Export as DWARF:
Scripts¶
import lief.ghidra.core.dwarf.export.Manager;
import lief.ghidra.core.NativeBridge;
public class LiefDwarfExportScript extends GhidraScript {
@Override
protected void run() throws Exception {
NativeBridge.init();
Manager manager = new Manager(currentProgram);
File output = new File("/home/romain/output.dwarf");
manager.export(output);
}
}
Support & Limitations¶
ghidra.program.model.data.VoidDataTypeghidra.program.model.data.AbstractIntegerDataTypeghidra.program.model.data.Arrayghidra.program.model.data.TypeDefghidra.program.model.data.Compositeghidra.program.model.data.Enumghidra.program.model.data.FunctionDefinitionghidra.program.model.data.PointerReferences¶