gdb_step
Step through program execution in a GDB debugging session by specifying instructions or source lines, enabling precise control over debugging processes.
Instructions
Step program execution
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instructions | No | Step by instructions instead of source lines (optional) | |
| sessionId | Yes | GDB session ID |
Implementation Reference
- src/index.ts:848-890 (handler)The main execution logic for the gdb_step tool. Extracts sessionId and optional instructions flag from arguments, validates session exists, executes 'step' or 'stepi' GDB command via executeGdbCommand helper, and returns the output or error.private async handleGdbStep(args: any) { const { sessionId, instructions = false } = args; if (!activeSessions.has(sessionId)) { return { content: [ { type: 'text', text: `No active GDB session with ID: ${sessionId}` } ], isError: true }; } const session = activeSessions.get(sessionId)!; try { // Use stepi for instruction-level stepping, otherwise step const command = instructions ? "stepi" : "step"; const output = await this.executeGdbCommand(session, command); return { content: [ { type: 'text', text: `Stepped ${instructions ? 'instruction' : 'line'}\n\nOutput:\n${output}` } ] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [ { type: 'text', text: `Failed to step: ${errorMessage}` } ], isError: true }; } }
- src/index.ts:222-234 (schema)Input schema validation for gdb_step tool parameters: requires sessionId (string), optional instructions (boolean).inputSchema: { type: 'object', properties: { sessionId: { type: 'string', description: 'GDB session ID' }, instructions: { type: 'boolean', description: 'Step by instructions instead of source lines (optional)' } }, required: ['sessionId']
- src/index.ts:219-235 (registration)Registration of gdb_step tool in the ListToolsRequestSchema response, including name, description, and input schema.{ name: 'gdb_step', description: 'Step program execution', inputSchema: { type: 'object', properties: { sessionId: { type: 'string', description: 'GDB session ID' }, instructions: { type: 'boolean', description: 'Step by instructions instead of source lines (optional)' } }, required: ['sessionId'] }
- src/index.ts:377-378 (registration)Routing registration in CallToolRequestSchema handler switch statement that maps 'gdb_step' calls to the handleGdbStep method.case 'gdb_step': return await this.handleGdbStep(request.params.arguments);