This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] PR python/11407
On Monday 28 June 2010 18:52:32 you wrote:
> >>>>> "AndrÃ" == Andrà PÃnitz <andre.poenitz@nokia.com> writes:
>
> AndrÃ> I'd guess it would be nice for a front end to get a hint that
> AndrÃ> something unusual happened in case it wants to have some kind of
> AndrÃ> special handling of such cases (like localizing the error
> AndrÃ> message).
>
> AndrÃ> A separate field error="...", or perhaps value="<error reading
> AndrÃ> variable: %s>" as suggested with an additional field iserror="1"
> AndrÃ> would be easier to handle than checking the "value" field for
> AndrÃ> well-known strings, especially if such content could be legal
> AndrÃ> output in some cases, too.
>
> That would be fine with me.
>
> I am curious to hear what Volodya wants.
>
> AndrÃ> [But take this with a grain of salt, I/we haven't used MI for
> AndrÃ> data retrieval for a while now, so maybe there are already enough
> AndrÃ> hints in the output nowadays.]
>
> What do you use?
I use a rather monolithic python script[1] iterating over the stack variables
as well as a few expressions for watched expressions and tooltips, generating
all interesting data for the "Locals and Watchers" view in one go.
The approach reduces roundtrip count to a minimum, at the price of repeating
some unnecessary work each time the inferior stops. It's worthwhile though.
As a rule of thumb one can retrieve 50-150 simple data items (say, values from
a std::vector<int>) in the time an additional roundtrip would take (~30ms).
Apart from that, the script creates exactly those pieces of data that are
used in the Gui, and it's easy to generate arbitrary subtrees, including
results from inferior calls and such, having individual formats for them,
using far less code in the front end than the MI based version (which is
still around, but only used on Mac and for older versions of gdb on Linux).
It is really nice (and highly appreciated) that gdb allows this degree of
flexibility nowadays ;-)
Andre'
PS: In case you are interested, the main script is here:
http://qt.gitorious.org/qt-creator/qt-creator/blobs/master/share/qtcreator/gdbmacros/dumper.py
And there are "pretty printers" here:
http://qt.gitorious.org/qt-creator/qt-creator/blobs/master/share/qtcreator/gdbmacros/gdbmacros.py