Skip to content

Create a callback for decompilation_changed in decompilers #176

@mahaloz

Description

@mahaloz

Often, we need to know when a decompilation text (or window) for a function was updated. This can be very useful for caching or other event-based code. As such, we need a new callback in the callbacks to handle this case.

Requirements

  • Add a new callback handler to the handlers in libbs/api/decompiler_interface.py#L717, called decompilation_changed. This handler should trigger every time decompilation gets updated through either direct edits or refreshes. Ideally, the data provided by the event is BS objects, like a function and associated things.
  • Implement the actual logic in at least one decompiler, I recommend libbs/decompilers/ida. The most likely way you will implement this is by using the already present HexRays Hooks in libbs/decompilers/ida/hooks.py#L510.
  • The implementation must not cause lag! Thread whatever you can (when applicable). If the delay for a change is more than 1 second, it is too long.

Testing

After implementation, make a new test case in test_decompilers.py. This testcase should verify that if some change (like a variable rename) is triggered, then the decompilation is triggered as well.

Metadata

Metadata

Labels

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions