@@ -730,6 +730,57 @@ def check_breakpoint_result(
730
730
(out_module_name ,
731
731
module_name ))
732
732
733
+ def check_breakpoint (
734
+ test ,
735
+ bpno ,
736
+ expected_locations = None ,
737
+ expected_resolved_count = None ,
738
+ expected_hit_count = None ,
739
+ location_id = None ,
740
+ expected_location_resolved = True ,
741
+ expected_location_hit_count = None ):
742
+ """
743
+ Test breakpoint or breakpoint location.
744
+ Breakpoint resolved count is always checked. If not specified the assumption is that all locations
745
+ should be resolved.
746
+ To test a breakpoint location, breakpoint number (bpno) and location_id must be set. In this case
747
+ the resolved count for a breakpoint is not tested by default. The location is expected to be resolved,
748
+ unless expected_location_resolved is set to False.
749
+ test - test context
750
+ bpno - breakpoint number to test
751
+ expected_locations - expected number of locations for this breakpoint. If 'None' this parameter is not tested.
752
+ expected_resolved_count - expected resolved locations number for the breakpoint. If 'None' - all locations should be resolved.
753
+ expected_hit_count - expected hit count for this breakpoint. If 'None' this parameter is not tested.
754
+ location_id - If not 'None' sets the location ID for the breakpoint to test.
755
+ expected_location_resolved - Extected resolved status for the location_id (True/False). Default - True.
756
+ expected_location_hit_count - Expected hit count for the breakpoint at location_id. Must be set if the location_id parameter is set.
757
+ """
758
+
759
+ bkpt = test .target ().FindBreakpointByID (bpno )
760
+ test .assertTrue (bkpt .IsValid (), "Breakpoint is not valid." )
761
+
762
+ if expected_locations is not None :
763
+ test .assertEquals (expected_locations , bkpt .GetNumLocations ())
764
+
765
+ if expected_resolved_count is not None :
766
+ test .assertEquals (expected_resolved_count , bkpt .GetNumResolvedLocations ())
767
+ else :
768
+ expected_resolved_count = bkpt .GetNumLocations ()
769
+ if location_id is None :
770
+ test .assertEquals (expected_resolved_count , bkpt .GetNumResolvedLocations ())
771
+
772
+ if expected_hit_count is not None :
773
+ test .assertEquals (expected_hit_count , bkpt .GetHitCount ())
774
+
775
+ if location_id is not None :
776
+ loc_bkpt = bkpt .FindLocationByID (location_id )
777
+ test .assertTrue (loc_bkpt .IsValid (), "Breakpoint location is not valid." )
778
+ test .assertEquals (loc_bkpt .IsResolved (), expected_location_resolved )
779
+ if expected_location_hit_count is not None :
780
+ test .assertEquals (expected_location_hit_count , loc_bkpt .GetHitCount ())
781
+
782
+
783
+
733
784
# ==================================================
734
785
# Utility functions related to Threads and Processes
735
786
# ==================================================
0 commit comments