Dumper: Fix size of refcount member in basic_string

It's an int. Still, the position is 3 pointer-sizes back due to padding
(the next member after this struct is the char pointer).

The pointer-size + bitwise stripping of the LSB probably doesn't work
on big-endian archs.

Change-Id: I4413d9b32986d1ea0be9abe1be4382ee36a9456c
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Orgad Shaneh
2020-08-25 22:08:35 +03:00
committed by Orgad Shaneh
parent cef1297504
commit 53c763029b

View File

@@ -707,8 +707,7 @@ def qdumpHelper_std__string(d, value, charType, format):
# We can't lookup the std::string::_Rep type without crashing LLDB,
# so hard-code assumption on member position
# struct { size_type _M_length, size_type _M_capacity, int _M_refcount; }
(size, alloc, refcount) = d.split("ppp", data - 3 * d.ptrSize())
refcount = refcount & 0xffffffff
(size, alloc, refcount) = d.split("ppi", data - 3 * d.ptrSize())
d.check(refcount >= -1) # Can be -1 according to docs.
d.check(0 <= size and size <= alloc and alloc <= 100 * 1000 * 1000)
d.putCharArrayHelper(data, size, charType, format)