gdb_get_frame_info
Obtain details of the current stack frame: function name, file location, line number, and address. Use with a session ID from gdb_start_session. Optionally select another frame with gdb_select_frame first.
Instructions
Get information about the current stack frame. Returns details about the currently selected frame including function name, file location, line number, and address. Use gdb_select_frame to change the current frame first if needed. Requires session_id parameter (obtained from gdb_start_session).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes | Session ID from gdb_start_session |
Implementation Reference
- src/gdb_mcp/gdb_interface.py:900-915 (handler)Handler function: sends '-stack-info-frame' GDB/MI command, extracts the frame data from the response, and returns it as structured output.
def get_frame_info(self) -> dict[str, Any]: """ Get information about the current stack frame. Returns: Dict with current frame information """ result = self.execute_command("-stack-info-frame") if result["status"] == "error": return result mi_result = self._extract_mi_result(result) or {} frame = mi_result.get("frame", {}) return {"status": "success", "frame": frame} - src/gdb_mcp/server.py:289-299 (registration)Tool registration: defines the tool's name, description, and input schema (SessionIdArgs).
Tool( name="gdb_get_frame_info", description=( "Get information about the current stack frame. " "Returns details about the currently selected frame including function name, " "file location, line number, and address. " "Use gdb_select_frame to change the current frame first if needed. " "Requires session_id parameter (obtained from gdb_start_session)." ), inputSchema=SessionIdArgs.model_json_schema(), ), - src/gdb_mcp/server.py:512-513 (handler)Dispatcher: routes the 'gdb_get_frame_info' tool name to session.get_frame_info() method call.
elif name == "gdb_get_frame_info": result = session.get_frame_info() - src/gdb_mcp/server.py:181-184 (schema)Schema: SessionIdArgs defines the input schema (just session_id) used by gdb_get_frame_info.
class SessionIdArgs(BaseModel): """Arguments for tools that only need session_id.""" session_id: int = Field(..., description="Session ID from gdb_start_session")