[Lldb-commits] [lldb] df1bb2e - Restrict the test from 22667e3220de5ead353a2148265d841644b63824

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 1 18:45:53 PDT 2023


Author: Jim Ingham
Date: 2023-06-01T18:45:45-07:00
New Revision: df1bb2e65bf4b2ca1140f4c9d19ff2a36ab94e6e

URL: https://github.com/llvm/llvm-project/commit/df1bb2e65bf4b2ca1140f4c9d19ff2a36ab94e6e
DIFF: https://github.com/llvm/llvm-project/commit/df1bb2e65bf4b2ca1140f4c9d19ff2a36ab94e6e.diff

LOG: Restrict the test from 22667e3220de5ead353a2148265d841644b63824

I fixed some long-standing failures in SBTarget::FindGlobalVariables
but the fix is in the the accelerator table lookups.  I fixed it in
the DWARF mappable tables but not everyone uses those, so I had to
restrict the test to systems I know did.

Added: 
    

Modified: 
    lldb/test/API/lang/cpp/class_static/TestStaticVariables.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/lang/cpp/class_static/TestStaticVariables.py b/lldb/test/API/lang/cpp/class_static/TestStaticVariables.py
index 6fd4a8c9b301..c7e38feeb13c 100644
--- a/lldb/test/API/lang/cpp/class_static/TestStaticVariables.py
+++ b/lldb/test/API/lang/cpp/class_static/TestStaticVariables.py
@@ -128,7 +128,7 @@ def build_value_check(self, var_name, values):
     )
     @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
     @add_test_categories(["pyapi"])
-    def test_with_python_api(self):
+    def test_with_python_FindValue(self):
         """Test Python APIs on file and class static variables."""
         self.build()
         exe = self.getBuildArtifact("a.out")
@@ -194,6 +194,44 @@ def test_with_python_api(self):
         self.DebugSBValue(val)
         self.assertEqual(val.GetName(), "hello_world")
 
+    # This test tests behavior that's been broken for a very long time..
+    # The fix for it is in the accelerator table part of the DWARF reader,
+    # and I fixed the version that the names accelerator uses, but I don't
+    # know how to fix it on systems that don't use that. There isn't a
+    # decorator for that - not sure how to construct that so I'm limiting the
+    # test do Darwin for now.
+    @expectedFailureAll(
+        compiler=["gcc"], bugnumber="Compiler emits incomplete debug info"
+    )
+    @skipUnlessDarwin
+    @add_test_categories(["pyapi"])
+    def test_with_python_FindGlobalVariables(self):
+        """Test Python APIs on file and class static variables."""
+        self.build()
+        exe = self.getBuildArtifact("a.out")
+
+        target = self.dbg.CreateTarget(exe)
+        self.assertTrue(target, VALID_TARGET)
+
+        breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line)
+        self.assertTrue(breakpoint, VALID_BREAKPOINT)
+
+        # Now launch the process, and do not stop at entry point.
+        process = target.LaunchSimple(None, None, self.get_process_working_directory())
+        self.assertTrue(process, PROCESS_IS_VALID)
+
+        # The stop reason of the thread should be breakpoint.
+        thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+        self.assertIsNotNone(thread)
+
+        # Get the SBValue of 'A::g_points' and 'g_points'.
+        frame = thread.GetFrameAtIndex(0)
+
+        # Build ValueCheckers for the values we're going to find:
+        value_check_A = self.build_value_check("A::g_points", ["1", "2", "11", "22"])
+        value_check_none = self.build_value_check("g_points", ["3", "4", "33", "44"])
+        value_check_AA = self.build_value_check("AA::g_points", ["5", "6", "55", "66"])
+
         # We should also be able to get class statics from FindGlobalVariables.
         # eMatchTypeStartsWith should only find A:: not AA::
         val_list = target.FindGlobalVariables("A::", 10, lldb.eMatchTypeStartsWith)
@@ -227,3 +265,4 @@ def test_with_python_api(self):
         # between file statics and globals:
         val_list = target.FindGlobalVariables("g_points", 10, lldb.eMatchTypeNormal)
         self.assertEqual(val_list.GetSize(), 3, "Found all three g_points")
+        


        


More information about the lldb-commits mailing list