diff --git a/share/qtcreator/debugger/stdtypes.py b/share/qtcreator/debugger/stdtypes.py index 588187e494a1859fe86f5ab01b44ac7388248d99..973ecbd62953fa7603d3f0e9504c6d2b0ebee6b0 100644 --- a/share/qtcreator/debugger/stdtypes.py +++ b/share/qtcreator/debugger/stdtypes.py @@ -513,16 +513,17 @@ def qdump__std__vector(d, value): impl = value["_M_impl"] type = d.templateArgument(value.type, 0) alloc = impl["_M_end_of_storage"] - isBool = str(type) == 'bool' + # The allocator case below is bogus, but that's what Apple + # LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn) + # produces. + isBool = str(type) == 'bool' or str(type) == 'std::allocator<bool>' if isBool: start = impl["_M_start"]["_M_p"] finish = impl["_M_finish"]["_M_p"] # FIXME: 8 is CHAR_BIT - storage = d.lookupType("unsigned long") - storagesize = storage.sizeof * 8 - size = (finish - start) * storagesize - size += impl["_M_finish"]["_M_offset"] - size -= impl["_M_start"]["_M_offset"] + size = (int(finish) - int(start)) * 8 + size += int(impl["_M_finish"]["_M_offset"]) + size -= int(impl["_M_start"]["_M_offset"]) else: start = impl["_M_start"] finish = impl["_M_finish"] @@ -541,7 +542,8 @@ def qdump__std__vector(d, value): with Children(d, size, maxNumChild=10000, childType=type): for i in d.childRange(): q = start + int(i / storagesize) - d.putBoolItem(str(i), (q.dereference() >> (i % storagesize)) & 1) + d.putBoolItem(str(i), + (int(q.dereference()) >> (i % storagesize)) & 1) else: d.putArrayData(type, start, size) diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index b48602e7f642ecfc4ec91c353eed4b02b55697bc..90dbab7af1eda499947d263caad3a92a481e9c7e 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -3115,6 +3115,7 @@ void tst_Dumpers::dumper_data() "v.push_back(true);\n" "v.push_back(false);\n" "unused(&v);\n") + // Known issue: Clang produces "std::vector<std::allocator<bool>> % Check("v", "<5 items>", "std::vector<bool>") % Check("v.0", "[0]", "1", "bool") % Check("v.1", "[1]", "0", "bool")