gdb_execute_command
Send a GDB command (CLI or MI) to an active debugging session. Handles multi-line commands and formats output for readability. Use for breakpoints, variable inspection, and thread analysis. Requires session ID from gdb_start_session.
Instructions
Execute a GDB command. Supports both CLI and MI commands. CLI commands (like 'info breakpoints', 'list', 'print x') are automatically handled and their output is formatted for readability. Multi-line commands (like 'commands', 'define', 'python') are supported; separate lines with \n. MI commands (starting with '-', like '-break-list', '-exec-run') return structured data. NOTE: For calling functions in the target process, prefer using the dedicated gdb_call_function tool instead of 'call' command, as it provides better structured output and can be separately permissioned. Common examples: 'info breakpoints', 'info threads', 'run', 'print variable', 'list main', 'disassemble func'. Requires session_id parameter (obtained from gdb_start_session).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes | Session ID from gdb_start_session | |
| command | Yes | GDB command to execute | |
| timeout_sec | No | Seconds to wait for this GDB command to complete |