Commit eb91e9b5 authored by hjk's avatar hjk Committed by hjk

debugger: also pretty-print typedefs to references

Change-Id: Id845d9cf412efb6797feadcb4d83286d16db7123
Reviewed-on: http://codereview.qt.nokia.com/3048Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 5e463412
......@@ -1333,16 +1333,19 @@ class Dumper:
value = item.value
realtype = value.type
type = realtype;
type = value.type.unqualified()
format = self.itemFormat(item)
if type.code == gdb.TYPE_CODE_REF:
typedefStrippedType = stripTypedefs(type)
if typedefStrippedType.code == gdb.TYPE_CODE_REF:
try:
# This throws "RuntimeError: Attempt to dereference a
# generic pointer." with MinGW's gcc 4.5 when it "identifies"
# a "QWidget &" as "void &".
type = type.target()
value = value.cast(type)
typedefStrippedType = typedefStrippedType.target()
value = value.cast(typedefStrippedType)
item.value = value
except RuntimeError:
value = item.value
......@@ -1372,8 +1375,6 @@ class Dumper:
except:
pass
typedefStrippedType = stripTypedefs(type)
if typedefStrippedType.code == gdb.TYPE_CODE_INT:
if self.alienSource and str(type) == "unsigned long long":
strlen = value % (1L<<32)
......@@ -1404,7 +1405,7 @@ class Dumper:
self.putNumChild(0)
return
if value.type.code == gdb.TYPE_CODE_ARRAY:
if typedefStrippedType.code == gdb.TYPE_CODE_ARRAY:
targettype = realtype.target()
self.putAddress(value.address)
self.putType(realtype)
......@@ -1603,9 +1604,9 @@ class Dumper:
#warn("INAME: %s " % item.iname)
#warn("INAMES: %s " % self.expandedINames)
#warn("EXPANDED: %s " % (item.iname in self.expandedINames))
fields = extractFields(type)
fields = extractFields(typedefStrippedType)
self.putType(type)
self.putType(realtype)
try:
self.putAddress(item.value.address)
except:
......
......@@ -2418,14 +2418,6 @@ QString fooxx()
return "bababa";
}
int testReference()
{
QString a = "hello";
const QString &b = fooxx();
const QString c = "world";
return a.size() + b.size() + c.size();
}
namespace basic {
......@@ -2645,6 +2637,30 @@ namespace basic {
dummyStatement(&i, &d, &s);
}
void testReference1()
{
int a = 43;
const int &b = a;
typedef int &Ref;
const int c = 44;
const Ref d = a;
// <=== Break here.
dummyStatement(&a, &b);
dummyStatement(&c, &d);
}
void testReference2()
{
QString a = "hello";
const QString &b = fooxx();
typedef QString &Ref;
const QString c = "world";
const Ref d = a;
// <=== Break here.
dummyStatement(&a, &b);
dummyStatement(&c, &d);
}
void testBasic()
{
testChar();
......@@ -2658,6 +2674,8 @@ namespace basic {
testStringWithNewline();
testMemoryView();
testColoredMemoryView();
testReference1();
testReference2();
}
} // namespace basic
......@@ -3290,11 +3308,14 @@ namespace bug5799 {
s2.m1 = 5;
S4 s4;
s4.m1 = 5;
S1 arr[10];
S1 a1[10];
typedef S1 Array[10];
Array a2;
// <=== Break here.
// Expand s2 and s4.
// Check there is no <unavailable synchronous data>
dummyStatement(&s2, &s4, &arr);
dummyStatement(&s2, &s4);
dummyStatement(&a1, &a2);
}
} // namespace bug5799
......@@ -3406,7 +3427,6 @@ int main(int argc, char *argv[])
testPeekAndPoke3();
testFunctionPointer();
testAnonymous();
testReference();
//testEndlessLoop();
//testEndlessRecursion();
testQStack();
......
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