diff --git a/share/qtcreator/gdbmacros/gdbmacros.py b/share/qtcreator/gdbmacros/gdbmacros.py
index c1f74a77c3dfc9aadd480e6343491a12ca968e2d..f6b05a6adcb88d1cf9e75e2baaf7c800124b6e12 100644
--- a/share/qtcreator/gdbmacros/gdbmacros.py
+++ b/share/qtcreator/gdbmacros/gdbmacros.py
@@ -1811,6 +1811,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()