Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* gdb namespaces/wrapper bug?
@ 2004-01-15 12:37 Klaas Gadeyne
  2004-01-15 14:49 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Klaas Gadeyne @ 2004-01-15 12:37 UTC (permalink / raw)
  To: gdb

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-01-15 16:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-15 12:37 gdb namespaces/wrapper bug? Klaas Gadeyne
2004-01-15 14:49 ` Daniel Jacobowitz
2004-01-15 15:43   ` Elena Zannoni
2004-01-15 16:30   ` Klaas Gadeyne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox