Skip to main content
Glama
sbergeron42

gdb-multiarch-mcp

by sbergeron42

gdb_interrupt

Pause a running Nintendo Switch program during debugging with gdb-multiarch to inspect execution state and analyze code behavior.

Instructions

Interrupt (pause) a running program.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The `interrupt` method in `GDBSession` implements the logic for sending a SIGINT signal to the GDB process to pause the target program.
    def interrupt(self) -> dict[str, Any]:
        """
        Interrupt (pause) a running program.
    
        This sends SIGINT to the GDB process, which pauses the debugged program.
        Use this when the program is running and you want to pause it to inspect
        state, set breakpoints, or perform other debugging operations.
    
        Returns:
            Dict with status and message
        """
        if not self.controller:
            return {"status": "error", "message": "No active GDB session"}
    
        if not self.controller.gdb_process:
            return {"status": "error", "message": "No GDB process running"}
    
        try:
            # Send SIGINT to pause the running program
            os.kill(self.controller.gdb_process.pid, signal.SIGINT)
    
            # Poll for *stopped notification with timeout
            # This avoids arbitrary sleep and responds as soon as GDB confirms the stop
            start_time = time.time()
            all_responses: list[dict[str, Any]] = []
            stopped_received = False
    
            while time.time() - start_time < INTERRUPT_RESPONSE_TIMEOUT_SEC:
                responses = self.controller.get_gdb_response(
                    timeout_sec=POLL_TIMEOUT_SEC, raise_error_on_timeout=False
                )
    
                if responses:
                    all_responses.extend(responses)
                    # Check for *stopped notification
                    for resp in responses:
                        if resp.get("type") == "notify" and resp.get("message") == "stopped":
                            stopped_received = True
                            break
    
                if stopped_received:
                    break
    
            result = self._parse_responses(all_responses)
    
            if not stopped_received:
                return {
                    "status": "warning",
                    "message": "Interrupt sent but no stopped notification received",
                    "result": result,
                }
    
            return {
                "status": "success",
                "message": "Program interrupted (paused)",
                "result": result,
            }
        except Exception as e:
            logger.error(f"Failed to interrupt program: {e}")
            return {"status": "error", "message": f"Failed to interrupt: {str(e)}"}
  • The `gdb_interrupt` tool is registered in the list of available tools in `server.py`.
    Tool(
        name="gdb_interrupt",
        description="Interrupt (pause) a running program.",
        inputSchema=NO_ARGS_SCHEMA,
    ),
  • The tool handler in `server.py` dispatches the `gdb_interrupt` request to the `session.interrupt()` method.
    elif name == "gdb_interrupt":
        result = session.interrupt()

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