Implications of GDB Variable Objects support in Nemiver



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I have been working on adding Variable Objects (a.k.a. varobjs) support to
Nemiver recently and I would like to present the state of this work for now.

First of all, to know more about variable objects, you can read
http://sources.redhat.com/gdb/current/onlinedocs/gdb_26.html#SEC435.

To put it shortly, variable objects are an "object oriented" interface provided
by GDB/MI to examine and change values of expressions. It's really done to ease
the work of GDB client programs like Nemiver.

Here is the basic workflow used by a client program willing to examine the value
of a variable v.

1/Create a variable object representing v. Let's say the variable object is
called o.

2/To know about the value of v, query o. If v is an aggregate variable (struct
or array), o is presented with a tree like structure. Each node of the o
represents a certain member of the v aggregate. Each node of o can be queried
separately.

3/Delete o when the client is done.

This differs quite a bit with the way Nemiver used to interact with variables in
general.
Until now, we used to just query GDB for the entire value of a given variable to
without using varobjs. In a sense, it made the easy workflows easier than using
varobjs because instead of doing 1/, 2/, and 3/, we just had to ask GDB to
return a flat string representation of the entire variable, parse the result and
present it to the user.
That strategy, although quite direct and simple for simple cases, made more
involved use cases like de-referencing of pointers be complex to handle. Also,
parsing that flat string representation is quite hard as GDB spits quite some
non-compliant MI constructs to us, in that mode.

Varobjs in the other hands turn pointer de-referencing (in the user interface)
into a piece of cake, even if the interaction with the GDB back-end is a bit
more "talky".

So I added IDebugger::create_variable(), IDebugger::delete_variable(),
IDebugger::unfold_variable(), IDebugger::assign_variable(),
IDebugger::evaluate_variable_expr(), and IDebugger::list_changed_variables()
entry points to the IDebugger abstract interface. Those use variable objects to
manage and query the state the variable expressions.

The implementation of these new interface entry points involved modifying the
GDB/MI parser and the GDBEngine to support variable objects.

To iron that out, I ported the local variable inspector as well as the variable
inspector dialog to these varobjs backed interfaces of IDebugger. I have also
added a preliminary support of variable editing (so you can assign new values to
variables in the debugger) to the variable inspector dialog. I haven't added
that to the local variables inspector yet though.

This work is present in the varobjs-support branch of the Nemiver git repository
today.

The --enable-varobjs/disable-varobjs configure switch can be used to
enable/disable that work. It's enabled by default in that branch.

I have been using that branch for a couple of days on my own debugging
activities and it seemed quite robust, even if there are still things to add
here or there. All in all, I think what is in that branch works already better
than what we have in master, has got more features and fixes bugs like
http://bugzilla.gnome.org/show_bug.cgi?id=386594.

To track that varobjs feature, I have opened bug
http://bugzilla.gnome.org/show_bug.cgi?id=573678. Feel free to comment there if
you like :)

Thanks for reading so far.

Cheers,

Dodji.


- --
Tant que l'on n'a pas la tête coupée, on peut espérer mettre un chapeau.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Remi - http://enigmail.mozdev.org

iEYEARECAAYFAkn0YeEACgkQPejI7lrem2H4tgCeOC/dLQgM2vkyDIRY5enTU6RG
gt0An2iPqKrcGtQJZ8oQZz2YyX6pSqX5
=9fgZ
-----END PGP SIGNATURE-----


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]