Commit 7388034e authored by hjk's avatar hjk Committed by hjk
Browse files

debugger: recognize null references explicitly.



Change-Id: Ie315997363d9f591526ea8c122759f59d808fae5
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent b800aeb3
......@@ -1408,6 +1408,15 @@ class Dumper:
#warn("REAL VALUE: %s " % value)
if type.code == ReferenceCode:
try:
# Try to recognize null references explicitly.
if long(value.address) == 0:
self.putValue("<null reference>")
self.putType(typeName)
self.putNumChild(0)
return
except:
pass
try:
# FIXME: This throws "RuntimeError: Attempt to dereference a
# generic pointer." with MinGW's gcc 4.5 when it "identifies"
......
......@@ -2100,6 +2100,31 @@ namespace final {
dummyStatement(&app);
}
void testNullReferenceHelper(int &i, int &j)
{
i += 1;
j += 1;
}
void testNullReference()
{
int i = 21;
int *p = &i;
int *q = 0;
int &pp = *p;
int &qq = *q;
BREAK_HERE;
// Check i 21 int.
// CheckType p int.
// Check p 21 int.
// Check q 0x0 int *.
// Check qq <null reference> int.
// Continue.
return; // Uncomment.
testNullReferenceHelper(pp, qq);
dummyStatement(p, q, &i);
}
void testFinal(QCoreApplication *app)
{
// This contains all "final" tests that do not allow proceeding
......@@ -2108,6 +2133,7 @@ namespace final {
// Continue.
testQSettings();
testNullPointerDeref();
testNullReference();
testEndlessLoop();
testEndlessRecursion();
testUncaughtException();
......
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