This is the mail archive of the gdb-prs@sourceware.org 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]
Other format: [Raw text]

c++/2066: gdb fails to resolve symbols of forward-declared classes


>Number:         2066
>Category:       c++
>Synopsis:       gdb fails to resolve symbols of forward-declared classes
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          patch
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 07 21:58:01 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     thor@math.tu-berlin.de
>Release:        6.4
>Organization:
>Environment:
i686-pc-linux-gnu
>Description:
If a class appears as a member of a larger class, and the inner class is forward declared somewhere in the file such that the forward-typedef is found first in the symbol table, gdb fails to resolve the members of the inner class.
>How-To-Repeat:
Hard. Requires a careful layout of the object file, but see the patch that fixes the problem.

Setup at least three files plus headers, forward class A in the first file, define class B with inner class A in the second, define class A in the third. Link in proper order such that the forward is first in the symbol file. Then open the debugee with gdb, try to print the value of any inner member of class A.
>Fix:
Replace valops.c, lines 2258 ff. by the following:

  /* FIX THOR : Must convert the base type to the
  ** proper real base type with check_typedef.
  */
  for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--) {
    struct type *t = check_typedef (TYPE_BASECLASS (type, i));
    if (check_field_in (t, name))
      return 1;
  }

  return 0;
>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]