lldb_registers
View CPU register values at a breakpoint to debug C/C++ programs. Select register sets like general, float, or vector to inspect hexadecimal values during program execution.
Instructions
View CPU register values at a breakpoint.
Register sets:
- 'general': General purpose registers (rax, rbx, rsp, etc.)
- 'float': Floating point registers
- 'vector': SIMD/vector registers (xmm, ymm)
- 'all': All register sets
Args:
params: RegistersInput with breakpoint and register selection
Returns:
str: Register values in hexadecimal format
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Implementation Reference
- lldb_mcp_server.py:1010-1047 (handler)The handler function that implements the core logic of the 'lldb_registers' tool. It constructs LLDB commands to create a target, set a breakpoint, run the program, read the specified registers, and formats the output for display.async def lldb_registers(params: RegistersInput) -> str: """View CPU register values at a breakpoint. Register sets: - 'general': General purpose registers (rax, rbx, rsp, etc.) - 'float': Floating point registers - 'vector': SIMD/vector registers (xmm, ymm) - 'all': All register sets Args: params: RegistersInput with breakpoint and register selection Returns: str: Register values in hexadecimal format """ commands = [ f"target create {params.executable}", f"breakpoint set --name {params.breakpoint}", "run" + (" " + " ".join(params.args) if params.args else ""), ] if params.specific_registers: reg_cmd = f"register read {' '.join(params.specific_registers)}" elif params.register_set == "all": reg_cmd = "register read --all" elif params.register_set == "float": reg_cmd = "register read --set 1" # Usually FPU elif params.register_set == "vector": reg_cmd = "register read --set 2" # Usually SSE/AVX else: reg_cmd = "register read" commands.append(reg_cmd) commands.append("quit") result = _run_lldb_script(commands) return f"## Registers at `{params.breakpoint}`\n\n```\n{result['output'].strip()}\n```"
- lldb_mcp_server.py:345-362 (schema)Pydantic model defining the input schema/validation for the lldb_registers tool parameters.class RegistersInput(BaseModel): """Input for viewing registers.""" 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) register_set: str = Field( default="general", description="Register set to display: 'general', 'float', 'vector', 'all'", ) specific_registers: list[str] | None = Field( default=None, description="Specific register names to show (e.g., ['rax', 'rbx', 'rsp'])" ) args: list[str] | None = Field( default=None, description="Command-line arguments to pass to the program" )
- lldb_mcp_server.py:1000-1009 (registration)MCP tool registration decorator that binds the lldb_registers handler function to the tool name with metadata annotations.@mcp.tool( name="lldb_registers", annotations={ "title": "View Registers", "readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": False, }, )