(self, back_edge_trip_counts=None, header_trip_counts=None, current_loop=None)
:param back_edge_trip_counts: Dictionary that stores back edge based trip counts for each loop.
                                      Keys are address of loop headers.
        :param header_trip_counts:    Dictionary that stores header based trip counts for each loop.
                                      Keys are address of loop headers.
        :param current_loop:          List of currently running loops. Each element is a tuple
                                      (loop object, list of loop exits).
:param back_edge_trip_counts: Dictionary that stores back edge based trip counts for each loop.
                                      Keys are address of loop headers.
        :param header_trip_counts:    Dictionary that stores header based trip counts for each loop.
                                      Keys are address of loop headers.
        :param current_loop:          List of currently running loops. Each element is a tuple
                                      (loop object, list of loop exits).
: param back_edge_trip_counts : Dictionary that stores back edge based trip counts for each loop . Keys are address of loop headers . : param header_trip_counts : Dictionary that stores header based trip counts for each loop . Keys are address of loop headers . : param current_loop : List of currently running loops . Each element is a tuple ( loop object list of loop exits ) .
def __init__(self, back_edge_trip_counts=None, header_trip_counts=None, current_loop=None):
        """
        :param back_edge_trip_counts: Dictionary that stores back edge based trip counts for each loop.
                                      Keys are address of loop headers.
        :param header_trip_counts:    Dictionary that stores header based trip counts for each loop.
                                      Keys are address of loop headers.
        :param current_loop:          List of currently running loops. Each element is a tuple
                                      (loop object, list of loop exits).
        """
        # This is why header based trip counter is not always accurate:
        #
        # 0x10812: movs r3, #0          -> this block dominates the loop
        # 0x10814: str  r3, [r7, #20]
        # 0x10816: b    0x10868
        #
        # 0x10818: movs r3, #0          -> the real loop body starts here
        # ...
        #
        # 0x10868: ldr  r3, [r7, #20]   -> the loop header is executed the first time without executing the loop body
        # 0x1086a: cmp  r3, #3
        # 0x1086c: ble  0x10818         -> the back edge
        #
        # This is why back edge based trip counter is not always accurate. The
        # compiler divides the logic of the loop body in 2 parts A and B. This loop
        # structure implies that the back edge is taken one time less than the number
        # of times the full loop body is executed.
        #
        # 0x10768: movs r3, #0          -> this block contains part A of the logic
        # ...                              for the first iteration and dominates the loop
        # 0x10816: b    0x10868
        #
        # 0x10818: movs r3, #0          -> part A of the logic for other iterations is put in this block
        # ...
        #
        # 0x10868: add  r2, r0, r1      -> part B of the logic for all iterations is put in the loop header
        # ...
        # 0x10898: ldr  r3, [r7, #20]
        # 0x1089a: cmp  r3, #3
        # 0x1089c: ble  0x10818         -> the back edge
        #
        # And yes, another example for the latter case is a do-while loop!

        SimStatePlugin.__init__(self)
        self.back_edge_trip_counts = defaultdict(list) if back_edge_trip_counts is None else back_edge_trip_counts
        self.header_trip_counts = defaultdict(list) if header_trip_counts is None else header_trip_counts
        self.current_loop = [] if current_loop is None else current_loop
def __init__ ( self , back_edge_trip_counts = None , header_trip_counts = None , current_loop = None ) : # This is why header based trip counter is not always accurate: # # 0x10812: movs r3, #0          -> this block dominates the loop # 0x10814: str  r3, [r7, #20] # 0x10816: b    0x10868 # # 0x10818: movs r3, #0          -> the real loop body starts here # ... # # 0x10868: ldr  r3, [r7, #20]   -> the loop header is executed the first time without executing the loop body # 0x1086a: cmp  r3, #3 # 0x1086c: ble  0x10818         -> the back edge # # This is why back edge based trip counter is not always accurate. The # compiler divides the logic of the loop body in 2 parts A and B. This loop # structure implies that the back edge is taken one time less than the number # of times the full loop body is executed. # # 0x10768: movs r3, #0          -> this block contains part A of the logic # ...                              for the first iteration and dominates the loop # 0x10816: b    0x10868 # # 0x10818: movs r3, #0          -> part A of the logic for other iterations is put in this block # ... # # 0x10868: add  r2, r0, r1      -> part B of the logic for all iterations is put in the loop header # ... # 0x10898: ldr  r3, [r7, #20] # 0x1089a: cmp  r3, #3 # 0x1089c: ble  0x10818         -> the back edge # # And yes, another example for the latter case is a do-while loop! SimStatePlugin . __init__ ( self ) self . back_edge_trip_counts = defaultdict ( list ) if back_edge_trip_counts is None else back_edge_trip_counts self . header_trip_counts = defaultdict ( list ) if header_trip_counts is None else header_trip_counts self . current_loop = [ ] if current_loop is None else current_loop