|
From: | Böjthe Zoltán |
Subject: | invalid vptr after gdb prints the return value of a virtual function member on a 64 bit system |
Date: | Fri, 11 Nov 2011 11:33:34 +0100 |
User-agent: | Roundcube Webmail/0.5.2 |
The virtual function getMyVal() of MyClass returns a MyVal object as value, and MyVal object size is small, and MyVal object has copy constructor.
When I use "p myClass->getMyVal()", the gdb calls the copy ctor of MyVal badly, and copy ctor overwrite the vptr of the myClass.
When I remove the copy ctor of MyVal, or I add some dummy members to MyVal, the gdb will work correctly.
Tested in Ubuntu 11.10, 64 bit. (On Ubuntu 11.10, 32 bit, work correctly)
See attached files.
Zoltan Bojthe.
a.cc
Description: Text Data
build.sh
Description: Text document
gdb.in
Description: Text document
run.sh
Description: Text document
gdb.expected.out
Description: Text document
gdb.out
Description: Text document
[Prev in Thread] | Current Thread | [Next in Thread] |