Skip to content

Improve GDBVariableParser

This merge request proposes a rewriting of GDBVariableParser.

Before this MR, the GDB variable structure was limited to one depth level ; for deeper levels, the raw GDB string was returned as is, leading to a LocalsView difficult to read :

hello_world_before_change.png

After this MR, there is no more limit on variable structure depth :

hello_world_after_change.png

These improvements are also applied to the register scope view :

hello_world_registers_after_change.png

Some internal details of this rewriting :

  • full recursive parsing, no limit on the variable structure depth
  • no regular expression, just a few character tests are enough
  • single pass : the input string is parsed from the beginning to the end in a straightforward way
  • no unnecessary string copies, the remaining tail to parse is propagated as a QStringView
  • an autotest has been added to check typical cases (from basic to complex)
  • a fuzzy test has been added to detect potential problems that can be difficult to catch by reading the code (run 1000000 times without problem).

@teams/qa @sars

Edited by Rémi Peuchot

Merge request reports