lldb_threads
List and inspect all threads with their current state, execution points, and stop reasons to debug C/C++ programs using LLDB.
Instructions
List all threads and their current state.
Shows:
- Thread IDs and names
- Current execution point for each thread
- Stop reason (if stopped)
- Optionally: backtrace for each thread
Args:
params: ThreadsInput with executable and optional core file
Returns:
str: Thread listing with state information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Implementation Reference
- lldb_mcp_server.py:1163-1198 (handler)The main handler function for the lldb_threads tool. It constructs LLDB commands to load the target (with optional core file or breakpoint), lists threads, optionally shows backtraces, and formats the output.async def lldb_threads(params: ThreadsInput) -> str: """List all threads and their current state. Shows: - Thread IDs and names - Current execution point for each thread - Stop reason (if stopped) - Optionally: backtrace for each thread Args: params: ThreadsInput with executable and optional core file Returns: str: Thread listing with state information """ commands = [] if params.core_file: commands.append(f"target create {params.executable} --core {params.core_file}") else: commands.append(f"target create {params.executable}") if params.breakpoint: commands.append(f"breakpoint set --name {params.breakpoint}") commands.append("run") commands.append("thread list") if params.show_backtrace: commands.append("thread backtrace all") if not params.core_file: commands.append("quit") result = _run_lldb_script(commands) return f"## Threads\n\n```\n{result['output'].strip()}\n```"
- lldb_mcp_server.py:417-426 (schema)Pydantic input model (schema) defining parameters for the lldb_threads tool: executable path, optional breakpoint, core file, and flag for backtraces.class ThreadsInput(BaseModel): """Input for examining threads.""" model_config = ConfigDict(str_strip_whitespace=True) executable: str = Field(..., description="Path to the executable", min_length=1) breakpoint: str | None = Field(default=None, description="Breakpoint location to stop at") core_file: str | None = Field(default=None, description="Path to core dump file") show_backtrace: bool = Field(default=False, description="Show backtrace for each thread")
- lldb_mcp_server.py:1153-1162 (registration)MCP decorator registering the lldb_threads tool with name, description annotations, and hints.@mcp.tool( name="lldb_threads", annotations={ "title": "Examine Threads", "readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": False, }, )