From 7eedfb72bcda76e9e4a1ccd7c2556253ab14ce6e Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Wed, 7 Jul 2010 10:55:49 +0200 Subject: [PATCH] debugger: improve robustness in the presence of outdated debug information --- share/qtcreator/gdbmacros/dumper.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/share/qtcreator/gdbmacros/dumper.py b/share/qtcreator/gdbmacros/dumper.py index e7d8853e4ef..317224d52f4 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) -- GitLab