Skip to content

Propagate modified binary data to RetDec for decompilation #50

@PeterMatula

Description

@PeterMatula

Currently, IDA plugin passes the original binary file to RetDec for decompilation. This has several problems:

  1. If user modifies the binary, modification is done on a loaded image inside IDA - the original binary is not modified. Therefore, RetDec decompiles the original, not the modified version - modification is not reflected in the output.
  2. If input file gets rebased, RetDec decompiles something completely different than intended - see Decompilation of object or rebased files #15 for more details.
  3. The same goes for potential custom plugins - see Custom loader plugin decompilation output is nonsense #30 for more details.
  4. Also, passing the original binary limits decompilations only to files that RetDec can handle - see Support of DOL and REL file formats (Gamecube Wii) #14 for more details.

A possible solution is to apply (path) changes to the original binary before the decompilation. This would however not solve problem 4. and I'm if it would work for problems 2. and 3.

The best solution would be to establish a communication channel (callback function) between IDA and RetDec, which could be used by RetDec to query IDA about bytes on addresses as needed. Ghidra decompiler does it this way. However, this is currently not possible since RetDec is not a library.

Encoding all the data to JSON config could be a solution that would solve all the problems.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions