forked from qt-creator/qt-creator
Dumper: Fix dump of std::string on macOS
Try to handle the alternate layout of strings correctly. Depending on the defines and the endianness the string structure may vary quite a bit. Old approach just took care of the default layout and the endianness. In case of an alternate layout of strings we failed so far. Fixes: QTCREATORBUG-26175 Done-with: Viktor Govako Change-Id: I788eb5619408bca281eb887c3f6a269808c27d24 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -776,7 +776,29 @@ def qdumpHelper__std__string__MSVC(d, value, charType, format):
|
||||
d.putCharArrayHelper(data, size, charType, format)
|
||||
|
||||
|
||||
def qdump__std____1__string__alternateLayoutHelper(d, value):
|
||||
try:
|
||||
_d = value['__s']['__data_'].address()
|
||||
alternateLayout = (_d - value.address()) == 0
|
||||
if alternateLayout:
|
||||
lastByte = value.split('b')[-1]
|
||||
if int(lastByte & 0x80) == 0:
|
||||
# Short/internal
|
||||
size = value['__s']['__size_'].integer()
|
||||
data = value.address()
|
||||
else:
|
||||
# Long/external
|
||||
(data, size, _) = value.split('ppp')
|
||||
return size, data
|
||||
else:
|
||||
return None, None
|
||||
except:
|
||||
return None, None
|
||||
|
||||
|
||||
def qdump__std____1__string(d, value):
|
||||
(size, data) = qdump__std____1__string__alternateLayoutHelper(d, value)
|
||||
if size is None or data is None:
|
||||
firstByte = value.split('b')[0]
|
||||
if int(firstByte & 1) == 0:
|
||||
# Short/internal.
|
||||
@@ -784,12 +806,15 @@ def qdump__std____1__string(d, value):
|
||||
data = value.address() + 1
|
||||
else:
|
||||
# Long/external.
|
||||
(dummy, size, data) = value.split('ppp')
|
||||
(_, size, data) = value.split('ppp')
|
||||
|
||||
d.putCharArrayHelper(data, size, d.charType(), d.currentItemFormat())
|
||||
d.putType("std::string")
|
||||
|
||||
|
||||
def qdump__std____1__wstring(d, value):
|
||||
(size, data) = qdump__std____1__string__alternateLayoutHelper(d, value)
|
||||
if size is None or data is None:
|
||||
firstByte = value.split('b')[0]
|
||||
if int(firstByte & 1) == 0:
|
||||
# Short/internal.
|
||||
@@ -797,7 +822,8 @@ def qdump__std____1__wstring(d, value):
|
||||
data = value.address() + 4
|
||||
else:
|
||||
# Long/external.
|
||||
(dummy, size, data) = value.split('ppp')
|
||||
(_, size, data) = value.split('ppp')
|
||||
|
||||
d.putCharArrayHelper(data, size, d.createType('wchar_t'))
|
||||
d.putType("std::wstring")
|
||||
|
||||
|
Reference in New Issue
Block a user