[Converted from Gnats 2366] GDB crashes when accesing type information. It runs into an infinite recursion in fill_in_vptr_fieldno. The crash occurs with gcc versions (only versions we used are listed) 4.0.3 3.4.x 3.3.x It has to do with namespaces and wrong resolution of a base class. In short: namespace N1 { class A {}; } namespace N2 { class B : public N1::A {} } When printing "this" when in B's method, it resolves base class to be B again. See attached project with sources and test case (and gdb command file). Release: unknown How-To-Repeat: Use attached project and command file: gdb (gdb) source crash.source
From: Daniel Jacobowitz <drow@false.org> To: aristovski@qnx.com Cc: gdb-gnats@sources.redhat.com, rmansfield@qnx.com Subject: Re: c++/2366: gdb crash: infinite recursion in fill_in_vptr_fieldno Date: Wed, 21 Nov 2007 11:57:13 -0500 On Wed, Nov 21, 2007 at 04:39:02PM -0000, aristovski@qnx.com wrote: > >Release: unknown-1.0 What version of GDB? Have you tried the latest? -- Daniel Jacobowitz CodeSourcery
From: Aleksandar Ristovski <ARistovski@qnx.com> To: Daniel Jacobowitz <drow@false.org>, Aleksandar Ristovski <ARistovski@qnx.com> Cc: gdb-gnats@sources.redhat.com, Ryan Mansfield <RMansfield@qnx.com> Subject: RE: c++/2366: gdb crash: infinite recursion in fill_in_vptr_field no Date: Wed, 21 Nov 2007 11:59:52 -0500 > -----Original Message----- > From: Daniel Jacobowitz [mailto:drow@false.org] > Sent: November 21, 2007 11:57 AM > To: aristovski@qnx.com > Cc: gdb-gnats@sources.redhat.com; rmansfield@qnx.com > Subject: Re: c++/2366: gdb crash: infinite recursion in > fill_in_vptr_fieldno > > On Wed, Nov 21, 2007 at 04:39:02PM -0000, aristovski@qnx.com wrote: > > >Release: unknown-1.0 > > What version of GDB? Have you tried the latest? We tried all from 5.2.1 to 6.7. The only difference we saw is with the GCC version: with binary created with 4.0.3 it still crashes, but not with binaries generated with gcc 4.1.1 and 4.1.2 --- Aleksandar > > -- > Daniel Jacobowitz > CodeSourcery
From: Aleksandar Ristovski <ARistovski@qnx.com> To: gdb-gnats@sources.redhat.com Cc: Subject: Re: c++/2366: gdb crash: infinite recursion in fill_in_vptr_field no Date: Wed, 21 Nov 2007 12:06:32 -0500 Clarification: In the Description section the "In short" example should have been: namespace N1 { class A {}; } namespace N2 { class A : public N1::A {} } Note how name "A" appears in both namespaces. The attached example is still good though. --- Aleksandar
This test case works fine for me with cvs head gdb: (gdb) source crash.source Breakpoint 1 at 0x804851f: file Impl.cpp, line 20. Breakpoint 1, NamespaceImpl::MyBaseClass::foo (this=0x8049a54) at Impl.cpp:20 20 return a; $1 = (NamespaceImpl::MyBaseClass) { <NamespaceBase::MyBaseClass> = { _vptr.MyBaseClass = 0x80486b8 }, <No data fields>}