forked from qt-creator/qt-creator
debugger: recognize null references explicitly.
Change-Id: Ie315997363d9f591526ea8c122759f59d808fae5 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user