[PATCH] locate members in multiple-inheritance hierarchy

Thomas Richter thor@mail.math.tu-berlin.de
Sun Feb 26 22:48:00 GMT 2006


Hi folks,

sorry to say that gdb-6.4 has (just another) bug in locating class members in multiple-inheritance class
hierarchies. The bug seems to be in lookup_struct_elt_type(), gdbtypes.c, lines 1234ff.

Specifically, this code *aborts* the scan by means of "noerr" when detecting a subclass that
does not contain the member being searched for. However, it should instead continue to search
subclasses.

To fix this problem, replace the for-loop over base classes in gdbtypes.c, lines 1234 by
the following:

  for (i = TYPE_N_BASECLASSES (type) - 1; i1 >= 0; i--)
    {
      struct type *t = check_typedef (TYPE_BASECLASS (type, i)); 
      /* FIX: THOR (25.2.2006):
      ** must check for typedefs, must not error on first tried subclass.
      */
      
      t = lookup_struct_elt_type (t , name, 1 /*noerr*/);
      if (t != NULL)
	{
	  return t;
	}
    }

So long,
	Thomas



More information about the Gdb-patches mailing list