Add GDB Machine Interface adapter for local debugging #785
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements a new GDB Machine Interface (MI) adapter that provides local debugging capabilities using GDB's structured MI protocol, complementing the existing remote-only GDB RSP adapter.
Key Features
Local Debugging Support: Unlike the existing
GdbAdapter
which only supports remote connections, the newGdbMiAdapter
provides full local process execution viaExecute()
andExecuteWithArgs()
methods.Structured Communication: Uses GDB's Machine Interface protocol instead of raw Remote Serial Protocol packets, providing better parsing, error handling, and structured responses.
System Integration: Automatically detects system GDB installations with fallback support for bundled GDB executables. Validates MI support and provides clear error messages when requirements aren't met.
Cross-Platform Support: Includes comprehensive process management for Windows, macOS, and Linux with proper pipe handling and process lifecycle management.
Implementation
The adapter is implemented as:
GdbMiAdapter
: Main adapter class inheriting fromDebugAdapter
with full MI protocol supportGdbMiAdapterType
: Adapter type class with system validation and capability detectionArchitecture
Changes Made
core/adapters/gdbmiadapter.{h,cpp}
with complete MI implementationCMakeLists.txt
to include new adapter and properly bundle gdbservercore/debugger.cpp
to initialize the new adapter typeDifferences from Existing GdbAdapter
The implementation provides comprehensive debugging capabilities including breakpoints, stepping operations, memory access, register management, and reverse debugging support through GDB's rich MI interface.
Fixes #170.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.