bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

invalid vptr after gdb prints the return value of a virtual function mem


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.

 

Attachment: a.cc
Description: Text Data

Attachment: build.sh
Description: Text document

Attachment: gdb.in
Description: Text document

Attachment: run.sh
Description: Text document

Attachment: gdb.expected.out
Description: Text document

Attachment: gdb.out
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]