From 3ef657cc030b26bb5b82c3ceca4d6de04eb6e518 Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Wed, 25 Aug 2010 14:56:45 +0200 Subject: [PATCH] debugger: make boost::optional dumper work for references --- share/qtcreator/gdbmacros/gdbmacros.py | 7 ++++++- tests/manual/gdbdebugger/boost/main.cpp | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/share/qtcreator/gdbmacros/gdbmacros.py b/share/qtcreator/gdbmacros/gdbmacros.py index 5be49f63898..7e03f5b2ab1 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.py +++ b/share/qtcreator/gdbmacros/gdbmacros.py @@ -2080,7 +2080,12 @@ def qdump__boost__optional(d, item): else: d.putType(item.value.type, d.currentTypePriority + 1) type = item.value.type.template_argument(0) - d.putItemHelper(Item(item.value["m_storage"].cast(type), item.iname)) + storage = item.value["m_storage"] + if type.code == gdb.TYPE_CODE_REF: + value = storage.cast(type.target().pointer()).dereference() + else: + value = storage.cast(type) + d.putItemHelper(Item(value, item.iname)) ####################################################################### diff --git a/tests/manual/gdbdebugger/boost/main.cpp b/tests/manual/gdbdebugger/boost/main.cpp index b012bf07940..ada9697e32b 100644 --- a/tests/manual/gdbdebugger/boost/main.cpp +++ b/tests/manual/gdbdebugger/boost/main.cpp @@ -1,5 +1,6 @@ #include <boost/optional.hpp> +#include <string> using namespace boost; @@ -19,7 +20,10 @@ void testOptional() optional<int> i; optional<double> d; optional<Large> l; + optional<std::string &> sr; + std::string as = "hallo"; i = 1; + sr = as; l = Large(); i = 2; i = 3; -- GitLab