forked from qt-creator/qt-creator
Pretty printers: Unify code for different allocators
The code path for allocators other than 'std::allocator' does work for 'std::allocator' as well, so unify this. This also fixes the case of std containers when 'std::allocator' is used and the compiler flag '-D_GLIBCXX_DEBUG' in place which results in size assumptions that were made in the now dropped path to not be fulfilled, thus leading to an incorrect display. Fixes: QTCREATORBUG-22606 Change-Id: I2b6f8ac9933b210d26197975017292e2fc227541 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -953,24 +953,11 @@ def qdumpHelper__std__vector(d, value, isLibCpp):
|
|||||||
innerType = value.type[0]
|
innerType = value.type[0]
|
||||||
isBool = innerType.name == 'bool'
|
isBool = innerType.name == 'bool'
|
||||||
|
|
||||||
try:
|
|
||||||
allocator = value.type[1].name
|
|
||||||
except:
|
|
||||||
allocator = ''
|
|
||||||
|
|
||||||
isStdAllocator = allocator == 'std::allocator<%s>' % innerType.name
|
|
||||||
|
|
||||||
if isBool:
|
if isBool:
|
||||||
if isLibCpp:
|
if isLibCpp:
|
||||||
if isStdAllocator:
|
|
||||||
(start, size) = value.split("pp") # start is 'unsigned long *'
|
|
||||||
else:
|
|
||||||
start = value["__begin_"].pointer()
|
start = value["__begin_"].pointer()
|
||||||
size = value["__size_"]
|
size = value["__size_"]
|
||||||
alloc = size
|
alloc = size
|
||||||
else:
|
|
||||||
if isStdAllocator:
|
|
||||||
(start, soffset, pad, finish, foffset, pad, alloc) = value.split("pI@pI@p")
|
|
||||||
else:
|
else:
|
||||||
start = value["_M_start"]["_M_p"].pointer()
|
start = value["_M_start"]["_M_p"].pointer()
|
||||||
soffset = value["_M_start"]["_M_offset"].integer()
|
soffset = value["_M_start"]["_M_offset"].integer()
|
||||||
@@ -978,9 +965,6 @@ def qdumpHelper__std__vector(d, value, isLibCpp):
|
|||||||
foffset = value["_M_finish"]["_M_offset"].integer()
|
foffset = value["_M_finish"]["_M_offset"].integer()
|
||||||
alloc = value["_M_end_of_storage"].pointer()
|
alloc = value["_M_end_of_storage"].pointer()
|
||||||
size = (finish - start) * 8 + foffset - soffset # 8 is CHAR_BIT.
|
size = (finish - start) * 8 + foffset - soffset # 8 is CHAR_BIT.
|
||||||
else:
|
|
||||||
if isStdAllocator:
|
|
||||||
(start, finish, alloc) = value.split("ppp")
|
|
||||||
else:
|
else:
|
||||||
if isLibCpp:
|
if isLibCpp:
|
||||||
start = value["__begin_"].pointer()
|
start = value["__begin_"].pointer()
|
||||||
@@ -1087,13 +1071,6 @@ def qdump__std__basic_string(d, value):
|
|||||||
|
|
||||||
def qdump__std____cxx11__basic_string(d, value):
|
def qdump__std____cxx11__basic_string(d, value):
|
||||||
innerType = value.type[0]
|
innerType = value.type[0]
|
||||||
try:
|
|
||||||
allocator = value.type[2].name
|
|
||||||
except:
|
|
||||||
allocator = ''
|
|
||||||
if allocator == 'std::allocator<%s>' % innerType.name:
|
|
||||||
(data, size) = value.split("pI")
|
|
||||||
else:
|
|
||||||
try:
|
try:
|
||||||
data = value["_M_dataplus"]["_M_p"].pointer()
|
data = value["_M_dataplus"]["_M_p"].pointer()
|
||||||
size = int(value["_M_string_length"])
|
size = int(value["_M_string_length"])
|
||||||
|
Reference in New Issue
Block a user