Commit 59359905 authored by hjk's avatar hjk Committed by Bill King

debugger: add manual test for dumping derived classes using base pointer

Change-Id: I65c5977fc16083cf09a123c6beadbc156a9f29c7
Reviewed-by: default avatarBill King <bill.king@nokia.com>
parent acf3ee7c
......@@ -2450,3 +2450,20 @@ if False:
d.putValue("This is the value: %s" % value["m_a"])
d.putNoType()
d.putNumChild(0)
if False:
def qdump__gdb13393__Base(d, value):
d.putValue("Base (%s)" % value["a"])
d.putType(value.type)
d.putNumChild(1)
if d.isExpanded():
with Children(d):
d.putFields(value)
def qdump__gdb13393__Derived(d, value):
d.putValue("Derived (%s, %s)" % (value["a"], value["b"]))
d.putType(value.type)
d.putNumChild(1)
if d.isExpanded():
with Children(d):
d.putFields(value)
......@@ -4115,6 +4115,53 @@ namespace varargs {
} // namespace varargs
namespace gdb13393 {
struct Base {
Base() : a(1) {}
virtual ~Base() {} // Enforce type to have RTTI
int a;
};
struct Derived : public Base {
Derived() : b(2) {}
int b;
};
struct S
{
Base *ptr;
const Base *ptrConst;
Base &ref;
const Base &refConst;
S(Derived &d)
: ptr(&d), ptrConst(&d), ref(d), refConst(d)
{}
};
void test13393()
{
Derived d;
S s(d);
Base *ptr = &d;
const Base *ptrConst = &d;
Base& ref = d;
const Base &refConst = d;
Base **ptrToPtr = &ptr;
#if USE_BOOST
boost::shared_ptr<Base> sharedPtr(new Derived());
#else
int sharedPtr = 1;
#endif
BREAK_HERE
dummyStatement(&d, &s, &ptrToPtr, &sharedPtr, &ptrConst, &refConst, &ref);
}
} // namespace gdb13393
namespace valgrind {
void testLeak()
......@@ -4257,6 +4304,7 @@ int main(int argc, char *argv[])
bug5184::test5184();
bug5799::test5799();
bug6465::test6465();
gdb13393::test13393();
final::testFinal(&app);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment