#NEWLINE# def _construct_control_flow_slice( self , simruns ) : #NEWLINE# #INDENT# '\n        Build a slice of the program without considering the effect of data dependencies.\n        This is an incorrect hack, but it should work fine with small programs.\n\n        :param simruns: A list of SimRun targets. You probably wanna get it from the CFG somehow. It must exist in the\n                        CFG.\n        ' #NEWLINE# if ( self . _cfg is None ) : #NEWLINE# #INDENT# l . error ( 'Please build CFG first.' ) #NEWLINE# #UNINDENT# cfg = self . _cfg . graph #NEWLINE# for simrun in simruns : #NEWLINE# #INDENT# if ( simrun not in cfg ) : #NEWLINE# #INDENT# l . error ( 'SimRun instance %s is not in the CFG.' , simrun ) #NEWLINE# #UNINDENT# #UNINDENT# stack = [ ] #NEWLINE# for simrun in pred : #NEWLINE# #INDENT# stack . append ( simrun ) #NEWLINE# #UNINDENT# self . runs_in_slice = networkx . DiGraph ( ) #NEWLINE# self . cfg_nodes_in_slice = networkx . DiGraph ( ) #NEWLINE# self . chosen_statements = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# while stack : #NEWLINE# #INDENT# block = stack . pop ( ) #NEWLINE# if ( block . addr not in self . chosen_statements ) : #NEWLINE# #INDENT# self . chosen_statements [ block . addr ] = True #NEWLINE# predecessors = cfg . predecessors ( block ) #NEWLINE# for pred in predecessors : #NEWLINE# #INDENT# stack . append ( pred ) #NEWLINE# self . cfg_nodes_in_slice . add_edge ( pred , block ) #NEWLINE# self . runs_in_slice . add_edge ( pred . addr , block . addr )