[PATCH v5] [PR mi/29554] New PRINT-VALUES option '--scalar-values'.

Gareth Rees grees@undo.io
Thu Mar 16 12:28:01 GMT 2023


Andrew Burgess wrote:
> If we really feel that the old behaviour is worth saving then adding a
> new flag isn't the end of the world.  I'd just want to make sure we
> really have considered the alternatives first.

I agree with Andrew's analysis. Another consideration is that it is
likely that existing GDB/MI clients that use --simple-values are subject
to latent bugs or performance issues that could be fixed by changing the
behaviour of the option.

When implementing a GDB/MI client for an IDE, you typically want to
update the displayed call stack every time the debuggee stops, and the
most convenient way to do this is to use the -stack-list-arguments
command. Since it is helpful for the user to be able to see the type of
each argument, it is natural to use the --simple-values option, as
otherwise you have to loop over the arguments calling -var-create.

If you use -stack-list-arguments with --simple-values, it can be hard to
spot that you are introducing bugs or performance issues when debugging
C++ programs with functions taking references to large data structures,
and it is easy to omit this case in testing. Visual Studio Code's
initial implementation of their GDB/MI client had exactly such an issue.

Searching GitHub, I found a couple of other bugs that might take this
form, in particular [1] and [2] are hangs in gdbgui whose descriptions
suggest that they might be related to the handling of reference types by
the --simple-values option.

[1] https://github.com/cs01/gdbgui/issues/205
[2] https://github.com/cs01/gdbgui/issues/206


More information about the Gdb-patches mailing list