Fix failure to find member of a typedef base class
authorWeimin Pan <weimin.pan@oracle.com>
Mon, 18 Jun 2018 21:15:13 +0000 (21:15 +0000)
committerWeimin Pan <weimin.pan@oracle.com>
Mon, 18 Jun 2018 21:31:55 +0000 (21:31 +0000)
commitbf2977b5f3d25779cdc06ba79c05244d70bd8b59
tree2df84ac75e329116c9438e67178b160785f36f9c
parentc4eb05ff9a3739378f8a846751da4d0e221b4c8c
Fix failure to find member of a typedef base class

The test case below demonstrates the problem, as described in this PR's Comment 5:

typedef struct {
        int x;
} A;

struct C : A {
        int y;
};

int main()
{
        C c;
        return 55;
}

$ gdb a.out
(gdb) ptype C::x
Internal error: non-aggregate type to value_struct_elt_for_reference

In value_struct_elt_for_reference(), need to call check_typedef() on
the aggregate type to handle the case of *curtype being ptr->typedef.

Tested on x86_64-linux. No regressions.
gdb/ChangeLog
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.cp/typedef-base.cc [new file with mode: 0644]
gdb/testsuite/gdb.cp/typedef-base.exp [new file with mode: 0644]
gdb/valops.c