diff --git a/share/qtcreator/gdbmacros/gdbmacros.py b/share/qtcreator/gdbmacros/gdbmacros.py index f4546553d255ff218b0a710599f186c5bf8f8775..2ca413c4b855aad954efbad2ba40f458cb468cad 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.py +++ b/share/qtcreator/gdbmacros/gdbmacros.py @@ -1856,6 +1856,30 @@ def qdump__wstring(d, item): qdump__std__string(d, item) +def qdump____gnu_cxx__hash_set(d, item): + ht = item.value["_M_ht"] + size = ht["_M_num_elements"] + d.putItemCount(size) + d.putNumChild(size) + type = item.value.type.template_argument(0) + d.putType("__gnu__cxx::hash_set<%s>" % type) + if d.isExpanded(item): + with Children(d, [size, 1000], type): + buckets = ht["_M_buckets"]["_M_impl"] + bucketStart = buckets["_M_start"] + bucketFinish = buckets["_M_finish"] + p = bucketStart + itemCount = 0 + for i in xrange(bucketFinish - bucketStart): + if not isNull(p.dereference()): + cur = p.dereference() + while not isNull(cur): + with SubItem(d): + d.putValue(cur["_M_val"]) + cur = cur["_M_next"] + itemCount += 1 + p = p + 1 + ####################################################################### # # Symbian diff --git a/tests/manual/gdbdebugger/simple/app.cpp b/tests/manual/gdbdebugger/simple/app.cpp index 3e2dca87c5823f943ac6c25bb097b81e9ebd89de..9bf48786c151f7a90b8d28f021b55bdbe3790f86 100644 --- a/tests/manual/gdbdebugger/simple/app.cpp +++ b/tests/manual/gdbdebugger/simple/app.cpp @@ -71,6 +71,11 @@ #include <string> #include <vector> +#define USE_GCC_EXT 1 +#if USE_GCC_EXT +#include <hash_set> +#endif + #ifdef Q_OS_WIN #include <windows.h> #undef min @@ -888,6 +893,20 @@ void testStdDeque() flist.push_front(2); } +void testStdHashSet() +{ +#if USE_GCC_EXT + using namespace __gnu_cxx; + hash_set<int> h; + h.insert(1); + h.insert(194); + h.insert(2); + h.insert(3); + h.insert(4); + h.insert(5); +#endif +} + void testStdList() { std::list<int> big; @@ -1606,6 +1625,7 @@ int main(int argc, char *argv[]) testStdDeque(); testStdList(); + testStdHashSet(); testStdMap(); testStdSet(); testStdStack();