Debugger: Add dumper for Qt3's (sic!) QString

Change-Id: I24d266587425a5c50ec3dcb548a29877730cbdff
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
hjk
2014-10-10 12:05:47 +02:00
parent fa8d52cd23
commit 1baca8e797
2 changed files with 19 additions and 2 deletions

View File

@@ -449,7 +449,7 @@ class DumperBase:
data = data & 0xffffffff data = data & 0xffffffff
else: else:
data = data & 0xffffffffffffffff data = data & 0xffffffffffffffff
else: elif self.qtVersion() >= 0x040000:
# Data: # Data:
# - QBasicAtomicInt ref; # - QBasicAtomicInt ref;
# - int alloc, size; # - int alloc, size;
@@ -458,6 +458,15 @@ class DumperBase:
alloc = self.extractInt(addr + 4) alloc = self.extractInt(addr + 4)
size = self.extractInt(addr + 8) size = self.extractInt(addr + 8)
data = self.extractPointer(addr + 8 + self.ptrSize()) data = self.extractPointer(addr + 8 + self.ptrSize())
else:
# Data:
# - QShared count;
# - QChar *unicode
# - char *ascii
# - uint len: 30
size = self.extractInt(addr + 3 * self.ptrSize()) & 0x3ffffff
alloc = size # pretend.
data = self.extractPointer(addr + self.ptrSize())
return data, size, alloc return data, size, alloc
# addr is the begin of a QByteArrayData structure # addr is the begin of a QByteArrayData structure

View File

@@ -1501,8 +1501,16 @@ class Dumper(DumperBase):
pass pass
try: try:
# Seemingly needed with Debian's GDB 7.4.1 # Last fall backs.
s = gdb.execute("ptype QByteArray", to_string=True) s = gdb.execute("ptype QByteArray", to_string=True)
if s.find("QMemArray") >= 0:
# Qt 3.
self.qtNamespaceToReport = ""
self.qtNamespace = lambda: ""
self.qtVersion = lambda: 0x30308
self.fallbackQtVersion = 0x30308
return ""
# Seemingly needed with Debian's GDB 7.4.1
ns = s[s.find("class")+6:s.find("QByteArray")] ns = s[s.find("class")+6:s.find("QByteArray")]
if len(ns): if len(ns):
self.qtNamespaceToReport = ns self.qtNamespaceToReport = ns