Skip to content

LLM Explainer v1.8.0

Choose a tag to compare

@pgarba pgarba released this 20 Jul 23:17

Features

  • Export function as compilable C — a new right-click action (pseudocode or disassembly view) that rewrites the function under the cursor as a standalone .h + .c pair you can paste into a real project. Every other action in this plugin writes into the database; this one takes code out of it.
    • Portable types and intrinsicsstdint.h types instead of __int64/_BYTE/_QWORD, IDA calling-convention keywords dropped, and self-defined static inline replacements for Hex-Rays intrinsics (LOBYTE, __ROL4__, __PAIR64__, …) rather than calls to macros that only exist inside IDA.
    • Real type definitions — IDA's own C definitions of every user-defined type the function uses are collected from its prototype, its Hex-Rays locals and its referenced globals, and printed with idc.print_decls(PDF_INCL_DEPS) so nested/dependent types come along, then converted to portable C.
    • Globals bound to image base + RVA — every referenced global is described with its name, VA, RVA, size, type, segment and writability, and emitted as a typed accessor at g_image_base + RVA with the original VA in a comment, so the result survives relocation.
    • Callees that actually link — a called function the export doesn't define is bound the same way, as a function-pointer typedef plus a same-named macro, so call sites read unchanged instead of leaving an unresolvable extern. Imported CRT/OS functions are declared from their real headers instead, since their address here is only this binary's import thunk.
    • Embedded data — string literals and small read-only tables are sent as actual bytes and emitted as real C initializers (static const char k_name[] = "…";), so the output genuinely stands alone. Writable globals stay address-based.
    • Review UI — the answer streams into a Model output tab, then each emitted file gets its own editable tab, with Copy, Save Files…, a Refine box for follow-up instructions ("target MSVC", "no macros for globals"), and a Continue button for a reply cut off mid-file (files are parsed from the concatenation of every turn, so a continuation closes the block it interrupted).
    • Nothing is written to your database by this action — there is no Accept step at all.

New settings: Max globals exported (40), Embed initialized read-only data (on), Max embedded bytes per global (512), and an editable C export system prompt.

Notes

Both generated-code idioms (the function-pointer macro and the global accessor) were verified to compile clean under clang -std=c11 -Wall -Wextra -Wpedantic and MSVC /W4. The export reuses the existing conversation machinery, so the model can still REQUEST_CODE a callee before declaring it, and multi-server failover applies as usual.