variable objects and registers
Vladimir Prus
vladimir@codesourcery.com
Wed Nov 29 17:21:00 GMT 2006
I was working on implementing a new MI command that creates variable objects
for registers, and I have something working good enough to discuss. This
patch lacks docs, but I wanted to make sure the interface is fine with
everybody before documenting it.
There are already some commands related to registers, for
example, -data-list-register-names. But for registers that are not just
integers, one has to use variable objects to property display them. As
result, output of -data-list-register-names goes directly to a number
of -var-create. It is more reasonable to have a command that immediately
produces variable objects.
Further, when memory-mapped registers are involved, gdb might want to group
them in some hierarchy. Using variable objects is a reasonable way to achieve
that.
This patch adds new command -var-registers that creates and returns a list of
variable objects for all registers gdb knows. The command takes one option --
the frame, which is specified just like for -var-create. While not all
registers are saved, and so gdb might not know values of some registers in
parent frames, for some registers it's possible, and frontends might want to
access those values.
Since the command creates several variable objects, it does not accepts a name
of varobj. Instead, it automatically generated names much like "var-create -"
does.
Here's example output:
-var-registers *
^done,registers={
{name="var1",exp="$eax",numchild="0",value="16",type="int"},
............
{name="var10",exp="$eflags",numchild="0",value="[ SF IF ID ]",
As soon as we add the code to display memory-mapped registers, there will be a
problem that existing frontends might wish to show the memory-mapped
registers, but not wish (at the moment) to modify the code for displaying
regular registers. I plan to address this by either adding new
attribute "register-kind" to the output, that can be either "core"
or "memory-mapped", or by adding an option to -var-registers that says what
registers to show. But that's for future.
Comments?
- Volodya
* mi/mi-cmds.h (mi_cmd_var_registers): New.
* mi/mi-cmds.c: Register "var-registers".
* mi/mi-cmd-var.c (create_varobj_in_frame): New function.
(mi_cmd_var_create): Use the above.
(mi_cmd_var_registers): New.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: varobj_for_registers__gdb_mainline.diff
Type: text/x-diff
Size: 5091 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20061129/c0aace04/attachment.bin>
More information about the Gdb-patches
mailing list