VEH Debugger
Windows debugger based on VEH (Vectored Exception Handler) instead of the Windows Debug API. Ideal for reverse engineering targets with anti-debug protection.
Thread control
veh_threads() lists threads. Controls require an explicit threadId:
veh_threads(action="freeze", threadId=123)
veh_threads(action="thaw", threadId=123)
veh_threads(action="thaw", threadId=0) // release all freezes explicitly
veh_threads(action="terminate", threadId=123)
Malformed or unconfirmed control replies are errors. Termination requires backend support, is forceful and can leave target locks held. List/freeze/thaw support breakpoint actions; termination supports direct/batch calls only. During a pending run-until operation, thread listing remains available; cancel the operation before a thread control action.
Module and symbol selection
MCP symbol search lists up to ten candidates with image bases, paths and available address widths. Use veh_symbolize(name="Function", module_base="0x...") or 0xBASE!Function in address expressions to select a duplicate image. Unknown widths stay unknown; external backend support is required for the new queries. See the changelog for upgrade notes.
Persistent MCP comments and labels are managed through veh_symbolize(analysis=...) and saved as JSON in a selected local folder. Builds stay isolated and changed code is marked for review; unavailable build identities never auto-apply notes. See the repository's analysis notes guide.
Function-breakpoint module guards support automatic release after loader-safe binding on backends implementing stop identity v1. Exact identity/ownership is checked atomically; user/replaced holds remain stopped. Older backends keep explicit pause/continue behavior. Public DAP/MCP arguments are unchanged.
For ordinary inspection, veh_disassemble(address="...") uses the observed mode at the current stop PC on supporting backends and the process width elsewhere; it returns addressBits. Only specify threadId or address_bits=32|64 when an override is needed, never both. veh_enum_locals(threadId=...) defaults to the top frame. To inspect a caller, pass its veh_stack_trace frame's address as instructionAddress and its frameBase together. A zero returnAddress means unavailable. Empty variables is successful; invalid addresses and backend failures return errors. See register context.
Page-exception data watches use existing veh_set_data_breakpoint(address="0x...", method="page", type="write", size=4) and veh_remove_data_breakpoint(id=...). This optional local VEH mode uses no DR slots, stops before the attempted instruction and supports direct/batch/actions. It supports private data pages only and reports coverage="best_effort": peer threads are held during the one-instruction retry, but guard dispatch, internal threads and kernel accesses can still escape observation. Software INT3 stays installed while stopped; DR watches cover supported Windows thread starts before user code. See page watches for limits and restoration.
Features
- Anti-debug friendly — Uses VEH instead of
ntdll!DbgUiRemoteBreakin, bypasses common anti-debug checks
- Software breakpoints — INT3 (0xCC) patching at any address
- Hardware breakpoints — DR0-DR3 registers for memory read/write/execute watch (like Cheat Engine's "Find what writes/accesses")
- x86 & x64 — Debug both 32-bit and 64-bit processes
- PDB symbols — Source file + line number mapping, function name breakpoints
- Disassembly — Zydis x86/x64 disassembler with full operand display
- Memory read/write — Inspect and modify process memory
- Register editing — Modify register values directly from the Variables panel
- Conditional breakpoints — Break only when condition is met (
RAX==0x1234, *0x7FF600!=0, RCX>0x100)
- Hit count breakpoints — Break on Nth hit
- Log points — Log
{RAX}, {*0x7FF600} to Debug Console without stopping execution
- Multiple injection methods — CreateRemoteThread, NtCreateThreadEx, Thread Hijack, QueueUserAPC
- TCP remote mode — Debug across VMs or network
- Authenticated MCP backend connections — Registered remote profiles use pinned TLS and a resident runner for backend startup, host launch and reconnect; the runner is included in the binary distribution
- MCP tool server — Debugger operations exposed directly to AI agents (Claude, Cursor, Codex, etc.)
- Bounded semantic tracing — Aggregate blocks/edges plus optional ordered block, memory-access, register-delta, and runtime-code events in one sequence space without per-instruction MCP traffic
- Kernel and hardware instruction tracing (MCP) — Selected-CPU KD tracing and capability-negotiated CR/MSR/scalar I/O events, with portable files, exact values and offline read/analysis
- File-backed trace results — Process basic-block traces save JSON/JSONL results to generated host files by default and return compact path/hash/count/drop/truncation receipts. Explicit
output_mode="inline" returns full JSON up to 64KiB; larger replies return a file receipt. Separately stream ordered events to .vte or up to 400 MiB of runtime code to .vtc on supported local backends
- Occurrence-scoped capture — Collect selected dispatcher/instruction visits and combine them explicitly with start, stop, and collection conditions
- Repeatable analysis sessions — Capture bounded thread checkpoints including TEB and FS/GS metadata, run input matrices through
veh_batch, or write occurrence-centered code/register/memory/environment artifacts with veh_targeted_capture
Quick Start
Launch a program
Add to .vscode/launch.json:
{
"type": "veh",
"request": "launch",
"name": "VEH Debug",
"program": "${workspaceFolder}/target.exe",
"stopOnEntry": true
}
Attach to running process
{
"type": "veh",
"request": "attach",
"name": "VEH Attach",
"processId": 1234
}
Configuration
| Property |
Type |
Description |
program |
string |
Path to executable (launch only) |
processId |
number |
PID to attach to (attach only) |
args |
string[] |
Command line arguments |
stopOnEntry |
boolean |
Break at entry point |
injectionMethod |
string |
auto / createRemoteThread / ntCreateThreadEx / threadHijack / queueUserApc |
runAsInvoker |
boolean |
Bypass UAC elevation prompt (__COMPAT_LAYER=RunAsInvoker) |
adapterPath |
string |
Custom path to veh-debug-adapter.exe |
adapterPort |
number |
TCP port (0 = stdio mode) |
logFile |
string |
Log file path |
logLevel |
string |
debug / info / warn / error |
Hardware Breakpoints
Watch memory addresses for read/write access using CPU debug registers (DR0-DR3):
- Up to 4 simultaneous hardware breakpoints
- Watch sizes: 1, 2, 4, or 8 bytes
- Types: write, read/write, execute
This is equivalent to Cheat Engine's "Find out what writes to this address" / "Find out what accesses this address".
The bundled veh-mcp-server.exe exposes debugging operations through the Model Context Protocol, allowing AI agents to directly control the debugger. Its default token-bounded lite profile exposes a small common set plus the veh_toolbox lazy gateway; use --profile=interactive or --profile=capture for small workflow inventories, --profile=analysis for 41 advanced analysis tools, --profile=vmguest for those tools plus guest process discovery and whole-VM control (43), or --profile=full for the complete inventory. Profiles select exposure only; actual operations still require backend support. Known hidden tool names remain directly callable. The running server's MCP tools/list response is the authoritative eager inventory.
MCP can also attach through an external backend with backend or agent.
For VM guest PIDs, register target_scope: "guest" in veh-backends.json
(or pass it to veh_attach); backend PID/address-width validation is required.
Guest MCP veh_launch/stopOnEntry requires a registered local backend with target_scope=guest and guest_launch=true; DAP remains attach-only. Other commands depend on
the attach response's backend.unsupported. This is MCP support, not a guest
extension to the VSCode DAP launch configuration. Use veh_toolbox with
operation="describe" for the live attach/launch schema. See the repository's
English README for registration and prerequisites.
Launch/attach defaults to local backend="veh" when both backend and agent
are omitted. Select an explicit registered backend name for remote TCP connections.
The resident veh-remote-runner.exe runs on the analysis VM; for VirtualBox/WHPX
it belongs on the analysis host VM, outside the inner guest. Authentication runs
once per connection, using a private token file and pinned server certificate.
Successful reconnects do not consume the failed-authentication limit. Remote guest launch,
remote frontend conditional breakpoints and target-side trace file pipes remain
unsupported. The adapter's DAP TCP listener is a separate interface. Configuration
and limits are documented in docs/REMOTE_TRANSPORT.md in the repository.
veh_trace_callers(mode="detailed", operation="status") checks caller-capture support for the attached target architecture. A supporting backend can capture hit-time integer registers and raw stack prefixes with register filters and hit/time/storage limits. Use start, then the returned exact string trace_id for stop, read or JSON/JSONL export. Read defaults to a summary (max=0); set a positive max and pass the exact returned nextCursor as cursor to page records. Large pages can return file receipts; optional output_file={path,format} chooses a new host file. The caller owns saved files. Detailed mode never resumes/pauses the target and does not guarantee full unwinding or typed arguments. The built-in VEH DLL does not provide this optional mode. See the caller capture guide.
veh_trace_memory preserves first-write detection when duration_ms is omitted.
Add duration_ms (10-60000 ms) to collect location counts with access="write"
(default) or combined "readwrite"; read-only and individual read/write
classification are unsupported. max_entries defaults to 64 (maximum 1024), with
dropped_hits for unretained locations. On VEH, instructionAddress is the
post-access IP (addressIs="next_instruction"), and first-hit registers are also
post-access. External backends must implement the collection command; capability
flags do not report numeric breakpoint capacities. Backends may return LimitReached
when full; breakpoint tools then report no free slot so an existing breakpoint can be removed.
veh_value_scan reuses the existing MCP tool for async first/next, disk-backed
candidates and undo of both addresses and comparison values. Large sets return counts;
up to 32 candidates are listed automatically. Completion/progress uses
notifications/veh/value_scan, with no status polling. Clients must consume that
notification; use explicit status/results or bounded async:false when needed.
Reset/detach release owned temporary files; baseline/undo files survive a single scan.
External backends require v2 capability support. See docs/VALUE_SCAN.md in the
repository for storage budgets, batch/action sequencing and adoption checks.
Hardware instruction events are available through collect_hardware_events=true on a capable backend. Select MOV CR, RDMSR/WRMSR and scalar IN/OUT with hardware_kinds=["control_register","msr","io_port"]; omission requests all three. The built-in VEH DLL does not advertise this collection. Process capture uses the existing attach path and independent IPC capability; KD capture requires veh_kd_connect, a halted target and execution_context="kd". A process backend can also expose kernel-range capture through its existing attach path.
{"execution_context":"kd","start":"0xFFFF800000001000","end":"0xFFFF800000002000","max_steps":10000,"collect_hardware_events":true,"hardware_kinds":["control_register"],"follow_exceptions":false}
Hardware capture returns file receipts with schema3 events in event_file; KD also preserves instructions in capture_file. Read saved events with operation="read_events" or "analyze_events" plus event_file, and saved KD instructions with operation="read_capture" plus capture_file, including after disconnect. Unknown values remain null; exact 64-bit values/counts remain strings. storage_complete and capture_complete distinguish durable files from a complete capture: reaching max_steps can leave a valid stored prefix. KD execution is direct-only; immutable reads and analysis support batch/actions. For process hardware capture, set follow_exceptions=false, keep snapshots enabled and path compression disabled. KD supports snapshot-free records and independently negotiated peer execution. See hardware tracing and KD hardware transport.
Ordinary KD veh_trace_basic_blocks(execution_context="kd", run_peer_cpus=true) can
explicitly enable peer execution after separate v2 policy negotiation. It defaults
off, still collects only the selected CPU and ends incomplete on uncertain code or
completion. Saved facts remain available without guessing instructions or paths;
see docs/KD_TRACE_PROTOCOL.md for the contract and backend qualification limits.
veh_trace_basic_blocks supports x86/x64 ordered memory and register provenance,
self-modifying code versions, dispatcher occurrence windows, and file-backed
JSON/JSONL, .vtc code or .vte ordered-event artifacts. Direct calls, veh_batch, and breakpoint actions
share the same trace semantics. Process results default to output_mode="file":
output_file optionally selects a new path, otherwise a unique file is generated
under the MCP host temporary veh-mcp-artifacts directory. output_format selects
JSON or JSONL for either path. Explicit output_mode="inline" returns full JSON
up to 64KiB; larger replies return a file receipt with path, size and hash.
Inline requests cannot be combined with output_file or output_format. Callers own file
retention and cleanup. This result policy does not change collection limits:
events_output="file" separately enables ordered-event streaming on supported
local backends; remote target-side file pipes remain unsupported.
File formats use portable integer layouts, while
the debugger and capture transport remain Windows-hosted.
Wire12 process backends lazily decode entered blocks. max_steps and
max_decoded_instructions independently default to 1,000,000 executions and cache
entries. Large execution limits also accept exact strings. Check
backend.basicTrace for support and resource_limits for applied values.
See options, memory limits and compatibility.
Set collect_snapshots=false to skip first block/edge and exception register/stack
capture. compress_paths=true, collect_code=true preserves observed path order,
branch choices and repeat counts in inline/file events, with explicit collection,
loss, exception and observed code-version barriers. It reduces records, not TF
exceptions. Compression excludes ordered memory/register events and target windows;
new policies require backend support and the VEH implementation refuses active
hardware-breakpoint conflicts before execution. These collection policies are
independent of result-file transport.
See the repository's docs/DEVELOPMENT_TOOLS.md for usage and backend adoption.
veh_targeted_capture repeats bounded setup for an input matrix, retains a
pre/post occurrence ring, embeds thread-environment evidence, and writes one
verified server-side JSON artifact per input.
# Auto-install to all supported agents
veh-mcp-server.exe --install
# Supported: claude-code, claude-desktop, cursor, windsurf, codex
Tip: Numeric arguments (threadId, pid, address, size, etc.) accept both numbers and strings, including hex format (e.g. "0x401000" or 4198400). Boolean arguments accept true/false or "true"/"false".
Architecture
VSCode AI Agent (Claude, etc.)
↕ DAP (stdio/TCP) ↕ MCP (stdio, JSON-RPC 2.0)
veh-debug-adapter.exe veh-mcp-server.exe
↕ Named Pipe IPC ↕ Named Pipe IPC
└────── veh-debugger.dll (injected into target) ──────┘
External guest debugging
DAP attach accepts targetScope="guest", processId, an absolute agent
executable and optional agentArgs. The adapter validates the IPC peer and
reported guest PID/address width. Backend capabilities gate memory/register
inspection and writes, continue/pause, instruction steps, execution/data
breakpoints, symbol-based source/function breakpoints and termination.
Unsupported commands return errors. Stops identify the selected thread;
guest DAP launch, stopOnEntry and stopOnModuleLoad remain unsupported.
Module-qualified pending guest functions (module!function) use advertised
loader-stop and stop-query support to bind while the DLL is held. The adapter
confirms the thread is still stopped and preserves known exception/breakpoint
reasons. With stop identity v1 it atomically releases only its own unchanged
internal guard after binding. Without that proof it exposes a pause for explicit
continuation. Other backends retain best-effort module notifications. Loader
patterns use the backend substring contract and may also stop similarly named
DLLs. This is separate from the explicit guest stopOnModuleLoad option. A loader-origin stop may retain the loader lock:
finish binding and explicitly continue before executing target code or creating
target threads. Such a stop is not a general-purpose safe call point.
DAP exception filtering currently supports only all. Empty, uncaught-only
and advanced filters return an error rather than claiming they were applied.
Whole-VM attachment and control (MCP)
veh_virtual_machine(operation="status"|"pause"|"resume"|"trace") provides
explicit VM-wide control when the backend advertises it. Trace executes one
selected vCPU while the VM remains paused, with CR3/CPL/RIP stop boundaries,
an instruction/time budget, interpreter identification and explicit lost records.
This scope is independent of the attached guest PID. It does not provide a
selective OS-thread stop. The tool is available through veh_toolbox discovery
and manual calls; batch/capture setup/breakpoint actions intentionally exclude
it because their process-scoped automation must not resume the entire VM.
VM attachment uses veh_attach(target_scope="vm", backend="machine"), with
an external backend registered for that scope, and no pid. The backend must
declare VM metadata with PID0/addressBits0. This session has no host process
target, OS thread identity or single process address width. VM agents receive
--pipe and configured arguments; process agents also receive --pid.
Use veh_virtual_machine for explicit whole-VM control and bounded vCPU records.
Physical memory read/write is available when advertised; search/dump needs a
server operation and is unavailable in VM scope. A capable backend exposes
veh_processes for one guest OS process snapshot; use a returned PID with
veh_attach(target_scope="guest"). Short image names escape non-ASCII bytes as
\\xNN. Guest process attachment still uses a validated nonzero guest PID.
Requirements
- Windows 10 or later (x64)
- Run VSCode as Administrator for DLL injection
Troubleshooting
DLL injection fails
- Run VSCode as Administrator
- Check if antivirus is blocking the injection
- Verify target process bitness matches (32/64-bit)
Breakpoints not hitting
- Ensure PDB file is next to the target EXE
- Without PDB, only address-based breakpoints work
- Hardware breakpoints: max 4 at a time
Pipe connection timeout
- Default timeout is 7 seconds
- Use
--log=debug.log --log-level=debug for diagnostics
License
MIT