Skip to main content
Glama
sbergeron42

gdb-multiarch-mcp

by sbergeron42

gdb_set_breakpoint

Set breakpoints in Nintendo Switch executables for debugging on Yuzu or hardware via GDB. Specify function names, file locations, or memory addresses to pause execution during analysis.

Instructions

Set a breakpoint at a function, file:line, or *address. For offset-from-main breakpoints, use switch_break_at instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
locationYesBreakpoint location (function, file:line, or *address)
conditionNoConditional expression
temporaryNoWhether breakpoint is temporary

Implementation Reference

  • The `set_breakpoint` method in `GDBSession` class defines the implementation for setting GDB breakpoints using the `-break-insert` command.
    def set_breakpoint(
        self, location: str, condition: Optional[str] = None, temporary: bool = False
    ) -> dict[str, Any]:
        """
        Set a breakpoint at the specified location.
    
        Args:
            location: Location (function name, file:line, *address)
            condition: Optional condition expression
            temporary: Whether this is a temporary breakpoint
    
        Returns:
            Dict with breakpoint information
        """
        cmd_parts = ["-break-insert"]
    
        if temporary:
            cmd_parts.append("-t")
    
        if condition:
            # Escape backslashes and quotes in the condition
            escaped_condition = condition.replace("\\", "\\\\").replace('"', '\\"')
            cmd_parts.extend(["-c", f'"{escaped_condition}"'])
    
        cmd_parts.append(location)
    
        result = self.execute_command(" ".join(cmd_parts))
    
        if result["status"] == "error":
            return result
    
        # The MI result payload is in result["result"]["result"]
        # This contains the actual GDB/MI command result
        mi_result = self._extract_mi_result(result)
    
        # Debug logging
        logger.debug(f"Breakpoint MI result: {mi_result}")
    
        if mi_result is None:
            logger.warning(f"No MI result for breakpoint at {location}")
            return {
                "status": "error",
                "message": f"Failed to set breakpoint at {location}: no result from GDB",
                "raw_result": result,
            }
    
        # The breakpoint data should be in the "bkpt" field
        bp_info = mi_result if isinstance(mi_result, dict) else {}
        breakpoint = bp_info.get("bkpt", bp_info)  # Sometimes it's directly in the result
    
        if not breakpoint:
            logger.warning(f"Empty breakpoint result for {location}: {mi_result}")
            return {
                "status": "error",
                "message": f"Breakpoint set but no info returned for {location}",
                "raw_result": result,
            }
    
        return {"status": "success", "breakpoint": breakpoint}
  • The `call_tool` handler in `server.py` delegates the `gdb_set_breakpoint` tool call to `session.set_breakpoint`.
    elif name == "gdb_set_breakpoint":
        a = SetBreakpointArgs(**arguments)
        result = session.set_breakpoint(
            location=a.location, condition=a.condition, temporary=a.temporary
        )
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It clarifies location syntax but omits disclosure of state mutation (breakpoint persistence), error conditions, or side effects beyond the basic operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with zero waste: first establishes core functionality, second provides sibling differentiation. Information is front-loaded and every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Adequate for tool selection given 100% schema coverage and sibling clarification, but lacks disclosure of state-modifying nature and error handling expected for a debugging command with no output schema or annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, establishing baseline 3. Description reinforces location formats and adds domain context about offset-from-main exclusions, but does not elaborate on condition syntax or temporary breakpoint behavior beyond schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the specific action (Set a breakpoint) and supported location formats (function, file:line, or *address), distinguishing it from generic execution or inspection tools in the sibling set.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly names sibling tool 'switch_break_at' as the alternative for offset-from-main breakpoints, providing clear guidance on when to use the alternative instead. Lacks broader contextual guidance versus gdb_execute_command.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/sbergeron42/gdb-multiarch-mcp'

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