-var-info-path-expression
Vladimir Prus
ghost@cs.msu.su
Fri Dec 8 21:14:00 GMT 2006
Hi Jim,
I'm porting Apple's -var-info-path-expression code to FSF, and have a couple of questions.
1. The code in cplus_path_expr_of_child looks like this:
if (CPLUS_FAKE_CHILD (child))
return parent_expr;
if (CPLUS_FAKE_CHILD (parent))
{
}
else if (index < TYPE_N_BASECLASSES (type))
{
}
else
{
/* Everything beyond the baseclasses can
only be "public", "private", or "protected" */
index -= TYPE_N_BASECLASSES (type);
switch (index)
{
case 0:
if (children[v_public] != 0)
{
path_expr = "public";
}
.......
}
How the last "else" branch can ever be executed, when right at the
beginning of the function we check for fake child and return?
2. When the parent is fake varobj, the following code is executed:
index_in_type =
cplus_real_type_index_for_fake_child_index (type, prot, index);
child_name = TYPE_FIELD_NAME (type, index_in_type);
Why is it necessary? Can't we just use 'child->name'?
Thanks in advance,
Volodya
More information about the Gdb
mailing list