diff --git a/share/qtcreator/gdbmacros/dumper.py b/share/qtcreator/gdbmacros/dumper.py
index e7d8853e4efb32f52c954d05ed05cc7625bee2ad..317224d52f40c0c6ba56ce3ad1d44201fa39eec6 100644
--- a/share/qtcreator/gdbmacros/dumper.py
+++ b/share/qtcreator/gdbmacros/dumper.py
@@ -600,7 +600,11 @@ def isNull(p):
     # for invalid char *, as their "contents" is being examined
     #s = str(p)
     #return s == "0x0" or s.startswith("0x0 ")
-    return p.cast(lookupType("void").pointer()) == 0
+    try:
+        # Can fail with: "RuntimeError: Cannot access memory at address 0x5"
+        return p.cast(lookupType("void").pointer()) == 0
+    except:
+        return False
 
 movableTypes = set([
     "QBrush", "QBitArray", "QByteArray",
@@ -981,11 +985,14 @@ class FrameCommand(gdb.Command):
                 # Special handling for char** argv.
                 n = 0
                 p = item.value
-                # p is 0 for "optimized out" cases.
-                if not isNull(p):
-                    while not isNull(p.dereference()) and n <= 100:
-                        p += 1
-                        n += 1
+                # p is 0 for "optimized out" cases. Or contains rubbish.
+                try:
+                    if not isNull(p):
+                        while not isNull(p.dereference()) and n <= 100:
+                            p += 1
+                            n += 1
+                except:
+                    pass
 
                 with SubItem(d):
                     d.put('iname="%s",' % item.iname)