* 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
* Re: gdb namespaces/wrapper bug?
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
0 siblings, 2 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2004-01-15 14:49 UTC (permalink / raw)
To: Klaas Gadeyne; +Cc: gdb
On Thu, Jan 15, 2004 at 01:37:45PM +0100, Klaas Gadeyne wrote:
> namespace BASE
> {
> class Foo
> namespace WRAPPED
> {
> class Foo : public BASE::Foo
> 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.
Could you try CVS gdb? I think the segfault has been fixed. I may be
mistaken about that, though. This is related to
lookup_transparent_type, which David has been doing some work on (and
has more pending).
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gdb namespaces/wrapper bug?
2004-01-15 14:49 ` Daniel Jacobowitz
@ 2004-01-15 15:43 ` Elena Zannoni
2004-01-15 16:30 ` Klaas Gadeyne
1 sibling, 0 replies; 4+ messages in thread
From: Elena Zannoni @ 2004-01-15 15:43 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: Klaas Gadeyne, gdb
Daniel Jacobowitz writes:
>
> Could you try CVS gdb? I think the segfault has been fixed. I may be
> mistaken about that, though. This is related to
> lookup_transparent_type, which David has been doing some work on (and
> has more pending).
I actually was just looking at a similar bug against RH gdb, which I just
verified with current CVS:
Do
b main
run
p foo
with this, and you get the infinite loop + segfault:
struct derived;
struct base
{
static derived bar;
};
struct derived : base
{
};
derived base::bar;
base foo;
int main()
{
return 0;
}
the problem seems to be cp_print_static_field. If you set print
static-member off of course it all works. (gcc 3.2.2)
elena
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gdb namespaces/wrapper bug?
2004-01-15 14:49 ` Daniel Jacobowitz
2004-01-15 15:43 ` Elena Zannoni
@ 2004-01-15 16:30 ` Klaas Gadeyne
1 sibling, 0 replies; 4+ messages in thread
From: Klaas Gadeyne @ 2004-01-15 16:30 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb
> Could you try CVS gdb? I think the segfault has been fixed. I may be
> mistaken about that, though. This is related to
> lookup_transparent_type, which David has been doing some work on (and
> has more pending).
Hi Daniel,
Indeed, the infinite loop/segfault is gone with CVS gdb, however, the
behaviour is not yet as desired :)
====================================================================
[klaas@c014 /tmp]$ /usr/local/bin/gdb ./a.out
GNU gdb 2004-01-15-cvs
This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db
library "/lib/libthread_db.so.1".
(gdb) break wrapper.cpp:17
Breakpoint 1 at 0x80484f4: file wrapper.cpp, line 17.
(gdb) run
Starting program: /tmp/a.out
Breakpoint 1, main () at wrapper.cpp:17
17 Foo mywrapped;
(gdb) next
18 return 0;
(gdb) display mywrapped
1: mywrapped = {<> = {<No data fields>}, <No data fields>}
======================================================================
So mywrapped is now reported to be empty, where I expected to see
something like
1: mywrapped = {<Foo> = {<No data fields>}, <No data fields>}
regards,
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