This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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;

}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]