[Lldb-commits] [PATCH] D135827: [lldb] Print newline between found types

Arthur Eubanks via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 12 16:19:57 PDT 2022


aeubanks created this revision.
Herald added a project: All.
aeubanks requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Or else multiple entries end up overlapping on the same line.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D135827

Files:
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/test/API/lang/cpp/type_lookup_duplicate/Makefile
  lldb/test/API/lang/cpp/type_lookup_duplicate/TestCppTypeLookupDuplicate.py
  lldb/test/API/lang/cpp/type_lookup_duplicate/main.cpp


Index: lldb/test/API/lang/cpp/type_lookup_duplicate/main.cpp
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/type_lookup_duplicate/main.cpp
@@ -0,0 +1,13 @@
+namespace a {
+struct Foo {};
+} // namespace a
+
+namespace b {
+struct Foo {};
+} // namespace b
+
+int main() {
+  a::Foo a;
+  b::Foo b;
+  return 0; // Set breakpoint here
+}
Index: lldb/test/API/lang/cpp/type_lookup_duplicate/TestCppTypeLookupDuplicate.py
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/type_lookup_duplicate/TestCppTypeLookupDuplicate.py
@@ -0,0 +1,16 @@
+"""
+Test that we properly print multiple types.
+"""
+
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import decorators
+
+class TestTypeLookupDuplicate(TestBase):
+
+    def test_namespace_only(self):
+        self.build()
+        lldbutil.run_to_source_breakpoint(self, "// Set breakpoint here", lldb.SBFileSpec("main.cpp"))
+
+        self.expect("image lookup -A -t Foo", DATA_TYPES_DISPLAYED_CORRECTLY, substrs=["2 matches found", "\nid =", "\nid ="])
Index: lldb/test/API/lang/cpp/type_lookup_duplicate/Makefile
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/type_lookup_duplicate/Makefile
@@ -0,0 +1,2 @@
+CXX_SOURCES := main.cpp
+include Makefile.rules
Index: lldb/source/Commands/CommandObjectTarget.cpp
===================================================================
--- lldb/source/Commands/CommandObjectTarget.cpp
+++ lldb/source/Commands/CommandObjectTarget.cpp
@@ -1663,8 +1663,8 @@
         typedef_type_sp = typedefed_type_sp;
         typedefed_type_sp = typedef_type_sp->GetTypedefType();
       }
+      strm.EOL();
     }
-    strm.EOL();
   }
   return type_list.GetSize();
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135827.467292.patch
Type: text/x-patch
Size: 1896 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221012/37f40ac4/attachment-0001.bin>


More information about the lldb-commits mailing list