Add create-type, retype, and sync to the decompiler CLI#195
Merged
Conversation
Feature 1 (retyping): - `create-type "<C def>"` parses a C struct/enum/typedef into a libbs artifact (new libbs/api/type_definition_parser.py, pycparser-based with natural-alignment offsets) and applies it across any backend. - `retype <func> <var> <type>` sets a local variable's or argument's type. Feature 2 (synching): - `sync <func> --from-id <src> [dest filters]` copies a function's name, return/arg types, stack-variable names+types, and referenced user types from one running server into another for the same binary. Addresses and stack offsets are canonical, so artifacts re-key across decompilers. Underlying fixes required for cross-decompiler (IDA->Ghidra) sync: - ghidra headless: force -Djava.awt.headless=true so a stale DISPLAY no longer crashes the JVM with an X11 AWTError. - Function.__setstate__: initialize the dec_obj slot so access after a deserialization round-trip (get_dependencies, rename) doesn't raise. - IDA headless DummyIDACodeView: implement real set_lvar_type/rename_lvar via modify_user_lvar_info/rename_lvar so retypes persist headlessly. - ghidra typestr_to_gtype: resolve a pointer-to-user-struct (e.g. "Point *") by building the pointer from the looked-up base type. Tests (tests/test_decompiler_cli.py): parser unit tests, create-type/retype across angr/Ghidra/IDA, and IDA->Ghidra sync of both names and types. SKILL.md documents the three new commands. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature 1 (retyping):
create-type "<C def>"parses a C struct/enum/typedef into a libbs artifact (new libbs/api/type_definition_parser.py, pycparser-based with natural-alignment offsets) and applies it across any backend.retype <func> <var> <type>sets a local variable's or argument's type.Feature 2 (syncing):
sync <func> --from-id <src> [dest filters]copies a function's name, return/arg types, stack-variable names+types, and referenced user types from one running server into another for the same binary. Addresses and stack offsets are canonical, so artifacts re-key across decompilers.Underlying fixes required for cross-decompiler (IDA->Ghidra) sync:
Tests (tests/test_decompiler_cli.py): parser unit tests, create-type/retype across angr/Ghidra/IDA, and IDA->Ghidra sync of both names and types. SKILL.md documents the three new commands.
Demo