angr.state_plugins.loop_data

class angr.state_plugins.loop_data.SimStateLoopData

Bases: SimStatePlugin

This class keeps track of loop-related information for states. Note that we have 2 counters for loop iterations (trip counts): the first recording the number of times one of the back edges (or continue edges) of a loop is taken, whereas the second recording the number of times the loop header (or loop entry) is executed. These 2 counters may differ since compilers usually optimize loops hence completely change the loop structure at the binary level. This is supposed to be used with LoopSeer exploration technique, which monitors loop execution. For the moment, the only thing we want to analyze is loop trip counts, but nothing prevents us from extending this plugin for other loop analyses.

__init__(back_edge_trip_counts=None, header_trip_counts=None, current_loop=None)
Parameters:
  • back_edge_trip_counts – Dictionary that stores back edge based trip counts for each loop. Keys are address of loop headers.

  • header_trip_counts – Dictionary that stores header based trip counts for each loop. Keys are address of loop headers.

  • current_loop – List of currently running loops. Each element is a tuple (loop object, list of loop exits).