Skip to main content
Glama

lldb_watchpoint

Set watchpoints to debug C/C++ programs by breaking execution when specific variables are accessed, modified, or read during runtime.

Instructions

Set a watchpoint to break when a variable is accessed.

Watch types: - 'write': Break when value is written (modified) - 'read': Break when value is read - 'read_write': Break on any access Args: params: WatchpointInput with variable and access type Returns: str: Confirmation of watchpoint creation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Implementation Reference

  • The asynchronous handler function for the lldb_watchpoint tool. It sets up LLDB commands to create a watchpoint on the specified variable or address with the given watch type (read, write, read_write) and optional condition, executes them, lists the watchpoints, and returns formatted output.
    async def lldb_watchpoint(params: WatchpointInput) -> str: """Set a watchpoint to break when a variable is accessed. Watch types: - 'write': Break when value is written (modified) - 'read': Break when value is read - 'read_write': Break on any access Args: params: WatchpointInput with variable and access type Returns: str: Confirmation of watchpoint creation """ commands = [f"target create {params.executable}"] wp_cmd = f"watchpoint set variable {params.variable}" if params.watch_type == "read": wp_cmd += " --watch read" elif params.watch_type == "read_write": wp_cmd += " --watch read_write" # Default is write commands.append(wp_cmd) if params.condition: commands.append(f"watchpoint modify --condition '{params.condition}'") commands.append("watchpoint list") result = _run_lldb_script(commands) return f"## Watchpoint on `{params.variable}`\n\n```\n{result['output'].strip()}\n```"
  • Pydantic BaseModel defining the input parameters for the lldb_watchpoint tool: executable path, variable/address to watch, watch type, and optional condition.
    class WatchpointInput(BaseModel): """Input for setting watchpoints.""" model_config = ConfigDict(str_strip_whitespace=True) executable: str = Field(..., description="Path to the executable", min_length=1) variable: str = Field(..., description="Variable name or memory address to watch", min_length=1) watch_type: str = Field( default="write", description="Type of access to watch: 'write', 'read', 'read_write'" ) condition: str | None = Field( default=None, description="Conditional expression for the watchpoint" )
  • The @mcp.tool decorator registration for the lldb_watchpoint tool, specifying its name and operational annotations.
    @mcp.tool( name="lldb_watchpoint", annotations={ "title": "Set Watchpoint", "readOnlyHint": False, "destructiveHint": False, "idempotentHint": False, "openWorldHint": False, }, )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/benpm/claude_lldb_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server