[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gdb 2004-02-20-cvs solaris fails to build "this" properly
From: |
Robert R. Henry |
Subject: |
gdb 2004-02-20-cvs solaris fails to build "this" properly |
Date: |
Fri, 20 Feb 2004 15:03:57 -0800 (PST) |
This describes a problem with gdb evaluating function member function calls
from the "print" command.
The gdb I'm using was built from the sourceforge cvs checkout
2004-02-20-cvs, with gdb configured using
./configure --host=sparc64-sun-solaris2.8
as built with gcc 3.2.2.
Consider the program shown at the bottom. That program is compiled
using g++ 3.2.2 -g.
If I use the buggy gdb to put a breakpoint on the line "p->dump()",
and then do:
(gdb) print p
$1 = 0x20be0
and then use the print command to evaluate a call to p->dump()
(gdb) print p->dump()
it appears as if the formal parameter "this" in Thing::dump
is initialized with a bogus actual parameter (0 in this case,
but I've seen 1 in my real application)
Program received signal SIGSEGV, Segmentation fault.
0x0001084c in Thing::dump (this=0x0) at x.cc:20
20 printf("a=%d\n", a);
The program being debugged was signaled while in a function called from GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on"
Evaluation of the expression containing the function (Thing::dump()) will
be abandoned.
#include <stdio.h>
class Thing {
private:
int a;
int b;
public:
Thing(void);
~Thing(void);
void dump(void);
};
typedef Thing * ThingP;
int main(void)
{
ThingP p = new Thing();
p->dump();
return 0;
}
void Thing::dump(void)
{
printf("a=%d\n", a);
printf("b=%d\n", b);
}
Thing::Thing(void)
{
a = 0;
b = 0;
}
Thing::~Thing(void)
{
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gdb 2004-02-20-cvs solaris fails to build "this" properly,
Robert R. Henry <=