This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gdb/51: gdb dies in varobj.c: c_type_of_child - "Child of parent whose type does not allow children."


Hi,

Yes, (void *) should have no children, so no plus sign should ever
appear.  This was not happening a couple of weeks ago.

Thanks for reporting it.


I went looking and saw that the information GDB creates for (void *)
does not have the "name" field set any longer.  Insight (actually GDB's
own varobj code) inspects it to see if it is "void" or "char".  But it
is now NULL.

(gdb) p *type
$1 = {code = TYPE_CODE_PTR, name = 0x0, tag_name = 0x0, length = 4, 
  upper_bound_type = 0, lower_bound_type = 0, objfile = 0x854e940, 
  target_type = 0x8b6b5b0, pointer_type = 0x0, reference_type = 0x0, 
  cv_type = 0x8b6b5f4, flags = 1, nfields = 0, fields = 0x0, 
  vptr_basetype = 0x0, vptr_fieldno = -1, type_specific = {arg_types =
0x0, 
    cplus_stuff = 0x0}}


Well, I can change the varobj code to look at the target_type.  I think
I will do it anyway -- it does seem to be a better way of doing it.  But
I wonder if something else also expects to see a "name" in the pointer
type. 

Does anybody know which patch changed this and if it was on purpose?  


-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9




dr@netscape.com wrote:
> 
> >Number:         51
> >Category:       gdb
> >Synopsis:       gdb dies in varobj.c: c_type_of_child - "Child of parent whose type does not allow children."
> >Confidential:   no
> >Severity:       serious
> >Priority:       medium
> >Responsible:    unassigned
> >State:          open
> >Class:          sw-bug
> >Submitter-Id:   net
> >Arrival-Date:   Tue May 01 14:58:00 PDT 2001
> >Closed-Date:
> >Last-Modified:
> >Originator:     dr@netscape.com
> >Release:        snapshot insight+dejagnu-20010427
> >Organization:
> >Environment:
> platform: i686, linux 2.2.16-22 (redhat 7.0)
> compiler: gcc-2.96-81 (rpm)
> >Description:
> We die in the following code:
> 
> static struct type *
> c_type_of_child (struct varobj *parent, int index)
> {
>   struct type *type;
>   char *name = name_of_child (parent, index);
> 
>   switch (TYPE_CODE (parent->type))
>     {
>     /* ... */
> 
>     default:
>       /* This should not happen as only the above types have children */
>       warning ("Child of parent whose type does not allow children");
>       /* FIXME: Can we still go on? */
>       type = NULL;
>       break;
>     }
> 
>   return type;
> }
> >How-To-Repeat:
> I'm using insight. Inspecting the tree of local variables in scope, insight gives me the option to expand (void*) typed pointers. When I click on the (+) widget to see the data for that variable, I get this message.
> 
> Insight probably shouldn't be giving me this option in the first place, but I think that may be a different bug.
> >Fix:
> 
> >Release-Note:
> >Audit-Trail:
> >Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]