Skip to main content

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.dll and 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

StepToolPurpose
1debug_launchStart the app under debugger
2breakpoint_setSet a breakpoint at the suspected location
3debug_continue + breakpoint_waitRun until the breakpoint hits
4variables_getInspect local variables
5debug_stepStep through code line by line
6evaluateTest hypotheses with expressions
7debug_disconnectClean up

Tips

  • Use conditional breakpoints to avoid stopping on every call: "condition": "userId == null".
  • Use breakpoint_set with function when you know the method name but not the line number.
  • Inspect this to see the state of the current object: "scope": "this".
  • Expand children with variables_get + "expand": "this._repository" to drill into nested objects.
  • Use object_inspect for detailed information including field offsets, sizes, and memory addresses.