lldb_examine_variables
Inspect local variables and function arguments at a breakpoint in C/C++ programs. Use this debugging tool to analyze program state during execution by specifying an executable and breakpoint location.
Instructions
Examine local variables and arguments at a breakpoint.
Runs the program until the specified breakpoint, then displays
the values of local variables and function arguments.
Args:
params: ExamineVariablesInput with executable, breakpoint, and optional variable names
Returns:
str: Variable values at the breakpoint
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Implementation Reference
- lldb_mcp_server.py:661-708 (handler)Handler function that executes the lldb_examine_variables tool: sets breakpoint, runs program, examines frame variables using LLDB batch commands, formats output as markdown or JSON.async def lldb_examine_variables(params: ExamineVariablesInput) -> str: """Examine local variables and arguments at a breakpoint. Runs the program until the specified breakpoint, then displays the values of local variables and function arguments. Args: params: ExamineVariablesInput with executable, breakpoint, and optional variable names Returns: str: Variable values at the breakpoint """ commands = [ f"target create {params.executable}", f"breakpoint set --name {params.breakpoint}", "run" + (" " + " ".join(params.args) if params.args else ""), ] if params.variables: for var in params.variables: commands.append(f"frame variable {var}") else: commands.append("frame variable") commands.append("quit") result = _run_lldb_script(commands) if params.response_format == ResponseFormat.JSON: return json.dumps( { "success": result["success"], "breakpoint": params.breakpoint, "output": result["output"], "error": result.get("error"), }, indent=2, ) lines = [ f"## Variables at `{params.breakpoint}`", "", "```", result["output"].strip() if result["success"] else result.get("error", "Unknown error"), "```", ] return "\n".join(lines)
- lldb_mcp_server.py:225-241 (schema)Pydantic input schema defining parameters for the lldb_examine_variables tool: executable path, breakpoint location, optional variables list, program args, and output format.class ExamineVariablesInput(BaseModel): """Input for examining variables.""" model_config = ConfigDict(str_strip_whitespace=True) executable: str = Field(..., description="Path to the executable", min_length=1) breakpoint: str = Field(..., description="Breakpoint location to stop at", min_length=1) variables: list[str] | None = Field( default=None, description="Specific variable names to examine (if None, shows all locals)" ) args: list[str] | None = Field( default=None, description="Command-line arguments to pass to the program" ) response_format: ResponseFormat = Field( default=ResponseFormat.MARKDOWN, description="Output format" )
- lldb_mcp_server.py:651-660 (registration)MCP tool decorator registering the lldb_examine_variables handler function with name, title, and operational hints (read-only, idempotent).@mcp.tool( name="lldb_examine_variables", annotations={ "title": "Examine Variables", "readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": False, }, )