WinDbg x64 extension that disassembles live functions and uses an LLM to produce verified pseudocode.


This project is a Windows x64 WinDbg extension skeleton that resolves a function by name or address, reconstructs a deterministic control-flow view, and asks an LLM directly from the extension to produce pseudocode.
src/extension: WinDbg extension DLL and !decomp command.src/shared: JSON, analyzer, protocol, and verifier code shared by the extension.scripts: build and vendor-copy helpers.third_party/dbgeng: optional vendored dbgeng.h and dbgeng.lib copy.third_party/zydis: vendored stable Zydis source tree used by default when present.xmm0 through xmm3, with vector zero-idiom guards to avoid false incoming arguments/deobf:on|off control over whether recovered obfuscation facts may guide pseudo-C rewriteLoad the extension from the build output, then run !decomp against a symbol or an address:
.load C:\path\to\decomp.dll
!decomp /doctor
!decomp module!FunctionName
!decomp 0x7ffb`12345678
Use /doctor when setup looks wrong or before enabling an LLM provider:
!decomp /doctor
!decomp /doctor:net
/doctor does not require a target and does not call the provider. It reports config path/load status, provider/model/endpoint summary, auth presence without secrets, timeout/token/chunking settings, DML support, session class/qualifier, processor type, and PDB caveats./doctor:net is accepted as an explicit network-check request, but currently reports that provider ping is skipped. The extension does not perform a network probe from doctor mode.Targets can be public/private symbols, exported function names, or addresses. If the target resolves to an address inside a function, the extension tries to recover the containing function range from symbols, unwind data, and control-flow heuristics. Put quotes around targets that contain spaces:
!decomp "my module!Function With Spaces"
The normal command path performs local analysis, builds analyzer facts, optionally calls the configured LLM endpoint, verifies the response against recovered evidence, and prints pseudo-C plus confidence, warnings, and uncertainty notes:
!decomp ntdll!RtlAllocateHeap
!decomp kernel32!Sleep
!decomp game.exe!CheckIntegrity
Normal, brief, and explain output include a compact progress stream even without /verbose. Long LLM runs show local-analysis completion, chunk progress, retry notices, merge start, verification, and the Ctrl+Break cancellation hint. Machine-readable modes such as /view:json, /view:facts, /view:prompt, and /view:data suppress progress lines and DML helper links so scripts receive only the requested payload.
Use /view:* to choose what you want to see. This keeps the command surface small: one option controls all output modes.
!decomp /view:brief module!HotPath
!decomp /view:explain module!BranchyFunction
!decomp /view:json module!FunctionName
!decomp /view:facts module!FunctionName
!decomp /view:prompt module!FunctionName
!decomp /view:data module!FunctionName
!decomp /view:analyzer module!FunctionName
!decomp /view:plan module!FunctionName
brief prints target, confidence, summary, and the first uncertainty or verifier warning.explain adds evidence, control-flow, type-hint, observed-behavior, and call-target sections.json prints machine-readable request and response JSON.facts prints only analyzer facts and disables the LLM path.prompt prints the exact system prompt, user prompt, and prompt facts. It disables the LLM call.data prints a stable JSON snapshot intended for WinDbg JavaScript/NatVis-style automation.analyzer renders the deterministic analyzer-only pseudo-code path without calling the LLM.plan performs local analysis and prints a preflight plan without calling the LLM or updating the result cache. It includes target/module/range counts, PDB availability, session policy, estimated chunking, prompt-size-relevant counts, and practical recommendations.Use /verbose when a command appears stuck or when you want to see the full progress stream:
!decomp /verbose module!SlowFunction
!decomp /verbose /view:json module!SlowFunction