[Lldb-commits] [PATCH] D43419: Fix TestBreakpointInGlobalConstructor for Windows

Adrian McCarthy via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 20 12:01:59 PST 2018


amccarth updated this revision to Diff 135120.
amccarth added a comment.

Added new special value to accommodate the fact that Windows may postpone resolving the breakpoints for DLLs that aren't yet loaded.


https://reviews.llvm.org/D43419

Files:
  lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py
  lldb/packages/Python/lldbsuite/test/lldbutil.py


Index: lldb/packages/Python/lldbsuite/test/lldbutil.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -343,7 +343,7 @@
 
     If extra_options is not None, then we append it to the breakpoint set command.
 
-    If num_expected_locations is -1 we check that we got AT LEAST one location, otherwise we check that num_expected_locations equals the number of locations.
+    If num_expected_locations is -1, we check that we got AT LEAST one location. If num_expected_locations is -2, we check that we got AT LEAST one location on platforms other than Windows. Otherwise, we check that num_expected_locations equals the number of locations.
 
     If loc_exact is true, we check that there is one location, and that location must be at the input file and line number."""
 
@@ -563,6 +563,12 @@
     if num_locations == -1:
         test.assertTrue(out_num_locations > 0,
                         "Expecting one or more locations, got none.")
+    elif num_locations == -2:
+        # On Windows, breakpoints may remain pending until a DLL is loaded,
+        # so we allow zero. Other platforms expect at least one.
+        if test.getPlatform() != "windows":
+          test.assertTrue(out_num_locations > 0,
+                          "Expecting one or more locations, got none.")
     else:
         test.assertTrue(
             num_locations == out_num_locations,
Index: lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py
@@ -29,8 +29,9 @@
 
         bp_main = lldbutil.run_break_set_by_file_and_line(
             self, 'main.cpp', self.line_main)
+
         bp_foo = lldbutil.run_break_set_by_file_and_line(
-            self, 'foo.cpp', self.line_foo)
+            self, 'foo.cpp', self.line_foo, num_expected_locations=-2)
 
         process = target.LaunchSimple(
             None, env, self.get_process_working_directory())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43419.135120.patch
Type: text/x-patch
Size: 2344 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180220/3c396436/attachment.bin>


More information about the lldb-commits mailing list