[Lldb-commits] [lldb] 9f0b5f9 - [lldb/test] Added lldbutil function to test a breakpoint

SYNOPSYSgeorgiev via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 17 00:38:31 PST 2021


Author: SYNOPSYS\georgiev
Date: 2021-11-17T08:37:30Z
New Revision: 9f0b5f9a39ea6e70c98c69a720d7e4f5d3800bf6

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

LOG: [lldb/test] Added lldbutil function to test a breakpoint

Testing the breakpoint itself rather than the lldb string.

Differential Revision: https://reviews.llvm.org/D111899

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/lldbutil.py
    lldb/test/API/commands/apropos/with-process/TestAproposWithProcess.py
    lldb/test/API/commands/command/nested_alias/TestNestedAlias.py
    lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
    lldb/test/API/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
    lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
    lldb/test/API/functionalities/dead-strip/TestDeadStrip.py
    lldb/test/API/functionalities/load_unload/TestLoadUnload.py
    lldb/test/API/functionalities/memory/cache/TestMemoryCache.py
    lldb/test/API/functionalities/memory/find/TestMemoryFind.py
    lldb/test/API/functionalities/memory/read/TestMemoryRead.py
    lldb/test/API/lang/c/anonymous/TestAnonymous.py
    lldb/test/API/lang/c/array_types/TestArrayTypes.py
    lldb/test/API/lang/c/conflicting-symbol/TestConflictingSymbol.py
    lldb/test/API/lang/c/const_variables/TestConstVariables.py
    lldb/test/API/lang/c/enum_types/TestEnumTypes.py
    lldb/test/API/lang/c/forward/TestForwardDeclaration.py
    lldb/test/API/lang/c/function_types/TestFunctionTypes.py
    lldb/test/API/lang/c/global_variables/TestGlobalVariables.py
    lldb/test/API/lang/c/local_variables/TestLocalVariables.py
    lldb/test/API/lang/c/modules/TestCModules.py
    lldb/test/API/lang/c/register_variables/TestRegisterVariables.py
    lldb/test/API/lang/c/set_values/TestSetValues.py
    lldb/test/API/lang/c/shared_lib/TestSharedLib.py
    lldb/test/API/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
    lldb/test/API/lang/cpp/class_types/TestClassTypes.py
    lldb/test/API/lang/cpp/inlines/TestInlines.py
    lldb/test/API/lang/cpp/namespace_definitions/TestNamespaceDefinitions.py
    lldb/test/API/lang/cpp/signed_types/TestSignedTypes.py
    lldb/test/API/lang/objc/conflicting-definition/TestConflictingDefinition.py
    lldb/test/API/lang/objc/forward-decl/TestForwardDecl.py
    lldb/test/API/lang/objc/hidden-ivars/TestHiddenIvars.py
    lldb/test/API/lang/objc/modules-auto-import/TestModulesAutoImport.py
    lldb/test/API/lang/objc/modules-incomplete/TestIncompleteModules.py
    lldb/test/API/lang/objc/modules/TestObjCModules.py
    lldb/test/API/lang/objc/objc-new-syntax/ObjCNewSyntaxTest.py
    lldb/test/API/lang/objc/real-definition/TestRealDefinition.py
    lldb/test/API/lang/objc/single-entry-dictionary/TestObjCSingleEntryDictionary.py

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py
index 2ab372d82b72d..c92626f5baed9 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -730,6 +730,57 @@ def check_breakpoint_result(
             (out_module_name,
              module_name))
 
+def check_breakpoint(
+            test,
+            bpno,
+            expected_locations = None,
+            expected_resolved_count = None,
+            expected_hit_count = None,
+            location_id = None,
+            expected_location_resolved = True,
+            expected_location_hit_count = None):
+    """
+    Test breakpoint or breakpoint location.
+    Breakpoint resolved count is always checked. If not specified the assumption is that all locations 
+    should be resolved. 
+    To test a breakpoint location, breakpoint number (bpno) and location_id must be set. In this case
+    the resolved count for a breakpoint is not tested by default. The location is expected to be resolved,
+    unless expected_location_resolved is set to False.
+    test - test context
+    bpno - breakpoint number to test
+    expected_locations - expected number of locations for this breakpoint. If 'None' this parameter is not tested.
+    expected_resolved_count - expected resolved locations number for the breakpoint.  If 'None' - all locations should be resolved.
+    expected_hit_count - expected hit count for this breakpoint. If 'None' this parameter is not tested.
+    location_id - If not 'None' sets the location ID for the breakpoint to test.
+    expected_location_resolved - Extected resolved status for the location_id (True/False). Default - True.
+    expected_location_hit_count - Expected hit count for the breakpoint at location_id. Must be set if the location_id parameter is set.
+    """
+    
+    bkpt = test.target().FindBreakpointByID(bpno)
+    test.assertTrue(bkpt.IsValid(), "Breakpoint is not valid.")
+
+    if expected_locations is not None:
+        test.assertEquals(expected_locations, bkpt.GetNumLocations())
+
+    if expected_resolved_count is not None:
+        test.assertEquals(expected_resolved_count, bkpt.GetNumResolvedLocations())
+    else:
+        expected_resolved_count = bkpt.GetNumLocations()
+        if location_id is None:
+            test.assertEquals(expected_resolved_count, bkpt.GetNumResolvedLocations())
+
+    if expected_hit_count is not None:
+        test.assertEquals(expected_hit_count, bkpt.GetHitCount())
+
+    if location_id is not None:
+        loc_bkpt = bkpt.FindLocationByID(location_id)
+        test.assertTrue(loc_bkpt.IsValid(), "Breakpoint location is not valid.")
+        test.assertEquals(loc_bkpt.IsResolved(), expected_location_resolved)
+        if expected_location_hit_count is not None:
+            test.assertEquals(expected_location_hit_count, loc_bkpt.GetHitCount())
+
+
+
 # ==================================================
 # Utility functions related to Threads and Processes
 # ==================================================

diff  --git a/lldb/test/API/commands/apropos/with-process/TestAproposWithProcess.py b/lldb/test/API/commands/apropos/with-process/TestAproposWithProcess.py
index 64eca718aea7a..e2cf10e667b85 100644
--- a/lldb/test/API/commands/apropos/with-process/TestAproposWithProcess.py
+++ b/lldb/test/API/commands/apropos/with-process/TestAproposWithProcess.py
@@ -37,7 +37,6 @@ def test_apropos_with_process(self):
                     substrs=['stopped', 'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         self.runCmd('apropos env')

diff  --git a/lldb/test/API/commands/command/nested_alias/TestNestedAlias.py b/lldb/test/API/commands/command/nested_alias/TestNestedAlias.py
index a1374a9c716ae..d4fc99492a698 100644
--- a/lldb/test/API/commands/command/nested_alias/TestNestedAlias.py
+++ b/lldb/test/API/commands/command/nested_alias/TestNestedAlias.py
@@ -37,8 +37,7 @@ def test_nested_alias(self):
                     substrs=['stopped', 'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # This is the function to remove the custom aliases in order to have a
         # clean slate for the next test case.

diff  --git a/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py b/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
index be2e1426d580a..508a8d9eec32b 100644
--- a/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
+++ b/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
@@ -242,8 +242,7 @@ def breakpoint_command_sequence(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 2.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_TWICE,
-                    substrs=['resolved, hit count = 2'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 2)
 
     def breakpoint_command_script_parameters(self):
         """Test that the frame and breakpoint location are being properly passed to the script breakpoint command function."""
@@ -264,7 +263,7 @@ def breakpoint_command_script_parameters(self):
 
         self.expect(side_effect.frame, exe=False, startstr="frame #0:")
         self.expect(side_effect.bp_loc, exe=False,
-                patterns=["1.* where = .*main .* resolved, hit count = 1"])
+                patterns=["1.* where = .*main .* resolved,( hardware,)? hit count = 1"])
 
     def breakpoint_commands_on_creation(self):
         """Test that setting breakpoint commands when creating the breakpoint works"""

diff  --git a/lldb/test/API/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py b/lldb/test/API/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
index ba5df2b7a18c3..b217538835a60 100644
--- a/lldb/test/API/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
+++ b/lldb/test/API/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
@@ -76,9 +76,7 @@ def breakpoint_ignore_count(self):
 
         # Also check the hit count, which should be 2, due to ignore count of
         # 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_THRICE,
-                    substrs=["resolved = 1",
-                             "hit count = 2"])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 2)
 
         # The frame #0 should correspond to main.c:37, the executable statement
         # in function name 'c'.  And frame #2 should point to main.c:45.
@@ -97,9 +95,7 @@ def breakpoint_ignore_count(self):
 
         # Also check the hit count, which should be 2, due to ignore count of
         # 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_THRICE,
-                    substrs=["resolved = 1",
-                             "hit count = 4"])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 4)
 
         # The frame #0 should correspond to main.c:37, the executable statement
         # in function name 'c'.  And frame #2 should point to main.c:45.

diff  --git a/lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py b/lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
index 70a7a01074caa..1fc96b3fb04d0 100644
--- a/lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
+++ b/lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
@@ -187,10 +187,7 @@ def breakpoint_locations_test(self):
 
         # At this point, 1.1 has a hit count of 0 and the other a hit count of
         # 1".
-        self.expect(
-            "breakpoint list -f",
-            "The breakpoints should report correct hit counts",
-            patterns=[
-                "1\.1: .+ unresolved, hit count = 0 +Options: disabled",
-                "1\.2: .+ resolved, hit count = 1",
-                "1\.3: .+ resolved, hit count = 1"])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_locations = 3, expected_resolved_count = 2, expected_hit_count = 2)
+        lldbutil.check_breakpoint(self, bpno = 1, location_id = 1,  expected_location_resolved = False, expected_location_hit_count = 0)
+        lldbutil.check_breakpoint(self, bpno = 1, location_id = 2, expected_location_resolved = True, expected_location_hit_count = 1)
+        lldbutil.check_breakpoint(self, bpno = 1, location_id = 3, expected_location_resolved = True, expected_location_hit_count = 1)

diff  --git a/lldb/test/API/functionalities/dead-strip/TestDeadStrip.py b/lldb/test/API/functionalities/dead-strip/TestDeadStrip.py
index bc1f3f8003f36..fc3e36e9233cf 100644
--- a/lldb/test/API/functionalities/dead-strip/TestDeadStrip.py
+++ b/lldb/test/API/functionalities/dead-strip/TestDeadStrip.py
@@ -42,8 +42,7 @@ def test(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f 1", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         self.runCmd("continue")
 
@@ -54,5 +53,4 @@ def test(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f 3", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 3, expected_hit_count = 1)

diff  --git a/lldb/test/API/functionalities/load_unload/TestLoadUnload.py b/lldb/test/API/functionalities/load_unload/TestLoadUnload.py
index 488a6922b231f..9f4a99dc69de5 100644
--- a/lldb/test/API/functionalities/load_unload/TestLoadUnload.py
+++ b/lldb/test/API/functionalities/load_unload/TestLoadUnload.py
@@ -316,8 +316,7 @@ def run_load_unload(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # Issue the 'continue' command.  We should stop agaian at a_function.
         # The stop reason of the thread should be breakpoint and at a_function.
@@ -331,8 +330,7 @@ def run_load_unload(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 2.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 2'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 2)
 
     def test_step_over_load(self):
         self.setSvr4Support(False)

diff  --git a/lldb/test/API/functionalities/memory/cache/TestMemoryCache.py b/lldb/test/API/functionalities/memory/cache/TestMemoryCache.py
index eb461ebfdf140..7eb5b05a56e10 100644
--- a/lldb/test/API/functionalities/memory/cache/TestMemoryCache.py
+++ b/lldb/test/API/functionalities/memory/cache/TestMemoryCache.py
@@ -38,8 +38,7 @@ def test_memory_cache(self):
                     substrs=['stopped', 'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # Read a chunk of memory containing &my_ints[0]. The number of bytes read
         # must be greater than m_L2_cache_line_byte_size to make sure the L1

diff  --git a/lldb/test/API/functionalities/memory/find/TestMemoryFind.py b/lldb/test/API/functionalities/memory/find/TestMemoryFind.py
index 66d43665dc7b0..70bb86c08d69f 100644
--- a/lldb/test/API/functionalities/memory/find/TestMemoryFind.py
+++ b/lldb/test/API/functionalities/memory/find/TestMemoryFind.py
@@ -37,8 +37,7 @@ def test_memory_find(self):
                     substrs=['stopped', 'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # Test the memory find commands.
 

diff  --git a/lldb/test/API/functionalities/memory/read/TestMemoryRead.py b/lldb/test/API/functionalities/memory/read/TestMemoryRead.py
index ceea4ab2f067a..50fa28c31d545 100644
--- a/lldb/test/API/functionalities/memory/read/TestMemoryRead.py
+++ b/lldb/test/API/functionalities/memory/read/TestMemoryRead.py
@@ -39,9 +39,7 @@ def build_run_stop(self):
                     substrs=['stopped', 'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f",
-                    BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
     @no_debug_info_test
     def test_memory_read(self):

diff  --git a/lldb/test/API/lang/c/anonymous/TestAnonymous.py b/lldb/test/API/lang/c/anonymous/TestAnonymous.py
index a89c0e83d24c5..42d280d660a91 100644
--- a/lldb/test/API/lang/c/anonymous/TestAnonymous.py
+++ b/lldb/test/API/lang/c/anonymous/TestAnonymous.py
@@ -166,5 +166,4 @@ def common_setup(self, line):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)

diff  --git a/lldb/test/API/lang/c/array_types/TestArrayTypes.py b/lldb/test/API/lang/c/array_types/TestArrayTypes.py
index 2adeb8346e5b2..72eb5e15c5729 100644
--- a/lldb/test/API/lang/c/array_types/TestArrayTypes.py
+++ b/lldb/test/API/lang/c/array_types/TestArrayTypes.py
@@ -42,8 +42,7 @@ def test_and_run_command(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=['resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # Issue 'variable list' command on several array-type variables.
 

diff  --git a/lldb/test/API/lang/c/conflicting-symbol/TestConflictingSymbol.py b/lldb/test/API/lang/c/conflicting-symbol/TestConflictingSymbol.py
index 7044667dfb39f..a66f3bbd1f77a 100644
--- a/lldb/test/API/lang/c/conflicting-symbol/TestConflictingSymbol.py
+++ b/lldb/test/API/lang/c/conflicting-symbol/TestConflictingSymbol.py
@@ -46,8 +46,7 @@ def test_conflicting_symbols(self):
                     substrs=['stopped',
                              'stop reason = breakpoint'])
 
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # This should display correctly.
         self.expect(
@@ -63,8 +62,7 @@ def test_conflicting_symbols(self):
                     substrs=['stopped',
                              'stop reason = breakpoint'])
 
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         self.expect(
             "expr (unsigned long long)conflicting_symbol",
@@ -79,8 +77,7 @@ def test_conflicting_symbols(self):
                     substrs=['stopped',
                              'stop reason = breakpoint'])
 
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         self.expect(
             "expr (unsigned long long)conflicting_symbol",

diff  --git a/lldb/test/API/lang/c/const_variables/TestConstVariables.py b/lldb/test/API/lang/c/const_variables/TestConstVariables.py
index 726a8c2c16e19..828bcf136934f 100644
--- a/lldb/test/API/lang/c/const_variables/TestConstVariables.py
+++ b/lldb/test/API/lang/c/const_variables/TestConstVariables.py
@@ -35,8 +35,7 @@ def test_and_run_command(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         self.runCmd("next")
         self.runCmd("next")

diff  --git a/lldb/test/API/lang/c/enum_types/TestEnumTypes.py b/lldb/test/API/lang/c/enum_types/TestEnumTypes.py
index 73d5d5d6152a2..fca85ac2663b4 100644
--- a/lldb/test/API/lang/c/enum_types/TestEnumTypes.py
+++ b/lldb/test/API/lang/c/enum_types/TestEnumTypes.py
@@ -58,8 +58,7 @@ def test_command_line(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # Look up information about the 'enum_test_days' enum type.
         # Check for correct display.

diff  --git a/lldb/test/API/lang/c/forward/TestForwardDeclaration.py b/lldb/test/API/lang/c/forward/TestForwardDeclaration.py
index 3dc3acee34b9a..70c60ebdd64d1 100644
--- a/lldb/test/API/lang/c/forward/TestForwardDeclaration.py
+++ b/lldb/test/API/lang/c/forward/TestForwardDeclaration.py
@@ -30,8 +30,7 @@ def do_test(self, dictionary=None):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # This should display correctly.
         # Note that the member fields of a = 1 and b = 2 is by design.

diff  --git a/lldb/test/API/lang/c/function_types/TestFunctionTypes.py b/lldb/test/API/lang/c/function_types/TestFunctionTypes.py
index 3db1af385bf78..9288c6300e217 100644
--- a/lldb/test/API/lang/c/function_types/TestFunctionTypes.py
+++ b/lldb/test/API/lang/c/function_types/TestFunctionTypes.py
@@ -82,5 +82,4 @@ def runToBreakpoint(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)

diff  --git a/lldb/test/API/lang/c/global_variables/TestGlobalVariables.py b/lldb/test/API/lang/c/global_variables/TestGlobalVariables.py
index 9338c104b7f24..cacdf18e11b94 100644
--- a/lldb/test/API/lang/c/global_variables/TestGlobalVariables.py
+++ b/lldb/test/API/lang/c/global_variables/TestGlobalVariables.py
@@ -65,8 +65,7 @@ def test_c_global_variables(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # Test that the statically initialized variable can also be
         # inspected *with* a process.

diff  --git a/lldb/test/API/lang/c/local_variables/TestLocalVariables.py b/lldb/test/API/lang/c/local_variables/TestLocalVariables.py
index 381292a445b50..1d3c90ea72713 100644
--- a/lldb/test/API/lang/c/local_variables/TestLocalVariables.py
+++ b/lldb/test/API/lang/c/local_variables/TestLocalVariables.py
@@ -48,8 +48,7 @@ def test_c_local_variables(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         self.expect("frame variable i", VARIABLES_DISPLAYED_CORRECTLY,
                     substrs=['(unsigned int) i = 10'])

diff  --git a/lldb/test/API/lang/c/modules/TestCModules.py b/lldb/test/API/lang/c/modules/TestCModules.py
index 7c85f613eca59..2ec6e9698ce4f 100644
--- a/lldb/test/API/lang/c/modules/TestCModules.py
+++ b/lldb/test/API/lang/c/modules/TestCModules.py
@@ -39,8 +39,7 @@ def test_expr(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # Enable logging of the imported AST.
         log_file = self.getBuildArtifact("lldb-ast-log.txt")

diff  --git a/lldb/test/API/lang/c/register_variables/TestRegisterVariables.py b/lldb/test/API/lang/c/register_variables/TestRegisterVariables.py
index 51b728be2fe6a..ef6b0425525ca 100644
--- a/lldb/test/API/lang/c/register_variables/TestRegisterVariables.py
+++ b/lldb/test/API/lang/c/register_variables/TestRegisterVariables.py
@@ -50,8 +50,7 @@ def test_and_run_command(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # Try some variables that should be visible
         frame = self.dbg.GetSelectedTarget().GetProcess(
@@ -77,8 +76,7 @@ def test_and_run_command(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # Try some variables that should be visible
         frame = self.dbg.GetSelectedTarget().GetProcess(
@@ -104,8 +102,7 @@ def test_and_run_command(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # Try some variables that should be visible
         frame = self.dbg.GetSelectedTarget().GetProcess(

diff  --git a/lldb/test/API/lang/c/set_values/TestSetValues.py b/lldb/test/API/lang/c/set_values/TestSetValues.py
index f16d554b8151b..b468eaf241f08 100644
--- a/lldb/test/API/lang/c/set_values/TestSetValues.py
+++ b/lldb/test/API/lang/c/set_values/TestSetValues.py
@@ -52,8 +52,7 @@ def test(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # main.c:15
         # Check that 'frame variable --show-types' displays the correct data

diff  --git a/lldb/test/API/lang/c/shared_lib/TestSharedLib.py b/lldb/test/API/lang/c/shared_lib/TestSharedLib.py
index 562cd32c7eb9a..36fbbb7c483f0 100644
--- a/lldb/test/API/lang/c/shared_lib/TestSharedLib.py
+++ b/lldb/test/API/lang/c/shared_lib/TestSharedLib.py
@@ -95,5 +95,4 @@ def common_setup(self, preload_symbols = True):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)

diff  --git a/lldb/test/API/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py b/lldb/test/API/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
index 5888351e1ecef..3919f402f35cb 100644
--- a/lldb/test/API/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
+++ b/lldb/test/API/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
@@ -84,5 +84,4 @@ def common_setup(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)

diff  --git a/lldb/test/API/lang/cpp/class_types/TestClassTypes.py b/lldb/test/API/lang/cpp/class_types/TestClassTypes.py
index c47df758e24b5..6ea115352c127 100644
--- a/lldb/test/API/lang/cpp/class_types/TestClassTypes.py
+++ b/lldb/test/API/lang/cpp/class_types/TestClassTypes.py
@@ -44,8 +44,7 @@ def test_with_run_command(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # We should be stopped on the ctor function of class C.
         self.expect(
@@ -141,8 +140,7 @@ def test_with_expr_parser(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # Continue on inside the ctor() body...
         self.runCmd("register read pc")

diff  --git a/lldb/test/API/lang/cpp/inlines/TestInlines.py b/lldb/test/API/lang/cpp/inlines/TestInlines.py
index 2b03e87330345..3184a53921ed7 100644
--- a/lldb/test/API/lang/cpp/inlines/TestInlines.py
+++ b/lldb/test/API/lang/cpp/inlines/TestInlines.py
@@ -54,5 +54,4 @@ def runToBreakpoint(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)

diff  --git a/lldb/test/API/lang/cpp/namespace_definitions/TestNamespaceDefinitions.py b/lldb/test/API/lang/cpp/namespace_definitions/TestNamespaceDefinitions.py
index 904f709157314..a82c28f19ad44 100644
--- a/lldb/test/API/lang/cpp/namespace_definitions/TestNamespaceDefinitions.py
+++ b/lldb/test/API/lang/cpp/namespace_definitions/TestNamespaceDefinitions.py
@@ -66,5 +66,4 @@ def common_setup(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)

diff  --git a/lldb/test/API/lang/cpp/signed_types/TestSignedTypes.py b/lldb/test/API/lang/cpp/signed_types/TestSignedTypes.py
index f61cd64130d3c..b7ae201a9d15c 100644
--- a/lldb/test/API/lang/cpp/signed_types/TestSignedTypes.py
+++ b/lldb/test/API/lang/cpp/signed_types/TestSignedTypes.py
@@ -47,8 +47,7 @@ def test(self):
                     substrs=['stopped', 'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # Execute the puts().
         self.runCmd("thread step-over")

diff  --git a/lldb/test/API/lang/objc/conflicting-definition/TestConflictingDefinition.py b/lldb/test/API/lang/objc/conflicting-definition/TestConflictingDefinition.py
index 274bb452cef8d..b7cc7db17a7b5 100644
--- a/lldb/test/API/lang/objc/conflicting-definition/TestConflictingDefinition.py
+++ b/lldb/test/API/lang/objc/conflicting-definition/TestConflictingDefinition.py
@@ -31,8 +31,7 @@ def test_frame_var_after_stop_at_implementation(self):
                     substrs=['stopped',
                              'stop reason = breakpoint'])
 
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # This should display correctly.
         self.expect(

diff  --git a/lldb/test/API/lang/objc/forward-decl/TestForwardDecl.py b/lldb/test/API/lang/objc/forward-decl/TestForwardDecl.py
index d52b714a6453b..0956ca0d4d467 100644
--- a/lldb/test/API/lang/objc/forward-decl/TestForwardDecl.py
+++ b/lldb/test/API/lang/objc/forward-decl/TestForwardDecl.py
@@ -47,8 +47,7 @@ def do_test(self, dictionary=None):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # This should display correctly.
         self.expect("expression [j getMember]", VARIABLES_DISPLAYED_CORRECTLY,

diff  --git a/lldb/test/API/lang/objc/hidden-ivars/TestHiddenIvars.py b/lldb/test/API/lang/objc/hidden-ivars/TestHiddenIvars.py
index f52c73030409c..f904369579601 100644
--- a/lldb/test/API/lang/objc/hidden-ivars/TestHiddenIvars.py
+++ b/lldb/test/API/lang/objc/hidden-ivars/TestHiddenIvars.py
@@ -110,8 +110,7 @@ def common_setup(self, strip):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
     def expr(self, strip):
         self.common_setup(strip)

diff  --git a/lldb/test/API/lang/objc/modules-auto-import/TestModulesAutoImport.py b/lldb/test/API/lang/objc/modules-auto-import/TestModulesAutoImport.py
index 3b01858549bae..ceef95d593f96 100644
--- a/lldb/test/API/lang/objc/modules-auto-import/TestModulesAutoImport.py
+++ b/lldb/test/API/lang/objc/modules-auto-import/TestModulesAutoImport.py
@@ -38,8 +38,7 @@ def test_expr(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         self.runCmd("settings set target.auto-import-clang-modules true")
 

diff  --git a/lldb/test/API/lang/objc/modules-incomplete/TestIncompleteModules.py b/lldb/test/API/lang/objc/modules-incomplete/TestIncompleteModules.py
index 4d18c04e8a5ef..fc598ea12c70b 100644
--- a/lldb/test/API/lang/objc/modules-incomplete/TestIncompleteModules.py
+++ b/lldb/test/API/lang/objc/modules-incomplete/TestIncompleteModules.py
@@ -35,8 +35,7 @@ def test_expr(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         self.runCmd(
             "settings set target.clang-module-search-paths \"" +

diff  --git a/lldb/test/API/lang/objc/modules/TestObjCModules.py b/lldb/test/API/lang/objc/modules/TestObjCModules.py
index 072b306c191af..66c1b33da4e2e 100644
--- a/lldb/test/API/lang/objc/modules/TestObjCModules.py
+++ b/lldb/test/API/lang/objc/modules/TestObjCModules.py
@@ -38,8 +38,7 @@ def test_expr(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         self.expect("expr @import Darwin; 3", VARIABLES_DISPLAYED_CORRECTLY,
                     substrs=["int", "3"])

diff  --git a/lldb/test/API/lang/objc/objc-new-syntax/ObjCNewSyntaxTest.py b/lldb/test/API/lang/objc/objc-new-syntax/ObjCNewSyntaxTest.py
index 5fa9336b731e8..fda4d944b38a4 100644
--- a/lldb/test/API/lang/objc/objc-new-syntax/ObjCNewSyntaxTest.py
+++ b/lldb/test/API/lang/objc/objc-new-syntax/ObjCNewSyntaxTest.py
@@ -23,7 +23,4 @@ def runToBreakpoint(self):
             substrs=['stopped', 'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect(
-            "breakpoint list -f",
-            BREAKPOINT_HIT_ONCE,
-            substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)

diff  --git a/lldb/test/API/lang/objc/real-definition/TestRealDefinition.py b/lldb/test/API/lang/objc/real-definition/TestRealDefinition.py
index 9c84ffa0e00c9..31480d1ce479c 100644
--- a/lldb/test/API/lang/objc/real-definition/TestRealDefinition.py
+++ b/lldb/test/API/lang/objc/real-definition/TestRealDefinition.py
@@ -32,14 +32,12 @@ def test_frame_var_after_stop_at_interface(self):
                              'stop reason = breakpoint'])
 
         # Run and stop at Foo
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         self.runCmd("continue", RUN_SUCCEEDED)
 
         # Run at stop at main
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # This should display correctly.
         self.expect(
@@ -69,14 +67,12 @@ def test_frame_var_after_stop_at_implementation(self):
                              'stop reason = breakpoint'])
 
         # Run and stop at Foo
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         self.runCmd("continue", RUN_SUCCEEDED)
 
         # Run at stop at main
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         # This should display correctly.
         self.expect(

diff  --git a/lldb/test/API/lang/objc/single-entry-dictionary/TestObjCSingleEntryDictionary.py b/lldb/test/API/lang/objc/single-entry-dictionary/TestObjCSingleEntryDictionary.py
index 88d2536a16181..d0394662e281a 100644
--- a/lldb/test/API/lang/objc/single-entry-dictionary/TestObjCSingleEntryDictionary.py
+++ b/lldb/test/API/lang/objc/single-entry-dictionary/TestObjCSingleEntryDictionary.py
@@ -57,8 +57,7 @@ def run_tests(self):
                              'stop reason = breakpoint'])
 
         # The breakpoint should have a hit count of 1.
-        self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
-                    substrs=[' resolved, hit count = 1'])
+        lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
 
         d1 = self.frame().FindVariable("d1")
         d1.SetPreferSyntheticValue(True)


        


More information about the lldb-commits mailing list