This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
-var-info-path-expression
- From: Vladimir Prus <ghost at cs dot msu dot su>
- To: Jim Ingham <jingham at apple dot com>
- Cc: gdb at sources dot redhat dot com
- Date: Sat, 9 Dec 2006 00:14:03 +0300
- Subject: -var-info-path-expression
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