-
Notifications
You must be signed in to change notification settings - Fork 17
Add a new callback decompilation_changed in decompilers
#180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Sanity check for test case in latest CI: https://github.com/binsync/libbs/actions/runs/21654130527/job/62425263591?pr=180#step:9:414 |
tests/test_decompilers.py
Outdated
| deci.artifact_change_callbacks[Decompilation].append(on_decompilation_change) | ||
|
|
||
| # mock objects to simulate IDA's HexRays structures | ||
| class MockCfunc: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hehe I can tell this part was Claude written.
libbs/decompilers/ida/hooks.py
Outdated
| return | ||
|
|
||
| dec = Decompilation( | ||
| # only IDA support for now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A pointless comment. This code is already in IDA.
|
|
||
| deci.shutdown() | ||
|
|
||
| def test_ida_hook_decompilation_event(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
High-level comments:
This is a bad way to test if a feature works. I understand the logic (or the AI's logic?) here, but it's too contrived. Why directly grab the HexraysHook, cause a fake trigger, and then observe if the new hook works?
Why not just get an IDA deci, do some action that forces a refresh (like renaming a variable or calling the refresh API), then seeing if your new hook gets hit. An example of a place I tested a callback implicitly:
libbs/tests/test_decompilers.py
Line 799 in 6959aba
| retrieved_segment = ida_deci.segments[test_segment_name] |
Closes #176
Adds a new hook for IDA that detects when the decompilation has changed. Also includes a test case to verify this works correctly (now implemented!)