Commit 3c3d4566 authored by hjk's avatar hjk

Debugger: Fix internal dumpers after modularisation

creatortypes.py wasn't included, and some d. qualification missing.

Change-Id: I1f444358cc1489f47083af39565147576f1885b7
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent a076dc6d
...@@ -31,8 +31,8 @@ from dumper import * ...@@ -31,8 +31,8 @@ from dumper import *
def qdump__Core__Id(d, value): def qdump__Core__Id(d, value):
try: try:
name = parseAndEvaluate("Core::nameForId(%d)" % value["m_id"]) name = d.parseAndEvaluate("Core::nameForId(%d)" % value["m_id"])
d.putValue(encodeCharArray(name), Hex2EncodedLatin1) d.putValue(d.encodeCharArray(name), Hex2EncodedLatin1)
d.putPlainChildren(value) d.putPlainChildren(value)
except: except:
d.putValue(value["m_id"]) d.putValue(value["m_id"])
...@@ -57,12 +57,12 @@ def qdump__Debugger__Internal__BreakpointModelId(d, value): ...@@ -57,12 +57,12 @@ def qdump__Debugger__Internal__BreakpointModelId(d, value):
d.putPlainChildren(value) d.putPlainChildren(value)
def qdump__CPlusPlus__ByteArrayRef(d, value): def qdump__CPlusPlus__ByteArrayRef(d, value):
d.putValue(encodeCharArray(value["m_start"], 100, value["m_length"]), d.putValue(d.encodeCharArray(value["m_start"], 100, value["m_length"]),
Hex2EncodedLatin1) Hex2EncodedLatin1)
d.putPlainChildren(value) d.putPlainChildren(value)
def qdump__CPlusPlus__Identifier(d, value): def qdump__CPlusPlus__Identifier(d, value):
d.putValue(encodeCharArray(value["_chars"]), Hex2EncodedLatin1) d.putValue(d.encodeCharArray(value["_chars"]), Hex2EncodedLatin1)
d.putPlainChildren(value) d.putPlainChildren(value)
def qdump__CPlusPlus__IntegerType(d, value): def qdump__CPlusPlus__IntegerType(d, value):
...@@ -71,20 +71,20 @@ def qdump__CPlusPlus__IntegerType(d, value): ...@@ -71,20 +71,20 @@ def qdump__CPlusPlus__IntegerType(d, value):
def qdump__CPlusPlus__NamedType(d, value): def qdump__CPlusPlus__NamedType(d, value):
literal = downcast(value["_name"]) literal = downcast(value["_name"])
d.putValue(encodeCharArray(literal["_chars"]), Hex2EncodedLatin1) d.putValue(d.encodeCharArray(literal["_chars"]), Hex2EncodedLatin1)
d.putPlainChildren(value) d.putPlainChildren(value)
def qdump__CPlusPlus__TemplateNameId(d, value): def qdump__CPlusPlus__TemplateNameId(d, value):
s = encodeCharArray(value["_identifier"]["_chars"]) s = d.encodeCharArray(value["_identifier"]["_chars"])
d.putValue(s + "3c2e2e2e3e", Hex2EncodedLatin1) d.putValue(s + "3c2e2e2e3e", Hex2EncodedLatin1)
d.putPlainChildren(value) d.putPlainChildren(value)
def qdump__CPlusPlus__Literal(d, value): def qdump__CPlusPlus__Literal(d, value):
d.putValue(encodeCharArray(value["_chars"]), Hex2EncodedLatin1) d.putValue(d.encodeCharArray(value["_chars"]), Hex2EncodedLatin1)
d.putPlainChildren(value) d.putPlainChildren(value)
def qdump__CPlusPlus__StringLiteral(d, value): def qdump__CPlusPlus__StringLiteral(d, value):
d.putValue(encodeCharArray(value["_chars"]), Hex2EncodedLatin1) d.putValue(d.encodeCharArray(value["_chars"]), Hex2EncodedLatin1)
d.putPlainChildren(value) d.putPlainChildren(value)
def qdump__CPlusPlus__Internal__Value(d, value): def qdump__CPlusPlus__Internal__Value(d, value):
......
...@@ -26,6 +26,7 @@ from qttypes import * ...@@ -26,6 +26,7 @@ from qttypes import *
from stdtypes import * from stdtypes import *
from misctypes import * from misctypes import *
from boosttypes import * from boosttypes import *
from creatortypes import *
####################################################################### #######################################################################
...@@ -939,7 +940,7 @@ class Dumper(DumperBase): ...@@ -939,7 +940,7 @@ class Dumper(DumperBase):
item = LocalItem() item = LocalItem()
item.name = resultVarName item.name = resultVarName
item.iname = "return." + resultVarName item.iname = "return." + resultVarName
item.value = parseAndEvaluate(resultVarName) item.value = self.parseAndEvaluate(resultVarName)
locals.append(item) locals.append(item)
except: except:
# Don't bother. It's only supplementary information anyway. # Don't bother. It's only supplementary information anyway.
...@@ -1058,6 +1059,9 @@ class Dumper(DumperBase): ...@@ -1058,6 +1059,9 @@ class Dumper(DumperBase):
self.currentAddress = item.savedCurrentAddress self.currentAddress = item.savedCurrentAddress
return True return True
def parseAndEvaluate(self, exp):
return gdb.parse_and_eval(exp)
def call2(self, value, func, args): def call2(self, value, func, args):
# args is a tuple. # args is a tuple.
arg = "" arg = ""
...@@ -1079,7 +1083,7 @@ class Dumper(DumperBase): ...@@ -1079,7 +1083,7 @@ class Dumper(DumperBase):
#warn("CALL: %s" % exp) #warn("CALL: %s" % exp)
result = None result = None
try: try:
result = parseAndEvaluate(exp) result = self.parseAndEvaluate(exp)
except: except:
pass pass
#warn(" -> %s" % result) #warn(" -> %s" % result)
...@@ -1174,7 +1178,7 @@ class Dumper(DumperBase): ...@@ -1174,7 +1178,7 @@ class Dumper(DumperBase):
self.putNumChild(0) self.putNumChild(0)
else: else:
try: try:
value = parseAndEvaluate(exp) value = self.parseAndEvaluate(exp)
self.putItem(value) self.putItem(value)
except RuntimeError: except RuntimeError:
self.currentType = " " self.currentType = " "
...@@ -1681,7 +1685,7 @@ class Dumper(DumperBase): ...@@ -1681,7 +1685,7 @@ class Dumper(DumperBase):
#self.putAddress(value.address) #self.putAddress(value.address)
# Workaround for http://sourceware.org/bugzilla/show_bug.cgi?id=13380 # Workaround for http://sourceware.org/bugzilla/show_bug.cgi?id=13380
if type.code == ArrayCode: if type.code == ArrayCode:
value = parseAndEvaluate("{%s}%s" % (type, value.address)) value = self.parseAndEvaluate("{%s}%s" % (type, value.address))
else: else:
try: try:
value = value.cast(type) value = value.cast(type)
......
...@@ -1491,6 +1491,9 @@ class Dumper(DumperBase): ...@@ -1491,6 +1491,9 @@ class Dumper(DumperBase):
currentDir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) currentDir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
execfile(os.path.join(currentDir, "qttypes.py")) execfile(os.path.join(currentDir, "qttypes.py"))
execfile(os.path.join(currentDir, "stdtypes.py"))
execfile(os.path.join(currentDir, "misctypes.py"))
execfile(os.path.join(currentDir, "creatortypes.py"))
def doit(): def doit():
......
...@@ -101,8 +101,8 @@ def qdump__QAbstractItemModel(d, value): ...@@ -101,8 +101,8 @@ def qdump__QAbstractItemModel(d, value):
ri = makeValue(d.ns + "QModelIndex", "-1, -1, 0, 0") ri = makeValue(d.ns + "QModelIndex", "-1, -1, 0, 0")
this_ = makeExpression(value) this_ = makeExpression(value)
ri_ = makeExpression(ri) ri_ = makeExpression(ri)
rowCount = int(parseAndEvaluate("%s.rowCount(%s)" % (this_, ri_))) rowCount = int(d.parseAndEvaluate("%s.rowCount(%s)" % (this_, ri_)))
columnCount = int(parseAndEvaluate("%s.columnCount(%s)" % (this_, ri_))) columnCount = int(d.parseAndEvaluate("%s.columnCount(%s)" % (this_, ri_)))
except: except:
d.putPlainChildren(value) d.putPlainChildren(value)
return return
...@@ -115,7 +115,7 @@ def qdump__QAbstractItemModel(d, value): ...@@ -115,7 +115,7 @@ def qdump__QAbstractItemModel(d, value):
for column in xrange(columnCount): for column in xrange(columnCount):
with SubItem(d, i): with SubItem(d, i):
d.putName("[%s, %s]" % (row, column)) d.putName("[%s, %s]" % (row, column))
mi = parseAndEvaluate("%s.index(%d,%d,%s)" mi = d.parseAndEvaluate("%s.index(%d,%d,%s)"
% (this_, row, column, ri_)) % (this_, row, column, ri_))
#warn("MI: %s " % mi) #warn("MI: %s " % mi)
#name = "[%d,%d]" % (row, column) #name = "[%d,%d]" % (row, column)
...@@ -155,8 +155,8 @@ def qdump__QModelIndex(d, value): ...@@ -155,8 +155,8 @@ def qdump__QModelIndex(d, value):
mi = makeValue(d.ns + "QModelIndex", "%s,%s,%s,%s" % (r, c, p, m)) mi = makeValue(d.ns + "QModelIndex", "%s,%s,%s,%s" % (r, c, p, m))
mm_ = makeExpression(mm) mm_ = makeExpression(mm)
mi_ = makeExpression(mi) mi_ = makeExpression(mi)
rowCount = int(parseAndEvaluate("%s.rowCount(%s)" % (mm_, mi_))) rowCount = int(d.parseAndEvaluate("%s.rowCount(%s)" % (mm_, mi_)))
columnCount = int(parseAndEvaluate("%s.columnCount(%s)" % (mm_, mi_))) columnCount = int(d.parseAndEvaluate("%s.columnCount(%s)" % (mm_, mi_)))
except: except:
d.putEmptyValue() d.putEmptyValue()
d.putPlainChildren(value) d.putPlainChildren(value)
...@@ -164,7 +164,7 @@ def qdump__QModelIndex(d, value): ...@@ -164,7 +164,7 @@ def qdump__QModelIndex(d, value):
try: try:
# Access DisplayRole as value # Access DisplayRole as value
val = parseAndEvaluate("%s.data(%s, 0)" % (mm_, mi_)) val = d.parseAndEvaluate("%s.data(%s, 0)" % (mm_, mi_))
v = val["d"]["data"]["ptr"] v = val["d"]["data"]["ptr"]
d.putStringValue(makeValue(d.ns + 'QString', v)) d.putStringValue(makeValue(d.ns + 'QString', v))
except: except:
...@@ -178,7 +178,7 @@ def qdump__QModelIndex(d, value): ...@@ -178,7 +178,7 @@ def qdump__QModelIndex(d, value):
for column in xrange(columnCount): for column in xrange(columnCount):
with UnnamedSubItem(d, i): with UnnamedSubItem(d, i):
d.putName("[%s, %s]" % (row, column)) d.putName("[%s, %s]" % (row, column))
mi2 = parseAndEvaluate("%s.index(%d,%d,%s)" mi2 = d.parseAndEvaluate("%s.index(%d,%d,%s)"
% (mm_, row, column, mi_)) % (mm_, row, column, mi_))
d.putItem(mi2) d.putItem(mi2)
i = i + 1 i = i + 1
...@@ -1109,7 +1109,7 @@ def qdump__QObject(d, value): ...@@ -1109,7 +1109,7 @@ def qdump__QObject(d, value):
% value1["type"]) % value1["type"])
gdb.execute("set $d.d.is_null = %s" gdb.execute("set $d.d.is_null = %s"
% value1["is_null"]) % value1["is_null"])
prop = parseAndEvaluate("$d").dereference() prop = d.parseAndEvaluate("$d").dereference()
val, inner, innert, handled = \ val, inner, innert, handled = \
qdumpHelper__QVariant(d, prop) qdumpHelper__QVariant(d, prop)
......
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