Workflow: Debug with Breakpoints
This guide walks through the most common debugging workflow: setting a breakpoint, waiting for it to hit, inspecting variables, stepping through code, and evaluating expressions.
Scenario
You have a .NET application with a bug in a specific method. You know roughly where the problem is — you want to stop execution there, look at the state, and step through the code to find the issue.
Steps
1. Launch the application
"Launch
/app/MyApp.dlland stop at the entry point"
The process starts and pauses at Main(), giving you a chance to set breakpoints before any code runs.
Tool call details
Request (debug_launch):
{
"program": "/app/MyApp.dll",
"stop_at_entry": true
}
2. Set a breakpoint
"Set a breakpoint at line 42 in UserService.cs"
The breakpoint is bound to the source location. When execution reaches this line, the process will pause.
Tool call details
Request (breakpoint_set):
{
"file": "Services/UserService.cs",
"line": 42
}
3. Continue and wait
"Continue execution and wait for the breakpoint"
The application runs until line 42 is hit.
Tool call details
Request (debug_continue):
{}
Then:
Request (breakpoint_wait):
{
"timeout_ms": 30000
}
4. Inspect variables
"Show me the local variables"
See what values the variables have at the breakpoint.
Tool call details
Request (variables_get):
{
"scope": "all"
}
Response:
{
"variables": [
{ "name": "userId", "type": "string", "value": "\"abc123\"" },
{ "name": "user", "type": "User", "value": "null" }
]
}
5. Step through code
"Step over to the next line"
Move through the code line by line to observe how state changes.
Tool call details
Request (debug_step):
{
"action": "over"
}
Use "action": "into" to enter a method call, or "action": "out" to finish the current method and return to the caller.
6. Evaluate expressions
"What is the value of
items.Where(i => i.IsActive).Count()?"
Test hypotheses about the bug by evaluating arbitrary C# expressions.
Tool call details
Request (evaluate):
{
"expression": "items.Where(i => i.IsActive).Count()"
}
7. Disconnect
"Stop debugging"
Tool call details
Request (debug_disconnect):
{
"terminate": true
}
Summary
| Step | Tool | Purpose |
|---|---|---|
| 1 | debug_launch | Start the app under debugger |
| 2 | breakpoint_set | Set a breakpoint at the suspected location |
| 3 | debug_continue + breakpoint_wait | Run until the breakpoint hits |
| 4 | variables_get | Inspect local variables |
| 5 | debug_step | Step through code line by line |
| 6 | evaluate | Test hypotheses with expressions |
| 7 | debug_disconnect | Clean up |
Tips
- Use conditional breakpoints to avoid stopping on every call:
"condition": "userId == null". - Use
breakpoint_setwithfunctionwhen you know the method name but not the line number. - Inspect
thisto see the state of the current object:"scope": "this". - Expand children with
variables_get+"expand": "this._repository"to drill into nested objects. - Use
object_inspectfor detailed information including field offsets, sizes, and memory addresses.