This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
c++/1785: gdb doesn't find members of base classes compiled in separate files
- From: thor at math dot tu-berlin dot de
- To: gdb-gnats at sources dot redhat dot com
- Date: 2 Oct 2004 21:35:11 -0000
- Subject: c++/1785: gdb doesn't find members of base classes compiled in separate files
- Reply-to: thor at math dot tu-berlin dot de
>Number: 1785
>Category: c++
>Synopsis: gdb doesn't find members of base classes compiled in separate files
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: patch
>Submitter-Id: net
>Arrival-Date: Sat Oct 02 21:38:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator: thor@math.tu-berlin.de
>Release: GNU gdb 6.2
>Organization:
>Environment:
>Description:
gdb 6.2 is unable to find members of base classes if derived and main class are compiled in different files, and different directories. The bug happens in gdb/valops.c where the base classes are incorrectly accessed thru TYPE_BASECLASS(type,i). The proper version should filter the output thru check_typedef().
>How-To-Repeat:
Write three files in different directories, one defining class A, another defining class B derived from class A, and a third class C derived from B. Compile both with g++-3.4 -ggdb3 and link separately. Then try to print a member of class A within a method of class C. gdb will be unable to find the member, though "print *this" will print it correctly.
>Fix:
The following modification of gdb/valops.c fixes the problem:
>From line 2326 on, in file gdb/valops.c, replace the end of the function check_field_in() by:
/* 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: