This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [rfa/symtab/c++] fix c++ rtti type lookup
- From: Elena Zannoni <ezannoni at redhat dot com>
- To: mec dot gnu at mindspring dot com (Michael Elizabeth Chastain)
- Cc: dan at debian dot org, ezannoni at redhat dot com,gdb-patches at sources dot redhat dot com, jimb at redhat dot com, carlton at kealia dot com
- Date: Thu, 4 Dec 2003 16:16:37 -0500
- Subject: Re: [rfa/symtab/c++] fix c++ rtti type lookup
- References: <20031127070903.48F634B40B@berman.michael-chastain.com>
Michael Elizabeth Chastain writes:
> This patch is a partial fix for PR c++/1465, which is the bug where RTTI
> lookup gets the "namespace" symbol instead of the class symbol. It also
> fixes PR c++/1377, which was another manifestation of the same bug.
>
> http://sources.redhat.com/gdb/bugs/1465
> http://sources.redhat.com/gdb/bugs/1377
>
> These bugs are regressions versus gdb 6.0 so they are high priority.
>
> First, lookup_rtti_type is a new function which takes a name and a block
> and returns the class type of that name. It's basically a block of code
> extracted from gnuv3_rtti_type. gnuv3_rtti_type calls lookup_rtti_type
> now.
>
> Then I changed gnuv2_rtti_type to call lookup_rtti_type. This
> changes the symbol lookup from VAR_DOMAIN to STRUCT_DOMAIN.
>
> lookup_rtti_type is full of checks and warnings so that it doesn't
> return crap to its caller.
>
> This fixes the simple cases of the bug.
>
> More work is needed:
>
> . The calls to lookup_rtti_type need a proper "block" parameter.
> The old code needed this too; I haven't regressed anything.
> I put FIXME notes in for this.
>
> . hpacc_value_rtti_type has the same buggy code.
> I can't change the code because I can't test it,
> but I can put it a big FIXME into it.
> (I wonder if anyone still uses HP aCC with gdb).
>
here is a quandary. Should we carry around such code if nobody uses
it. If we cannot test it we might as well explicitly admit it.
> . Nested types give a warning and don't work.
> It would be nice to make them work.
>
is there a bug/testcase?
> . Types with virtual bases appear to work with v3, but give a warning
> and don't work with v2. "don't work" probably means that they fall back
> to the static type rather than the dynamic type.
>
> Testing: I tested with gcc v2 and v3, dwarf-2 and stabs+.
> Nothing got worse. gdb.cp/class2.exp has a specific test for this,
> which now passes.
>
> Some tests in virtfunc.exp that broke after the 2003-09-11 namespace
> commit started working again. That was pr gdb/1377.
>
> I think I need approval from a symtab maintainer to add the
If you move the function to cp-support.c and cp-support.h I think you
can avoid touching symtab.h altogether.
> new utility function "lookup_rtti_type", and then approval
> from a C++ maintainer to change gnuv2_rtti_type and gnuv3_rtti_type
> to call lookup_rtti_type.
>
> Okay to commit?
>
I think David ok'd it already.
elena