From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28535 invoked by alias); 15 Jan 2004 12:37:49 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 28445 invoked from network); 15 Jan 2004 12:37:47 -0000 Received: from unknown (HELO rusty.kulnet.kuleuven.ac.be) (134.58.240.42) by sources.redhat.com with SMTP; 15 Jan 2004 12:37:47 -0000 Received: from localhost (localhost [127.0.0.1]) by rusty.kulnet.kuleuven.ac.be (Postfix) with ESMTP id 0BD171D7773 for ; Thu, 15 Jan 2004 13:37:46 +0100 (CET) Received: from antonius.kulnet.kuleuven.ac.be (antonius.kulnet.kuleuven.ac.be [134.58.240.73]) by rusty.kulnet.kuleuven.ac.be (Postfix) with ESMTP id 793AD1D7640; Thu, 15 Jan 2004 13:37:45 +0100 (CET) Received: from F012.mech.kuleuven.ac.be (F012.mech.kuleuven.ac.be [10.33.175.12]) by antonius.kulnet.kuleuven.ac.be (Postfix) with ESMTP id 4A8FF4C0D1; Thu, 15 Jan 2004 13:37:45 +0100 (CET) Date: Thu, 15 Jan 2004 12:37:00 -0000 From: Klaas Gadeyne To: gdb@sources.redhat.com Subject: gdb namespaces/wrapper bug? Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by KULeuven Antivirus Cluster X-SW-Source: 2004-01/txt/msg00191.txt.bz2 Hi, I encountered a strange problem while debugging and I'm not sure wether the problem is coming from gcc-3.x or gdb? Consider the following code, consisting of 3 files ========================================================================= ========================================================================= [klaas@c014 /tmp]$ cat wrapper_object.h #include namespace BASE { class Foo { public: Foo(){}; virtual ~Foo(){}; virtual void Method(); }; } ========================================================================= [klaas@c014 /tmp]$ cat wrapper_object.cpp #include "wrapper_object.h" namespace BASE { void Foo::Method(){}; } ========================================================================== [klaas@c014 /tmp]$ cat wrapper.cpp #include "wrapper_object.h" namespace WRAPPED { class Foo : public BASE::Foo { public: Foo() : BASE::Foo(){}; virtual ~Foo(){}; }; } using namespace WRAPPED; int main() { Foo mywrapped; return 0; } ========================================================================== ========================================================================== This compiles and runs just fine (compile wrapper_object.cpp, compile wrapper.cpp linking with wrapper_object.o), but when debugging the code with gdb (I only tried with both 5.3-debian and 6.0-debian (the latest from testing and unstable)) and trying to display the mywrapped variable, gdb enters in a infinite loop: (gdb) display mywrapped 1: mywrapped = { = { = .... and finally segfaults. Used compilers (all debian packages): [klaas@c014 /tmp]$ g++ --version g++ (GCC) 3.3.3 20040110 (prerelease) (Debian) I also tried with 3.3.2, but that gives the same result. The problem does not exist when: - The code is compiled with g++ 2.95.4 - All code is inlined in 1 file (yes, that's why there are 3 files above :) - I omit the member function method and put the constructor implementation in the cpp file. - When Foo in namespace WRAPPED is renamed into Boo Is this a gdb problem? or is is related to gcc 3.x? Or am I missing something important here? thanks, klaas