lldb_symbols
Look up symbols like functions, variables, and types in executables using exact names, regex patterns, addresses, or type definitions to debug C/C++ programs.
Instructions
Look up symbols (functions, variables, types) in an executable.
Search types:
- 'name': Exact symbol name lookup
- 'regex': Regular expression pattern matching
- 'address': Find symbol at a specific address
- 'type': Look up a type definition
Args:
params: SymbolLookupInput with query and search type
Returns:
str: Symbol information including address and source location
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Implementation Reference
- lldb_mcp_server.py:967-997 (handler)The main handler function for the lldb_symbols tool, which performs symbol lookup using LLDB's image lookup command based on the input parameters.async def lldb_symbols(params: SymbolLookupInput) -> str: """Look up symbols (functions, variables, types) in an executable. Search types: - 'name': Exact symbol name lookup - 'regex': Regular expression pattern matching - 'address': Find symbol at a specific address - 'type': Look up a type definition Args: params: SymbolLookupInput with query and search type Returns: str: Symbol information including address and source location """ commands = [f"target create {params.executable}"] if params.query_type == "name": commands.append(f"image lookup --name {params.query}") elif params.query_type == "regex": commands.append(f"image lookup --regex --name {params.query}") elif params.query_type == "address": commands.append(f"image lookup --address {params.query}") elif params.query_type == "type": commands.append(f"image lookup --type {params.query}") else: commands.append(f"image lookup --name {params.query}") result = _run_lldb_script(commands) return f"## Symbol Lookup: `{params.query}`\n\n```\n{result['output'].strip()}\n```"
- lldb_mcp_server.py:332-343 (schema)Pydantic model defining the input schema for the lldb_symbols tool, including executable path, query string, and query type.class SymbolLookupInput(BaseModel): """Input for looking up symbols.""" model_config = ConfigDict(str_strip_whitespace=True) executable: str = Field(..., description="Path to the executable", min_length=1) query: str = Field(..., description="Symbol name or pattern to search for", min_length=1) query_type: str = Field( default="name", description="Type of lookup: 'name' (exact), 'regex' (pattern), 'address' (hex address), 'type' (type name)", )
- lldb_mcp_server.py:957-966 (registration)The @mcp.tool decorator that registers the lldb_symbols function as an MCP tool with the name 'lldb_symbols' and appropriate annotations.@mcp.tool( name="lldb_symbols", annotations={ "title": "Lookup Symbols", "readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": False, }, )