Simpify varobj children handling for C
Vladimir Prus
ghost@cs.msu.su
Sat Dec 23 19:52:00 GMT 2006
At the moment, varobj.c has three related function:
c_name_of_child
c_value_of_child
c_type_of_child
Those function have a big similarity of code structure. There's some non-optimal logic
as well, for example, to get a value of a structure member c_value_of_child first
calls c_name_of_child. That one determines the index of the requested filed in the type
and returns the name. After that, c_value_of_child looks up the field using the name --
despite the fact that c_name_of_child already found the type index.
This patch introduces new function c_describe_child that can return name, value and type
at the same time. The three function mentioned above are made a tiny wrapeprs over
c_describe_child.
In addition to removing duplicated logic, this patch has another side effect -- now
all accesses to structure fields are done using indices, and not names. This opens the door
for supporting anonymous unions.
I have a similar patch for C++ in progress, and after that I'll make 'describe_child' the only
interface and remove name_of_child/value_of_child/type_of_child completely.
I wanted to post this patch first, because combined patch will be rather huge and
non-reviewable.
OK?
- Volodya
Simplify access to various properties of children
variable objects in C.
* varobj.c (value_struct_element_index): New function.
(c_describe_child): New function.
(c_name_of_child, c_value_of_child)
(c_type_of_child): Rewrite to use c_describe_child.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: path_3_unify__gdb_mainline.diff
Type: text/x-diff
Size: 7455 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20061223/412f41c8/attachment.bin>
More information about the Gdb-patches
mailing list