gdb_get_variables
Retrieve local variables from a specific stack frame during Nintendo Switch debugging with gdb-multiarch.
Instructions
Get local variables for a stack frame.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| thread_id | No | Thread ID (None for current) | |
| frame | No | Frame number (0 is current) |
Implementation Reference
- The implementation of get_variables which interacts with GDB/MI via commands -thread-select, -stack-select-frame, and -stack-list-variables.
def get_variables(self, thread_id: Optional[int] = None, frame: int = 0) -> dict[str, Any]: """ Get local variables for a specific frame. Args: thread_id: Thread ID (None for current) frame: Frame number (0 is current frame) Returns: Dict with variable information """ # Switch thread if needed if thread_id is not None: thread_result = self.execute_command(f"-thread-select {thread_id}") if thread_result.get("status") == "error": return thread_result # Select frame frame_result = self.execute_command(f"-stack-select-frame {frame}") if frame_result.get("status") == "error": return frame_result # Get variables result = self.execute_command("-stack-list-variables --simple-values") if result["status"] == "error": return result mi_result = self._extract_mi_result(result) or {} variables = mi_result.get("variables", []) return {"status": "success", "thread_id": thread_id, "frame": frame, "variables": variables} - src/gdb_multiarch_mcp/server.py:324-328 (registration)Tool registration for gdb_get_variables in the MCP server.
Tool( name="gdb_get_variables", description="Get local variables for a stack frame.", inputSchema=GetVariablesArgs.model_json_schema(), ), - src/gdb_multiarch_mcp/server.py:516-518 (handler)The tool handler branch that calls session.get_variables.
elif name == "gdb_get_variables": a = GetVariablesArgs(**arguments) result = session.get_variables(thread_id=a.thread_id, frame=a.frame)