This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
problems viewing return values
- From: Calvin Spealman <calvin at ironfroggy dot com>
- To: gdb at sources dot redhat dot com
- Date: Fri, 31 Jan 2003 13:41:16 -0500
- Subject: problems viewing return values
I'm having some trouble with viewing the return values of a member
function in gdb. I've included a test case that demonstrates my
problems. If you break after the Foo objects are created and step into
the baz() function you will notice that if you try to print the x and y
members they will be correct, but if you print the result of get(), it
will be incorrect.
Also, I sometimes get an error from gdb saying "Function return value
unknown.", but I don't know what that means exactly or what would cause it.
struct Bar {
int x;
int y;
Bar(int a, int b) { x = a; y = b; }
};
struct Foo {
int x;
int y;
Foo(int a, int b) { x = a; y = b; }
Bar get();
void baz() { }
};
Bar Foo::get() { Bar target(x, y); return target; }
int main()
{
Foo *f = new Foo(1, 2);
Foo *g = new Foo(3, 4);
Foo h(5, 6);
f->baz();
g->baz();
h.baz();
delete f;
delete g;
}