Skip to content

[gdbplugin] GDB backend reimplemented using GDB/MI

Currently the GDB parser uses regular expression on the output produced by the user-oriented GDB console to capture needed information. While this approach works fine for english versions, it is not robust neither to different localisations nor to reworded outputs in newer versions.

This patch provides a reimplementation of the GDB backend using the GDB Machine Interface (https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI.html), which it is invariant to localizations and provides a stable interface. As a side benefit, other debuggers which implement GDB/MI can be used too.

The patch has been tested with gdb 12.1 and lldb-mi (based on gdb 7.4, lldb 14.0.0).

Functionality changes:

  • Action "continue" does not stop at start.
  • Support for pending breakpoints (useful for debugging dynamically loaded libraries).
  • The variable explorer shows member of "this" object in a separate variable scope.

Possible improvements to be done in the future:

  • Loading large variable scopes can be very slow in gdb (it is faster in lldb). May be using lazy loading for nested variables could mitigate it.
  • The nested variable parser could be improved to detect several complex nested variables.
  • Although remote targets can be used, more testing is needed.
  • Implementing breakpoint table persistence could be nice for repeated debugging.

Merge request reports