lldb_disassemble
View assembly instructions by disassembling machine code from functions, address ranges, or the current frame in C/C++ debugging sessions.
Instructions
Disassemble machine code to view assembly instructions.
Can disassemble:
- A named function: 'main', 'MyClass::method'
- An address range: '0x1000-0x1100' or '0x1000 0x1100'
- Current frame (when stopped at breakpoint)
Options:
- show_bytes: Include raw opcode bytes
- mixed: Interleave source code with assembly
Args:
params: DisassembleInput with target and display options
Returns:
str: Assembly listing
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Implementation Reference
- lldb_mcp_server.py:721-766 (handler)The handler function that executes the disassembly logic. It builds LLDB 'disassemble' commands based on the target (function, address range, etc.), adds options like --bytes or --mixed, runs the script via _run_lldb_script, and returns markdown-formatted assembly output.async def lldb_disassemble(params: DisassembleInput) -> str: """Disassemble machine code to view assembly instructions. Can disassemble: - A named function: 'main', 'MyClass::method' - An address range: '0x1000-0x1100' or '0x1000 0x1100' - Current frame (when stopped at breakpoint) Options: - show_bytes: Include raw opcode bytes - mixed: Interleave source code with assembly Args: params: DisassembleInput with target and display options Returns: str: Assembly listing """ commands = [f"target create {params.executable}"] dis_cmd = "disassemble" if "-" in params.target and params.target.startswith("0x"): # Address range parts = params.target.split("-") dis_cmd += f" --start-address {parts[0]} --end-address {parts[1]}" elif params.target.startswith("0x"): # Single address dis_cmd += f" --start-address {params.target} --count 50" elif params.target.lower() == "current": dis_cmd += " --frame" else: # Function name dis_cmd += f" --name {params.target}" if params.show_bytes: dis_cmd += " --bytes" if params.mixed: dis_cmd += " --mixed" commands.append(dis_cmd) result = _run_lldb_script(commands) return f"## Disassembly: `{params.target}`\n\n```asm\n{result['output'].strip()}\n```"
- lldb_mcp_server.py:243-256 (schema)Pydantic input model (schema) validating parameters for the lldb_disassemble tool: executable path, disassembly target, and display options.class DisassembleInput(BaseModel): """Input for disassembling code.""" model_config = ConfigDict(str_strip_whitespace=True) executable: str = Field(..., description="Path to the executable", min_length=1) target: str = Field( ..., description="What to disassemble: function name, address range (e.g., '0x1000-0x1100'), or 'current' for current frame", min_length=1, ) show_bytes: bool = Field(default=False, description="Show opcode bytes alongside instructions") mixed: bool = Field(default=False, description="Show mixed source and assembly")
- lldb_mcp_server.py:711-720 (registration)FastMCP decorator registering the lldb_disassemble handler as a tool with the specified name and semantic annotations.@mcp.tool( name="lldb_disassemble", annotations={ "title": "Disassemble Code", "readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": False, }, )