This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug mi/13393] There is no way to access runtime type of C++variable via MI (using RTTI)
- From: "xgsa at yandex dot ru" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Mon, 28 Nov 2011 17:17:06 +0000
- Subject: [Bug mi/13393] There is no way to access runtime type of C++variable via MI (using RTTI)
- Auto-submitted: auto-generated
- References: <bug-13393-4717@http.sourceware.org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=13393
--- Comment #13 from Anton <xgsa at yandex dot ru> 2011-11-28 17:17:06 UTC ---
An extended example:
#include <boost/shared_ptr.hpp>
struct Base {
Base() : a(1) {}
virtual ~Base() {} // Enforce type to have RTTI
int a;
};
struct Derived : public Base {
Derived() : b(2), c(3) {}
int b;
int c;
};
struct S
{
Base* ptr;
const Base* ptrConst;
Base& ref;
const Base& refConst;
S(Derived& d)
: ptr ( &d )
, ptrConst ( &d )
, ref ( d )
, refConst ( d ) {};
};
int main() {
Derived d;
S s(d);
Base* ptr = &d;
const Base* ptrConst = &d;
Base& ref = d;
const Base& refConst = d;
Base** ptrToPtr = &ptr;
// Interesting if pretty printer is used
boost::shared_ptr<Base> sharedPtr (new Derived());
return 0;
}
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.