P0: Global-variable CRUD + full function signatures for the decompiler CLI#206
Closed
mahaloz wants to merge 1 commit into
Closed
P0: Global-variable CRUD + full function signatures for the decompiler CLI#206mahaloz wants to merge 1 commit into
mahaloz wants to merge 1 commit into
Conversation
Closes the P0 gap for globals and complete function signatures. Globals: - New `decompiler global list|get|rename|retype`. - IDA: broadened enumeration to idautils.Names() (all named data across .data/.bss/.rodata/.got), not just a hardcoded .artifacts/.bss pair. - Ghidra: implemented global retype (DataUtilities.createData); filtered the enumeration to memory-mapped symbols so synthetic/EXTERNAL symbols (which lift to negative addresses and can't round-trip) no longer leak into `global list`. - Base: public get_global_var (direct read) + client proxy. Signatures: - New `decompiler signature get|set`. - Shared declib/api/prototype.py parses/formats C prototypes (pointers, varargs, void args). - IDA applies the full prototype atomically via idc.SetType — this avoids the existing set_function_header bug where the args pass rebuilt the prototype from a stale cfunc and clobbered a just-set return type. Other backends use the generic parse -> header-overwrite -> set path. - Base get/set_function_signature + client proxies. Tests: backend-parametrized global list/rename and signature get/set/missing (IDA + Ghidra full; angr skips unsupported bits), plus backend-free prototype-parser unit tests. SKILL.md / docs updated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HfZHdprXg38re1XyKxzGg5
Member
Author
|
Integrated into |
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.
What & why
IDALib can list/read/rename/type globals and set complete function signatures; the DecLib CLI could do neither. This adds both.
Globals —
decompiler global list|get|rename|retype.artifacts/.bssonly; now usesidautils.Names(), so named data across.data/.bss/.rodata/.gotall surface (function starts and code labels filtered out).DataUtilities.createData) — previously a# TODO: pass. Also filtered Ghidra's enumeration to memory-mapped symbols, so synthetic/EXTERNAL symbols (which lift to negative addresses and can't round-trip) no longer polluteglobal list.get_global_var(direct read, no cache) + client proxy.Signatures —
decompiler signature get|setdeclib/api/prototype.pyparses/formats C prototypes (pointer returns/args, varargs,void).idc.SetType. This sidesteps a real bug in the existingset_function_header: when both return type and args change, the args pass rebuilds the prototype from a stalecfuncand clobbers the just-applied return type.SetTypesets it in one shot (and can change the parameter count).Tests
Backend-parametrized:
test_global_list,test_global_rename,test_signature_get,test_signature_set,test_signature_get_missing_exits_nonzero, plus backend-freeTestPrototypeParser.Support matrix
Third PR in the IDALib-parity series. Based on
feat/cli-comments(#205).🤖 Generated with Claude Code
https://claude.ai/code/session_01HfZHdprXg38re1XyKxzGg5