From: Klaas Gadeyne <Klaas.Gadeyne@mech.kuleuven.ac.be>
To: gdb@sources.redhat.com
Subject: gdb namespaces/wrapper bug?
Date: Thu, 15 Jan 2004 12:37:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.58.0401151319510.20336@f012> (raw)
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 <vector>
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 = {<Foo> = {<Foo> = ....
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
next reply other threads:[~2004-01-15 12:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-15 12:37 Klaas Gadeyne [this message]
2004-01-15 14:49 ` Daniel Jacobowitz
2004-01-15 15:43 ` Elena Zannoni
2004-01-15 16:30 ` Klaas Gadeyne
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.58.0401151319510.20336@f012 \
--to=klaas.gadeyne@mech.kuleuven.ac.be \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox