This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Patch: implement new dynamic varobj spec
> Nick> 2) If is_map is true, rather than:
> [...]
> Nick> I would prefer GDB to output:
> Nick> var1.0 = "map_element"
> Nick> var1.0.key = key0
> Nick> var1.0.value = value0
>
> Nick> That way the values could be displayed as a tree:
>
> I considered this back at the start. The problem with doing this is
> that the key need not be a scalar. It could be a struct or some other
> complicated varobj with children.
It's probably unusual for the key to be a structure but that wouldn't be a
problem and it in could be expanded in turn. Something like (I'm not a C++
programmer and maybe values would need some kind of comparator to be defined):
struct values
{
int a;
float b;
};
map<values*, string> m1;
struct values val = {a : 5, b : 7.5};
struct values *v;
*v = val;
m1[v] = "a string";
-var-create - * m1
-var-list-children -var1
var1.0 = "map_element"
var1.0.key = key0
var1.0.key.a = 5
var1.0.key.b = 7.5
var1.0.value = "a string"
> Also, the current approach has a benefit because it is simple and
> uniform: we can add more display hints without modifying the C code.
and
> Nick> For collections, it would seem useful to have some kind of index number.
> That would be fine by me.
var1.0 above would provide the index.
--
Nick http://www.inet.net.nz/~nickrob