Skip to content

Debugger Integration

CodeBuddy can interact with any debugger through the Debug Adapter Protocol (DAP). When a debug session is active, the agent gains tools to inspect threads, walk stack frames, evaluate expressions, and control execution — all without leaving the chat.

Start a debug session normally (F5 or Run and Debug). CodeBuddy detects the active vscode.DebugSession automatically. Any debugger that implements DAP works: Node.js, Python, Go, Java, C++, Rust, etc.

The debugger tool exposes these actions:

ActionWhat it does
threadsLists all threads in the active debug session
stackTraceReturns up to 20 stack frames for a given thread
scopesLists scopes (local, global, closure) for a stack frame
variablesReads variables within a scope (by variablesReference)
evaluateEvaluates an expression in the REPL context of an optional frame
stepOverSteps over the current line (DAP next)
stepIntoSteps into the current function call
stepOutSteps out of the current function
continueResumes execution until the next breakpoint
pausePauses a running thread
You: "The function returns null instead of the expected array. Debug it."
Agent: [thinks] I'll inspect the active debug session to find the issue.
[debugger:threads] → Thread 1 (paused at breakpoint)
[debugger:stackTrace threadId=1] → Frame 0: processItems() at src/handler.ts:42
[debugger:scopes frameId=0] → Local scope (ref: 1001)
[debugger:variables ref=1001] → items = undefined, config = {...}
The issue is that `items` is undefined at line 42. The function
`fetchItems()` on line 38 likely returned undefined instead of an array.
[debugger:evaluate expression="typeof fetchItems" frameId=0] → "function"
[debugger:evaluate expression="fetchItems()" frameId=0] → undefined
The root cause is `fetchItems()` returns nothing when the cache is empty.
  • Requires an active debug session — the agent cannot start one
  • DAP custom requests depend on the debug adapter implementation; some adapters may not support all actions
  • The evaluate action runs in REPL context, which may have side effects
  • Stack trace depth defaults to 20 frames; pass levels parameter to increase