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
| Name | Required | Description | Default |
|---|---|---|---|
| offset | Yes | Offset into main executable (hex, e.g. '0x3a5f10' or '3a5f10') |
Implementation Reference
- src/gdb_multiarch_mcp/server.py:536-538 (handler)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}") - src/gdb_multiarch_mcp/server.py:360-368 (registration)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(), ),