forked from qt-creator/qt-creator
Debugger: Use qArrayData instead of qArrayDataHelper
Change-Id: I97a6c428e6b09232c420e2b8cb3b5b31588c949f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -570,6 +570,9 @@ class DumperBase():
|
|||||||
self.check(0 <= size and size <= alloc and alloc <= 1000 * 1000 * 1000)
|
self.check(0 <= size and size <= alloc and alloc <= 1000 * 1000 * 1000)
|
||||||
return data, size, alloc
|
return data, size, alloc
|
||||||
|
|
||||||
|
def qArrayData(self, value):
|
||||||
|
return self.qArrayDataHelper(self.extractPointer(value))
|
||||||
|
|
||||||
def qArrayDataHelper(self, array_data_ptr):
|
def qArrayDataHelper(self, array_data_ptr):
|
||||||
# array_data_ptr is what is e.g. stored in a QByteArray's d_ptr.
|
# array_data_ptr is what is e.g. stored in a QByteArray's d_ptr.
|
||||||
if self.qtVersion() >= 0x050000:
|
if self.qtVersion() >= 0x050000:
|
||||||
@@ -614,15 +617,14 @@ class DumperBase():
|
|||||||
# of inferior calls
|
# of inferior calls
|
||||||
if addr == 0:
|
if addr == 0:
|
||||||
return 0, ''
|
return 0, ''
|
||||||
data, size, alloc = self.qArrayDataHelper(addr)
|
data, size, alloc = self.qArrayData(value)
|
||||||
if alloc != 0:
|
if alloc != 0:
|
||||||
self.check(0 <= size and size <= alloc and alloc <= 100 * 1000 * 1000)
|
self.check(0 <= size and size <= alloc and alloc <= 100 * 1000 * 1000)
|
||||||
elided, shown = self.computeLimit(size, limit)
|
elided, shown = self.computeLimit(size, limit)
|
||||||
return elided, self.readMemory(data, 2 * shown)
|
return elided, self.readMemory(data, 2 * shown)
|
||||||
|
|
||||||
def encodeByteArrayHelper(self, value, limit):
|
def encodeByteArrayHelper(self, value, limit):
|
||||||
addr = self.extractPointer(value)
|
data, size, alloc = self.qArrayData(value)
|
||||||
data, size, alloc = self.qArrayDataHelper(addr)
|
|
||||||
if alloc != 0:
|
if alloc != 0:
|
||||||
self.check(0 <= size and size <= alloc and alloc <= 100 * 1000 * 1000)
|
self.check(0 <= size and size <= alloc and alloc <= 100 * 1000 * 1000)
|
||||||
elided, shown = self.computeLimit(size, limit)
|
elided, shown = self.computeLimit(size, limit)
|
||||||
@@ -675,9 +677,6 @@ class DumperBase():
|
|||||||
elided, data = self.encodeByteArrayHelper(value, limit)
|
elided, data = self.encodeByteArrayHelper(value, limit)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def qArrayData(self, value):
|
|
||||||
return self.qArrayDataHelper(self.extractPointer(value))
|
|
||||||
|
|
||||||
def putByteArrayValue(self, value):
|
def putByteArrayValue(self, value):
|
||||||
elided, data = self.encodeByteArrayHelper(value, self.displayStringLimit)
|
elided, data = self.encodeByteArrayHelper(value, self.displayStringLimit)
|
||||||
self.putValue(data, 'latin1', elided=elided)
|
self.putValue(data, 'latin1', elided=elided)
|
||||||
@@ -1455,7 +1454,7 @@ class DumperBase():
|
|||||||
# Offset of objectName in QObjectPrivate: 5 pointer + 2 int
|
# Offset of objectName in QObjectPrivate: 5 pointer + 2 int
|
||||||
# - [QObjectData base]
|
# - [QObjectData base]
|
||||||
# - QString objectName
|
# - QString objectName
|
||||||
objectName = self.extractPointer(dd + 5 * ptrSize + 2 * intSize)
|
objectNameAddress = dd + 5 * ptrSize + 2 * intSize
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Size of QObjectData: 5 pointer + 2 int
|
# Size of QObjectData: 5 pointer + 2 int
|
||||||
@@ -1477,9 +1476,9 @@ class DumperBase():
|
|||||||
# - QVector<int> runningTimers;
|
# - QVector<int> runningTimers;
|
||||||
# - QList<QPointer<QObject> > eventFilters;
|
# - QList<QPointer<QObject> > eventFilters;
|
||||||
# - QString objectName
|
# - QString objectName
|
||||||
objectName = self.extractPointer(extra + 5 * ptrSize)
|
objectNameAddress = extra + 5 * ptrSize
|
||||||
|
|
||||||
data, size, alloc = self.qArrayDataHelper(objectName)
|
data, size, alloc = self.qArrayData(objectNameAddress)
|
||||||
|
|
||||||
# Object names are short, and GDB can crash on to big chunks.
|
# Object names are short, and GDB can crash on to big chunks.
|
||||||
# Since this here is a convenience feature only, limit it.
|
# Since this here is a convenience feature only, limit it.
|
||||||
|
@@ -3170,12 +3170,12 @@ def qdump__qfloat16(d, value):
|
|||||||
def qdumpHelper_QCbor_string(d, container_ptr, element_index, is_bytes):
|
def qdumpHelper_QCbor_string(d, container_ptr, element_index, is_bytes):
|
||||||
# d.split('i@{QByteArray::size_type}pp', container_ptr) doesn't work with CDB, so be explicit:
|
# d.split('i@{QByteArray::size_type}pp', container_ptr) doesn't work with CDB, so be explicit:
|
||||||
offset = 2 * d.ptrSize() if d.qtVersion() >= 0x060000 else 8
|
offset = 2 * d.ptrSize() if d.qtVersion() >= 0x060000 else 8
|
||||||
data_d_ptr, elements_d_ptr = d.split('pp', container_ptr + offset)
|
_, elements_d_ptr = d.split('pp', container_ptr + offset)
|
||||||
elements_data_ptr, elements_size, _ = d.vectorDataHelper(elements_d_ptr)
|
elements_data_ptr, elements_size, _ = d.vectorDataHelper(elements_d_ptr)
|
||||||
element_at_n_addr = elements_data_ptr + element_index * 16 # sizeof(QtCbor::Element) == 15
|
element_at_n_addr = elements_data_ptr + element_index * 16 # sizeof(QtCbor::Element) == 15
|
||||||
element_value, _, element_flags = d.split('qII', element_at_n_addr)
|
element_value, _, element_flags = d.split('qII', element_at_n_addr)
|
||||||
enc = 'latin1' if is_bytes or (element_flags & 8) else 'utf16'
|
enc = 'latin1' if is_bytes or (element_flags & 8) else 'utf16'
|
||||||
bytedata, _, _ = d.qArrayDataHelper(data_d_ptr)
|
bytedata, _, _ = d.qArrayData(container_ptr + offset)
|
||||||
bytedata += element_value
|
bytedata += element_value
|
||||||
if d.qtVersion() >= 0x060000:
|
if d.qtVersion() >= 0x060000:
|
||||||
bytedata_len = d.extractInt64(bytedata)
|
bytedata_len = d.extractInt64(bytedata)
|
||||||
@@ -3206,11 +3206,11 @@ def qdumpHelper_QCbor_array(d, container_ptr, is_cbor):
|
|||||||
return
|
return
|
||||||
# d.split('i@{QByteArray::size_type}pp', container_ptr) doesn't work with CDB, so be explicit:
|
# d.split('i@{QByteArray::size_type}pp', container_ptr) doesn't work with CDB, so be explicit:
|
||||||
offset = 2 * d.ptrSize() if d.qtVersion() >= 0x060000 else 8
|
offset = 2 * d.ptrSize() if d.qtVersion() >= 0x060000 else 8
|
||||||
data_d_ptr, elements_d_ptr = d.split('pp', container_ptr + offset)
|
_, elements_d_ptr = d.split('pp', container_ptr + offset)
|
||||||
elements_data_ptr, elements_size, _ = d.vectorDataHelper(elements_d_ptr)
|
elements_data_ptr, elements_size, _ = d.vectorDataHelper(elements_d_ptr)
|
||||||
d.putItemCount(elements_size)
|
d.putItemCount(elements_size)
|
||||||
if d.isExpanded():
|
if d.isExpanded():
|
||||||
bytedata, _, _ = d.qArrayDataHelper(data_d_ptr)
|
bytedata, _, _ = d.qArrayData(container_ptr + offset)
|
||||||
with Children(d, maxNumChild=1000):
|
with Children(d, maxNumChild=1000):
|
||||||
for i in range(elements_size):
|
for i in range(elements_size):
|
||||||
d.putSubItem(i, qdumpHelper_QCborArray_valueAt(d, container_ptr, elements_data_ptr, i, bytedata, is_cbor))
|
d.putSubItem(i, qdumpHelper_QCborArray_valueAt(d, container_ptr, elements_data_ptr, i, bytedata, is_cbor))
|
||||||
|
Reference in New Issue
Block a user