lldb_set_breakpoint
Set breakpoints in C/C++ programs to pause execution at specific functions, lines, or addresses for debugging purposes.
Instructions
Set a breakpoint in a program.
Breakpoints can be set by:
- Function name: 'main', 'MyClass::method'
- File and line: 'main.cpp:42'
- Address: '0x400500'
- Regex: Use 'breakpoint set -r pattern'
Args:
params: SetBreakpointInput with location and optional condition
Returns:
str: Confirmation of breakpoint creation with details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Implementation Reference
- lldb_mcp_server.py:606-649 (handler)Handler function that sets a breakpoint by constructing appropriate LLDB breakpoint set commands based on the location format (function name, file:line, or address), optionally adding a condition, executes them using _run_lldb_script on the target executable, lists breakpoints, and returns formatted success or error output.async def lldb_set_breakpoint(params: SetBreakpointInput) -> str: """Set a breakpoint in a program. Breakpoints can be set by: - Function name: 'main', 'MyClass::method' - File and line: 'main.cpp:42' - Address: '0x400500' - Regex: Use 'breakpoint set -r pattern' Args: params: SetBreakpointInput with location and optional condition Returns: str: Confirmation of breakpoint creation with details """ commands = [f"target create {params.executable}"] # Determine breakpoint type from location format if ":" in params.location and not params.location.startswith("0x"): # File:line format parts = params.location.rsplit(":", 1) bp_cmd = f"breakpoint set --file {parts[0]} --line {parts[1]}" elif params.location.startswith("0x"): # Address bp_cmd = f"breakpoint set --address {params.location}" else: # Function name bp_cmd = f"breakpoint set --name {params.location}" if params.condition: bp_cmd += f" --condition '{params.condition}'" commands.append(bp_cmd) commands.append("breakpoint list") result = _run_lldb_script(commands, working_dir=params.working_dir) if result["success"]: return f"**Breakpoint set successfully**\n\n```\n{result['output']}\n```" else: return ( f"**Error setting breakpoint:** {result.get('error')}\n\n```\n{result['output']}\n```" )
- lldb_mcp_server.py:208-223 (schema)Pydantic input schema (BaseModel) defining the parameters for the lldb_set_breakpoint tool: required executable path and location (function/file:line/address), optional condition and working directory.class SetBreakpointInput(BaseModel): """Input for setting breakpoints.""" model_config = ConfigDict(str_strip_whitespace=True) executable: str = Field(..., description="Path to the executable", min_length=1) location: str = Field( ..., description="Breakpoint location: function name (e.g., 'main'), file:line (e.g., 'main.cpp:42'), or address (e.g., '0x1234')", min_length=1, ) condition: str | None = Field( default=None, description="Conditional expression for the breakpoint (e.g., 'i > 10')" ) working_dir: str | None = Field(default=None, description="Working directory for the session")
- lldb_mcp_server.py:596-605 (registration)FastMCP tool decorator registering the lldb_set_breakpoint handler with name, title, and hints indicating it's non-readonly, non-idempotent.@mcp.tool( name="lldb_set_breakpoint", annotations={ "title": "Set Breakpoint", "readOnlyHint": False, "destructiveHint": False, "idempotentHint": False, "openWorldHint": False, }, )