summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2010-08-16 11:10:18 +0200
committerhjk <qtc-committer@nokia.com>2010-08-16 11:10:18 +0200
commit0ef1c56c368cfd8a0e1d5bb7e74d349941de71cc (patch)
tree39049201f406e6fd8b8632d550064cc2cfa121e1
parentf63649d37732bd86cc13dfe355910371be5ffefa (diff)
downloadqt-creator-0ef1c56c368cfd8a0e1d5bb7e74d349941de71cc.tar.gz
debugger: implement python dumper for std::vector<bool>
(cherry picked from commit 104751241d74dcdfe74d5abc131cf450c0828d8d) Conflicts: tests/manual/gdbdebugger/simple/app.cpp
-rw-r--r--share/qtcreator/gdbmacros/gdbmacros.py34
-rw-r--r--tests/manual/gdbdebugger/simple/app.cpp3
2 files changed, 29 insertions, 8 deletions
diff --git a/share/qtcreator/gdbmacros/gdbmacros.py b/share/qtcreator/gdbmacros/gdbmacros.py
index 4394e630af..93f8b47b27 100644
--- a/share/qtcreator/gdbmacros/gdbmacros.py
+++ b/share/qtcreator/gdbmacros/gdbmacros.py
@@ -1855,10 +1855,21 @@ def qdump__std__string(d, item):
def qdump__std__vector(d, item):
impl = item.value["_M_impl"]
- start = impl["_M_start"]
- finish = impl["_M_finish"]
+ type = item.value.type.template_argument(0)
alloc = impl["_M_end_of_storage"]
- size = finish - start
+ isBool = str(type) == 'bool'
+ if isBool:
+ start = impl["_M_start"]["_M_p"]
+ finish = impl["_M_finish"]["_M_p"]
+ # FIXME: 32 is sizeof(unsigned long) * CHAR_BIT
+ storagesize = 32
+ size = (finish - start) * storagesize
+ size += impl["_M_finish"]["_M_offset"]
+ size -= impl["_M_start"]["_M_offset"]
+ else:
+ start = impl["_M_start"]
+ finish = impl["_M_finish"]
+ size = finish - start
check(0 <= size and size <= 1000 * 1000 * 1000)
check(finish <= alloc)
@@ -1869,11 +1880,18 @@ def qdump__std__vector(d, item):
d.putItemCount(size)
d.putNumChild(size)
if d.isExpanded(item):
- with Children(d, [size, 10000], item.value.type.template_argument(0)):
- p = start
- for i in d.childRange():
- d.putItem(Item(p.dereference(), item.iname, i))
- p += 1
+ if isBool:
+ with Children(d, [size, 10000], type):
+ for i in d.childRange():
+ q = start + i / storagesize
+ data = (q.dereference() >> (i % storagesize)) & 1
+ d.putBoolItem(str(i), select(data, "true", "false"))
+ else:
+ with Children(d, [size, 10000], type):
+ p = start
+ for i in d.childRange():
+ d.putItem(Item(p.dereference(), item.iname, i))
+ p += 1
def qdump__string(d, item):
diff --git a/tests/manual/gdbdebugger/simple/app.cpp b/tests/manual/gdbdebugger/simple/app.cpp
index 464e18b736..a165442671 100644
--- a/tests/manual/gdbdebugger/simple/app.cpp
+++ b/tests/manual/gdbdebugger/simple/app.cpp
@@ -1119,6 +1119,9 @@ void testStdVector()
std::vector<bool> vec;
vec.push_back(true);
vec.push_back(false);
+ vec.push_back(false);
+ vec.push_back(true);
+ vec.push_back(false);
}
void testQStandardItemModel()