Commit b5f46788 authored by hjk's avatar hjk Committed by Christian Stenger

Debugger: Handle failing inferior calls more gracefully

At least for GDB on Windows that's a rather typical situation due to
GDB's "Internal error: pc in read in psymtab, but not in symtab"

Task-number: QTCREATORBUG-11164

Change-Id: If79d586b59e2c1ee37558e8a811091fefc69ac2d
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 579da1fa
......@@ -500,6 +500,18 @@ class DumperBase:
self.putType(type)
self.putNumChild(0)
def putCallItem(self, name, value, func, *args):
try:
result = self.callHelper(value, func, args)
with SubItem(self, name):
self.putItem(result)
except:
with SubItem(self, name):
self.putValue("<not callable>")
self.putNumChild(0)
def call(self, value, func, *args):
return self.callHelper(value, func, args)
def putMapName(self, value, index = -1):
ns = self.qtNamespace()
......
......@@ -575,7 +575,7 @@ class Dumper(DumperBase):
def parseAndEvaluate(self, exp):
return gdb.parse_and_eval(exp)
def call2(self, value, func, args):
def callHelper(self, value, func, args):
# args is a tuple.
arg = ""
for i in range(len(args)):
......@@ -602,9 +602,6 @@ class Dumper(DumperBase):
gdb.parse_and_eval("free(0x%x)" % ptr)
return result
def call(self, value, func, *args):
return self.call2(value, func, args)
def childWithName(self, value, name):
try:
return value[name]
......@@ -1054,11 +1051,6 @@ class Dumper(DumperBase):
i = toInteger(i)
self.putSubItem(i, (base + i).dereference())
def putCallItem(self, name, value, func, *args):
result = self.call2(value, func, args)
with SubItem(self, name):
self.putItem(result)
def isFunctionType(self, type):
return type.code == MethodCode or type.code == FunctionCode
......
......@@ -372,7 +372,7 @@ class Dumper(DumperBase):
return ns + "Qt::" + enumType + "(" \
+ ns + "Qt::" + enumType + "::" + enumValue + ")"
def call2(self, value, func, args):
def callHelper(self, value, func, args):
# args is a tuple.
arg = ','.join(args)
#warn("CALL: %s -> %s(%s)" % (value, func, arg))
......@@ -398,9 +398,6 @@ class Dumper(DumperBase):
frame = thread.GetFrameAtIndex(0)
return frame.EvaluateExpression(expr)
def call(self, value, func, *args):
return self.call2(value, func, args)
def checkPointer(self, p, align = 1):
if not self.isNull(p):
p.Dereference()
......@@ -604,11 +601,6 @@ class Dumper(DumperBase):
addr = int(address) & 0xFFFFFFFFFFFFFFFF
return self.context.CreateValueFromAddress(None, addr, referencedType)
def putCallItem(self, name, value, func, *args):
result = self.call2(value, func, args)
with SubItem(self, name):
self.putItem(result)
def childRange(self):
if self.currentMaxNumChild is None:
return xrange(0, self.currentNumChild)
......
......@@ -179,6 +179,7 @@ def qdump__QModelIndex(d, value):
% (mm_, row, column, mi_))
d.putItem(mi2)
i = i + 1
d.putFields(value)
#d.putCallItem("parent", val, "parent")
#with SubItem(d, "model"):
# d.putValue(m)
......@@ -203,6 +204,7 @@ def qdump__QDate(d, value):
d.enumExpression("DateFormat", "SystemLocaleDate"))
d.putCallItem("(Locale)", value, "toString",
d.enumExpression("DateFormat", "LocaleDate"))
d.putFields(value)
else:
d.putValue("(invalid)")
d.putNumChild(0)
......@@ -224,6 +226,7 @@ def qdump__QTime(d, value):
d.enumExpression("DateFormat", "SystemLocaleDate"))
d.putCallItem("(Locale)", value, "toString",
d.enumExpression("DateFormat", "LocaleDate"))
d.putFields(value)
else:
d.putValue("(invalid)")
d.putNumChild(0)
......@@ -312,6 +315,7 @@ def qdump__QDateTime(d, value):
d.enumExpression("TimeSpec", "UTC"))
d.putCallItem("toLocalTime", value, "toTimeSpec",
d.enumExpression("TimeSpec", "LocalTime"))
d.putFields(value)
else:
d.putValue("(invalid)")
d.putNumChild(0)
......@@ -404,6 +408,7 @@ def qdump__QDir(d, value):
with SubItem(d, "entryList"):
typ = d.lookupType(ns + "QStringList")
d.putItem(d.createValue(privAddress + filesOffset, typ))
d.putFields(value)
def qdump__QFile(d, value):
......@@ -510,6 +515,7 @@ def qdump__QFileInfo(d, value):
d.putCallItem("created", value, "created")
d.putCallItem("lastModified", value, "lastModified")
d.putCallItem("lastRead", value, "lastRead")
d.putFields(value)
def qdump__QFixed(d, value):
......@@ -919,6 +925,7 @@ def qdump__QLocale(d, value):
d.putCallItem("zeroDigit", value, "zeroDigit")
d.putCallItem("groupSeparator", value, "groupSeparator")
d.putCallItem("negativeSign", value, "negativeSign")
d.putFields(value)
def qdump__QMapNode(d, value):
......@@ -1804,6 +1811,7 @@ def qdump__QTextCodec(d, value):
with Children(d):
d.putCallItem("name", value, "name")
d.putCallItem("mibEnum", value, "mibEnum")
d.putFields(value)
def qdump__QTextCursor(d, value):
......@@ -1821,6 +1829,7 @@ def qdump__QTextCursor(d, value):
d.putIntItem("position", d.extractInt(positionAddress))
d.putIntItem("anchor", d.extractInt(positionAddress + d.intSize()))
d.putCallItem("selected", value, "selectedText")
d.putFields(value)
def qdump__QTextDocument(d, value):
......@@ -1833,6 +1842,7 @@ def qdump__QTextDocument(d, value):
d.putCallItem("lineCount", value, "lineCount")
d.putCallItem("revision", value, "revision")
d.putCallItem("toPlainText", value, "toPlainText")
d.putFields(value)
def qform__QUrl():
......@@ -1861,6 +1871,7 @@ def qdump__QUrl(d, value):
d.putCallItem("query", value, "encodedQuery")
d.putCallItem("fragment", value, "fragment")
d.putCallItem("port", value, "port")
d.putFields(value)
else:
# QUrlPrivate:
# - QAtomicInt ref;
......
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