NationalSecurityAgency / ghidra

Ghidra is a software reverse engineering (SRE) framework
https://www.nsa.gov/ghidra
Apache License 2.0
51.9k stars 5.89k forks source link

Generate Matching C Source Code. #6975

Closed palmerj closed 1 month ago

palmerj commented 1 month ago

Is it possible to create a workflow (perhaps through a script or plugin) that allows modifying C code directly in the decompiler window, recompiling the function, and then comparing the output against the original assembly code?

I understand that this would involve determining the correct compiler and compiler options used to generate the original ASM. Ideally, the workflow would allow iterative changes to the C code until the recompiled version matches the original ASM as closely as possible.

Additionally, I assume that some global headers or type definitions might be needed to ensure the C code compiles correctly. Any guidance on setting this up or existing tools that might assist would be greatly appreciated.