Ghidra: Dependency based redecompilation

Created on 2 Nov 2020  路  2Comments  路  Source: NationalSecurityAgency/ghidra

Is your feature request related to a problem? Please describe.

Any change to the state of the database causes a flushing of the decompilation cache. This is inefficient and a major pain point on large binaries and/or large functions.

Related issues are:
https://github.com/NationalSecurityAgency/ghidra/issues/1883
https://github.com/NationalSecurityAgency/ghidra/issues/1871

Describe the solution you'd like
Certain changes should instead lead to a re-decompilation (ideally, pushed to background threads, but removing them from the cache is also fine) of only some functions in the cache which depend on the changed values. The obvious candidates are:

a.) Local variables and comments -> should only affect the current function. As mentioned in https://github.com/NationalSecurityAgency/ghidra/issues/1871, directly modifying the decompile tree followed by rebuilding the XML is theoretically possible, although as an initial version I would not mind just re-decompiling the current function.

b.) Changes in the function prototype or parameter renames should change the current function and mark all decompiled callers of the function for redecompilation

c.) Mapping which functions have decompiled output dependent on a type/structure definition is probably a stretch goal, but could be possible (similar to the find use of type/field feature already in ghidra).

Describe alternatives you've considered
I have resorted to using reflection from scripts to directly interact with the decompiler cache while performing the changes outlined in (a) and (b).

Most helpful comment

I would like to add that any change to the state of one program's database causes the decompiler cache to be flushed for ALL open programs. This a royal pain when manually comparing programs.

All 2 comments

I would like to add that any change to the state of one program's database causes the decompiler cache to be flushed for ALL open programs. This a royal pain when manually comparing programs.

I'm seriously considering 馃槃 creating a dozen or so extra github logins, just so that I could give this a few more thumbs up.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

0x6d696368 picture 0x6d696368  路  17Comments

mumbel picture mumbel  路  29Comments

0x6d696368 picture 0x6d696368  路  18Comments

tzizi picture tzizi  路  17Comments

0x6d696368 picture 0x6d696368  路  19Comments