[Lldb-commits] [PATCH] D137983: [lldb] Disable looking at pointee types to find synthetic value for non-ObjC
Arthur Eubanks via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Nov 17 11:45:42 PST 2022
aeubanks updated this revision to Diff 476199.
aeubanks added a comment.
add test
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137983/new/
https://reviews.llvm.org/D137983
Files:
lldb/source/Core/ValueObject.cpp
lldb/test/API/lang/cpp/incomplete-stl-types/Makefile
lldb/test/API/lang/cpp/incomplete-stl-types/TestStlIncompleteTypes.py
lldb/test/API/lang/cpp/incomplete-stl-types/f.cpp
lldb/test/API/lang/cpp/incomplete-stl-types/main.cpp
Index: lldb/test/API/lang/cpp/incomplete-stl-types/main.cpp
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/incomplete-stl-types/main.cpp
@@ -0,0 +1,8 @@
+#include <set>
+
+void f(std::set<int> &v);
+
+int main() {
+ std::set<int> v;
+ f(v);
+}
Index: lldb/test/API/lang/cpp/incomplete-stl-types/f.cpp
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/incomplete-stl-types/f.cpp
@@ -0,0 +1,5 @@
+#include <set>
+
+void f(std::set<int> &v) {
+ // break here
+}
Index: lldb/test/API/lang/cpp/incomplete-stl-types/TestStlIncompleteTypes.py
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/incomplete-stl-types/TestStlIncompleteTypes.py
@@ -0,0 +1,18 @@
+"""
+Test situations where the debug info only has a declaration, no definition, for
+an STL container with a formatter.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestStlIncompleteTypes(TestBase):
+ def test(self):
+ self.build()
+ lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("f.cpp"))
+
+ var = self.frame().GetValueForVariablePath("v")
+ self.assertIn("set", var.GetDisplayTypeName())
Index: lldb/test/API/lang/cpp/incomplete-stl-types/Makefile
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/incomplete-stl-types/Makefile
@@ -0,0 +1,9 @@
+CXX_SOURCES := main.cpp f.cpp
+
+include Makefile.rules
+
+# Force main.cpp to be built with no debug information
+main.o: CFLAGS = $(CFLAGS_NO_DEBUG)
+
+# And force -flimit-debug-info on the rest.
+f.o: CFLAGS_EXTRAS += $(LIMIT_DEBUG_INFO_FLAGS)
Index: lldb/source/Core/ValueObject.cpp
===================================================================
--- lldb/source/Core/ValueObject.cpp
+++ lldb/source/Core/ValueObject.cpp
@@ -2673,7 +2673,10 @@
// In case of incomplete child compiler type, use the pointee type and try
// to recreate a new ValueObjectChild using it.
if (!m_deref_valobj) {
- if (HasSyntheticValue()) {
+ // FIXME(#59012): C++ stdlib formatters break with incomplete types (e.g.
+ // `std::vector<int> &`). Remove ObjC restriction once that's resolved.
+ if (Language::LanguageIsObjC(GetPreferredDisplayLanguage()) &&
+ HasSyntheticValue()) {
child_compiler_type = compiler_type.GetPointeeType();
if (child_compiler_type) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137983.476199.patch
Type: text/x-patch
Size: 2615 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221117/f6417dc7/attachment-0001.bin>
More information about the lldb-commits
mailing list