aboutsummaryrefslogtreecommitdiffstats
path: root/share/qtcreator/debugger
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2019-06-21 10:25:23 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2019-06-26 13:40:13 +0000
commitaedc0ca91bd1bc0ad9a3e411f8c9996250e14d61 (patch)
tree18596cea95fc0b2cf5260f783d5ef991e1a8b757 /share/qtcreator/debugger
parent98d7b502caf8d0976a116c5d798be00cfb95e373 (diff)
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>
Diffstat (limited to 'share/qtcreator/debugger')
-rw-r--r--share/qtcreator/debugger/stdtypes.py61
1 files changed, 19 insertions, 42 deletions
diff --git a/share/qtcreator/debugger/stdtypes.py b/share/qtcreator/debugger/stdtypes.py
index b0b6899563..3dfbe5bd8b 100644
--- a/share/qtcreator/debugger/stdtypes.py
+++ b/share/qtcreator/debugger/stdtypes.py
@@ -953,43 +953,27 @@ def qdumpHelper__std__vector(d, value, isLibCpp):
innerType = value.type[0]
isBool = innerType.name == 'bool'
- try:
- allocator = value.type[1].name
- except:
- allocator = ''
-
- isStdAllocator = allocator == 'std::allocator<%s>' % innerType.name
-
if isBool:
if isLibCpp:
- if isStdAllocator:
- (start, size) = value.split("pp") # start is 'unsigned long *'
- else:
- start = value["__begin_"].pointer()
- size = value["__size_"]
+ start = value["__begin_"].pointer()
+ size = value["__size_"]
alloc = size
else:
- if isStdAllocator:
- (start, soffset, pad, finish, foffset, pad, alloc) = value.split("pI@pI@p")
- else:
- start = value["_M_start"]["_M_p"].pointer()
- soffset = value["_M_start"]["_M_offset"].integer()
- finish = value["_M_finish"]["_M_p"].pointer()
- foffset = value["_M_finish"]["_M_offset"].integer()
- alloc = value["_M_end_of_storage"].pointer()
+ start = value["_M_start"]["_M_p"].pointer()
+ soffset = value["_M_start"]["_M_offset"].integer()
+ finish = value["_M_finish"]["_M_p"].pointer()
+ foffset = value["_M_finish"]["_M_offset"].integer()
+ alloc = value["_M_end_of_storage"].pointer()
size = (finish - start) * 8 + foffset - soffset # 8 is CHAR_BIT.
else:
- if isStdAllocator:
- (start, finish, alloc) = value.split("ppp")
+ if isLibCpp:
+ start = value["__begin_"].pointer()
+ finish = value["__end_"].pointer()
+ alloc = value["__end_cap_"].pointer()
else:
- if isLibCpp:
- start = value["__begin_"].pointer()
- finish = value["__end_"].pointer()
- alloc = value["__end_cap_"].pointer()
- else:
- start = value["_M_start"].pointer()
- finish = value["_M_finish"].pointer()
- alloc = value["_M_end_of_storage"].pointer()
+ start = value["_M_start"].pointer()
+ finish = value["_M_finish"].pointer()
+ alloc = value["_M_end_of_storage"].pointer()
size = int((finish - start) / innerType.size())
d.check(finish <= alloc)
if size > 0:
@@ -1088,19 +1072,12 @@ def qdump__std__basic_string(d, value):
def qdump__std____cxx11__basic_string(d, value):
innerType = value.type[0]
try:
- allocator = value.type[2].name
+ data = value["_M_dataplus"]["_M_p"].pointer()
+ size = int(value["_M_string_length"])
except:
- allocator = ''
- if allocator == 'std::allocator<%s>' % innerType.name:
- (data, size) = value.split("pI")
- else:
- try:
- data = value["_M_dataplus"]["_M_p"].pointer()
- size = int(value["_M_string_length"])
- except:
- d.putEmptyValue()
- d.putPlainChildren(value)
- return
+ d.putEmptyValue()
+ d.putPlainChildren(value)
+ return
d.check(0 <= size) #and size <= alloc and alloc <= 100*1000*1000)
d.putCharArrayHelper(data, size, innerType, d.currentItemFormat())