Skip to main content
Glama
sbergeron42

gdb-multiarch-mcp

by sbergeron42

switch_stub

Patch Nintendo Switch executables to make functions return immediately by writing ARM64 RET instructions at specified offsets from main, useful for debugging in gdb-multiarch.

Instructions

Stub the function at the given offset from main. Writes ARM64 RET (0xD65F03C0) at $main+offset, making the function return immediately.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
offsetYesOffset into main executable (hex, e.g. '0x3a5f10' or '3a5f10')

Implementation Reference

  • The handler logic for the switch_stub tool, which parses the arguments and calls the GDB session to execute the 'stub' command.
    elif name == "switch_stub":
        a = OffsetArgs(**arguments)
        result = session.execute_command(f"stub {a.offset}")
  • The tool registration block for switch_stub in the MCP server setup.
    Tool(
        name="switch_stub",
        description=(
            "Stub the function at the given offset from main. "
            "Writes ARM64 RET (0xD65F03C0) at $main+offset, making the function "
            "return immediately."
        ),
        inputSchema=OffsetArgs.model_json_schema(),
    ),

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