gdb_get_threads
Retrieve thread information for debugging Nintendo Switch executables in gdb-multiarch to analyze program execution and identify issues.
Instructions
Get information about all threads.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The `GDBSession.get_threads` method implementation, which executes the GDB/MI `-thread-info` command and processes the result.
def get_threads(self) -> dict[str, Any]: """ Get information about all threads in the debugged process. Returns: Dict with thread information """ logger.debug("get_threads() called") result = self.execute_command("-thread-info") logger.debug(f"get_threads: execute_command returned: {result}") if result["status"] == "error": logger.debug(f"get_threads: returning error from execute_command") return result # Extract thread data from result # Use helper method but keep robust error handling for None cases thread_info = self._extract_mi_result(result) logger.debug(f"get_threads: thread_info type={type(thread_info)}, value={thread_info}") if thread_info is None: logger.warning("get_threads: thread_info is None - GDB returned incomplete data") return { "status": "error", "message": "GDB returned incomplete data - may still be loading symbols", } # Ensure thread_info is a dict (helper returns None if extraction fails) if not isinstance(thread_info, dict): thread_info = {} threads = thread_info.get("threads", []) current_thread = thread_info.get("current-thread-id") logger.debug( f"get_threads: found {len(threads)} threads, current_thread_id={current_thread}" ) logger.debug(f"get_threads: threads data: {threads}") return { "status": "success", "threads": threads, "current_thread_id": current_thread, "count": len(threads), } - src/gdb_multiarch_mcp/server.py:461-462 (handler)The `call_tool` handler in `server.py` dispatches the `gdb_get_threads` tool call to `session.get_threads()`.
elif name == "gdb_get_threads": result = session.get_threads() - src/gdb_multiarch_mcp/server.py:246-250 (registration)The `gdb_get_threads` tool registration in the `list_tools` function.
Tool( name="gdb_get_threads", description="Get information about all threads.", inputSchema=NO_ARGS_SCHEMA, ),