Skip to main content
Glama
sbergeron42

gdb-multiarch-mcp

by sbergeron42

gdb_get_backtrace

Retrieve stack backtraces for debugging Nintendo Switch executables using GDB to analyze program flow and identify issues during execution.

Instructions

Get the stack backtrace (standard GDB backtrace).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
thread_idNoThread ID (None for current thread)
max_framesNoMaximum number of frames to retrieve

Implementation Reference

  • The `get_backtrace` method in `GDBSession` class. This method switches to the specified thread (if any) and then retrieves the backtrace using the GDB/MI `-stack-list-frames` command.
    def get_backtrace(
        self, thread_id: Optional[int] = None, max_frames: int = DEFAULT_MAX_BACKTRACE_FRAMES
    ) -> dict[str, Any]:
        """
        Get the stack backtrace for a specific thread or the current thread.
    
        Args:
            thread_id: Thread ID to get backtrace for (None for current thread)
            max_frames: Maximum number of frames to retrieve
    
        Returns:
            Dict with backtrace information
        """
        # Switch to thread if specified
        if thread_id is not None:
            switch_result = self.execute_command(f"-thread-select {thread_id}")
            if switch_result["status"] == "error":
                return switch_result
    
        # Get stack trace
        result = self.execute_command(f"-stack-list-frames 0 {max_frames}")
    
        if result["status"] == "error":
            return result
    
        stack_data = self._extract_mi_result(result) or {}
        frames = stack_data.get("stack", [])
    
        return {"status": "success", "thread_id": thread_id, "frames": frames, "count": len(frames)}

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