Commit 429a26b3 authored by hjk's avatar hjk
Browse files

Debugger: Fix std::vector<bool> dumper for LLDB



Change-Id: I83788acb6cfa9a659482d64bead10dd27e71fade
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 87fba660
......@@ -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)
......
......@@ -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")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment