Skip to main content
Glama

gdb_list_sessions

List all active debugging sessions in GDB to manage and monitor running processes during program analysis.

Instructions

List all active GDB sessions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • server.py:96-102 (registration)
    MCP tool registration: The gdb_list_sessions function is decorated with @mcp.tool() and serves as the entry point. It calls _get_gdb_tools().list_sessions() to get the list of active sessions.
    @mcp.tool()
    def gdb_list_sessions() -> str:
        """List all active GDB sessions."""
        try:
            return _get_gdb_tools().list_sessions()
        except Exception as e:
            return f"Error: {str(e)}"
  • Handler implementation: The list_sessions() method in GDBTools class retrieves the session list from the session manager and formats it for display. Returns 'No active GDB sessions' if empty, otherwise lists all active session IDs.
    def list_sessions(self) -> str:
        sessions = self.sessionManager.list_sessions()
        if not sessions:
            return "No active GDB sessions"
        return "Active GDB sessions:\n" + "\n".join(f"- {sid}" for sid in sessions)
  • Session manager helper: The list_sessions() method in GDBSessionManager cleans up dead sessions first, then returns the list of active session IDs stored in the sessions dictionary.
    def list_sessions(self) -> list:
        self._cleanup_dead_sessions()
        return list(self.sessions.keys())
  • Interface definition: The abstract base class DebuggerTools defines the contract for list_sessions() method that returns a string representation of active debugging sessions.
    @abstractmethod
    def list_sessions(self) -> str:
        """List all active debugging sessions."""
        pass

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/smadi0x86/GDB-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server