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
| Name | Required | Description | Default |
|---|---|---|---|
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)}" - modules/gdb/gdbTools.py:79-83 (handler)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) - modules/gdb/sessionManager.py:52-54 (helper)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()) - modules/base/debuggerBase.py:52-55 (schema)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