Add function signature reconstruction for Issue #14#79
Add function signature reconstruction for Issue #14#79kami922 wants to merge 3 commits intomandiant:masterfrom
Conversation
kami922
commented
Jan 22, 2026
- Parse FuncType metadata to extract input/output parameter types (including variadic flag).
- Build C-style function pointer typedefs and emit them in CReconstructed for Func kinds.
- Represent multiple returns by commenting them in the typedef (C still single-return).
- Add IDA script scaffolding to ingest function types (signature application is intentionally left as future work).
- JSON now carries function signatures instead of opaque void* for functions.
- Parse FuncType metadata to extract input/output parameter types - Build C-style function pointer typedefs with proper signatures - Handle variadic functions and multiple return values - Add infrastructure in IDA script to receive function types - Emit CReconstructed field for Func types in JSON output This enables IDA to import function signatures as types, laying groundwork for applying types to function arguments/locals.
|
@stevemk14ebr Hello based on your review, here is the remaining checklist for the next commit. let me know if I missed anything.
|
|
I like where this is going! We can do better with the arg type and return type parsing though. Checkout this case This function takes 2 inputs, has 1 output, and the types of all 3 are present. Our reconstructed typedef is I'd expect the CStr to be So there's some formatting issues with the reconstruction, but the raw parsing logic seems mostly working! I agree with all the follow on work points, especially about tests. For multiple return values we can use either structures or tuples, the project uses structures now, but IDA recently added tuples for Go so lets prefer those for this function type work. https://hex-rays.com/blog/stop-guessing-and-start-going Actually applying these signatures via IDA scripting can be quite tricky since the types recursively depend on other types. I am completely ok with not having the IDA script implemented for now. I care most about reasonable and correct symbol recovery. We can do the IDA script work later. |
Fix param array offset from baseSize+4 to baseSize+ptrSize to account for struct padding on 64-bit. Add tflagUncommon handling (+16 bytes). Reformat CStr as "returnType (params)", add Reconstructed with Go syntax, fix CReconstructed with actual parsed types and clean funcptr name. Collect both Go and C type names during param parsing.
|
The CStr output formatting is inconsistent. See this case: The type recovery indicates 2 output arguments, but the CStr reconstruction is |
Handle multiple returns using tuple syntax in CStr field. For func() (int, bool), CStr now shows 'tuple(int32, bool) (void)' instead of incorrectly showing 'void (void)'.
|
@stevemk14ebr Hello, just dropping by to remind you about the pr. |
|
Hi, have other work taking priority I will review when able, thanks! |
|
@stevemk14ebr Hello dropping by again for review whenever convenient |
|
@stevemk14ebr Hello can you please review this as well? |
|
I'm aware of this, this one's a bit bigger so I have to set aside some time to review with the focus needed |