diff --git a/share/qtcreator/gdbmacros/gdbmacros.py b/share/qtcreator/gdbmacros/gdbmacros.py
index 0fc61afb2d18e2393abb187325056a1c2b96c418..14596df593a848e078e7e684d2a3198b7890ea5c 100644
--- a/share/qtcreator/gdbmacros/gdbmacros.py
+++ b/share/qtcreator/gdbmacros/gdbmacros.py
@@ -1923,6 +1923,8 @@ def qdump__std__set(d, item):
 def qdump__std__string(d, item):
     data = item.value["_M_dataplus"]["_M_p"]
     baseType = item.value.type.unqualified().strip_typedefs()
+    if baseType.code == gdb.TYPE_CODE_REF:
+        baseType = baseType.target().unqualified().strip_typedefs()
     charType = baseType.template_argument(0)
     repType = lookupType("%s::_Rep" % baseType).pointer()
     rep = (data.cast(repType) - 1).dereference()