(
            self,
            subject: Union[Subject,ailment.Block,Block,Function]=None,
            func_graph=None,
            max_iterations=3,
            track_tmps=False,
            track_calls=None,
            track_consts=False,
            observation_points: "Iterable[ObservationPoint]" =None,
            init_state: ReachingDefinitionsState=None,
            cc=None,
            function_handler: "Optional[FunctionHandler]" = None,
            call_stack: Optional[List[int]]=None,
            maximum_local_call_depth=5,
            observe_all=False,
            visited_blocks=None,
            dep_graph: Optional['DepGraph']=None,
            observe_callback=None,
            canonical_size=8
    )
:param subject:                         The subject of the analysis: a function, or a single basic block
        :param func_graph:                      Alternative graph for function.graph.
        :param int max_iterations:              The maximum number of iterations before the analysis is terminated.
        :param bool track_tmps:                 Whether or not temporary variables should be taken into consideration
                                                during the analysis.
        :param bool track_calls:                Whether or not calls will show up as elements in the def-use graph.
        :param iterable observation_points:     A collection of tuples of ("node"|"insn", ins_addr, OP_TYPE) defining
                                                where reaching definitions should be copied and stored. OP_TYPE can be
                                                OP_BEFORE or OP_AFTER.
        :param init_state:                      An optional initialization state. The analysis creates and works on a
                                                copy.
                                                Default to None: the analysis then initialize its own abstract state,
                                                based on the given <Subject>.
        :param SimCC cc:                        Calling convention of the function.
        :param FunctionHandler function_handler:
                                                The function handler to update the analysis state and results on
                                                function calls.
        :param call_stack:                      An ordered list of Function addresses representing the call stack
                                                leading to the analysed subject, from older to newer calls. Setting it
                                                to None to limit the analysis to a single function and disable call
                                                stack tracking; In that case, all contexts in CodeLocation will be
                                                None, which makes CodeLocation objects contextless.
        :param int maximum_local_call_depth:    Maximum local function recursion depth.
        :param Boolean observe_all:             Observe every statement, both before and after.
        :param visited_blocks:                  A set of previously visited blocks.
        :param dep_graph:                       An initial dependency graph to add the result of the analysis to. Set it
                                                to None to skip dependency graph generation.
        :param canonical_size:                  The sizes (in bytes) that objects with an UNKNOWN_SIZE are treated as
                                                for operations where sizes are necessary.
:param subject:                         The subject of the analysis: a function, or a single basic block
        :param func_graph:                      Alternative graph for function.graph.
        :param int max_iterations:              The maximum number of iterations before the analysis is terminated.
        :param bool track_tmps:                 Whether or not temporary variables should be taken into consideration
                                                during the analysis.
        :param bool track_calls:                Whether or not calls will show up as elements in the def-use graph.
        :param iterable observation_points:     A collection of tuples of ("node"|"insn", ins_addr, OP_TYPE) defining
                                                where reaching definitions should be copied and stored. OP_TYPE can be
                                                OP_BEFORE or OP_AFTER.
        :param init_state:                      An optional initialization state. The analysis creates and works on a
                                                copy.
                                                Default to None: the analysis then initialize its own abstract state,
                                                based on the given <Subject>.
        :param SimCC cc:                        Calling convention of the function.
        :param FunctionHandler function_handler:
                                                The function handler to update the analysis state and results on
                                                function calls.
        :param call_stack:                      An ordered list of Function addresses representing the call stack
                                                leading to the analysed subject, from older to newer calls. Setting it
                                                to None to limit the analysis to a single function and disable call
                                                stack tracking; In that case, all contexts in CodeLocation will be
                                                None, which makes CodeLocation objects contextless.
        :param int maximum_local_call_depth:    Maximum local function recursion depth.
        :param Boolean observe_all:             Observe every statement, both before and after.
        :param visited_blocks:                  A set of previously visited blocks.
        :param dep_graph:                       An initial dependency graph to add the result of the analysis to. Set it
                                                to None to skip dependency graph generation.
        :param canonical_size:                  The sizes (in bytes) that objects with an UNKNOWN_SIZE are treated as
                                                for operations where sizes are necessary.
: param subject : The subject of the analysis : a function or a single basic block : param func_graph : Alternative graph for function . graph . : param int max_iterations : The maximum number of iterations before the analysis is terminated . : param bool track_tmps : Whether or not temporary variables should be taken into consideration during the analysis . : param bool track_calls : Whether or not calls will show up as elements in the def - use graph . : param iterable observation_points : A collection of tuples of ( node | insn ins_addr OP_TYPE ) defining where reaching definitions should be copied and stored . OP_TYPE can be OP_BEFORE or OP_AFTER . : param init_state : An optional initialization state . The analysis creates and works on a copy . Default to None : the analysis then initialize its own abstract state based on the given <Subject > . : param SimCC cc : Calling convention of the function . : param FunctionHandler function_handler : The function handler to update the analysis state and results on function calls . : param call_stack : An ordered list of Function addresses representing the call stack leading to the analysed subject from older to newer calls . Setting it to None to limit the analysis to a single function and disable call stack tracking ; In that case all contexts in CodeLocation will be None which makes CodeLocation objects contextless . : param int maximum_local_call_depth : Maximum local function recursion depth . : param Boolean observe_all : Observe every statement both before and after . : param visited_blocks : A set of previously visited blocks . : param dep_graph : An initial dependency graph to add the result of the analysis to . Set it to None to skip dependency graph generation . : param canonical_size : The sizes ( in bytes ) that objects with an UNKNOWN_SIZE are treated as for operations where sizes are necessary .
def __init__(
            self,
            subject: Union[Subject,ailment.Block,Block,Function]=None,
            func_graph=None,
            max_iterations=3,
            track_tmps=False,
            track_calls=None,
            track_consts=False,
            observation_points: "Iterable[ObservationPoint]" =None,
            init_state: ReachingDefinitionsState=None,
            cc=None,
            function_handler: "Optional[FunctionHandler]" = None,
            call_stack: Optional[List[int]]=None,
            maximum_local_call_depth=5,
            observe_all=False,
            visited_blocks=None,
            dep_graph: Optional['DepGraph']=None,
            observe_callback=None,
            canonical_size=8
    ):
        """
        :param subject:                         The subject of the analysis: a function, or a single basic block
        :param func_graph:                      Alternative graph for function.graph.
        :param int max_iterations:              The maximum number of iterations before the analysis is terminated.
        :param bool track_tmps:                 Whether or not temporary variables should be taken into consideration
                                                during the analysis.
        :param bool track_calls:                Whether or not calls will show up as elements in the def-use graph.
        :param iterable observation_points:     A collection of tuples of ("node"|"insn", ins_addr, OP_TYPE) defining
                                                where reaching definitions should be copied and stored. OP_TYPE can be
                                                OP_BEFORE or OP_AFTER.
        :param init_state:                      An optional initialization state. The analysis creates and works on a
                                                copy.
                                                Default to None: the analysis then initialize its own abstract state,
                                                based on the given <Subject>.
        :param SimCC cc:                        Calling convention of the function.
        :param FunctionHandler function_handler:
                                                The function handler to update the analysis state and results on
                                                function calls.
        :param call_stack:                      An ordered list of Function addresses representing the call stack
                                                leading to the analysed subject, from older to newer calls. Setting it
                                                to None to limit the analysis to a single function and disable call
                                                stack tracking; In that case, all contexts in CodeLocation will be
                                                None, which makes CodeLocation objects contextless.
        :param int maximum_local_call_depth:    Maximum local function recursion depth.
        :param Boolean observe_all:             Observe every statement, both before and after.
        :param visited_blocks:                  A set of previously visited blocks.
        :param dep_graph:                       An initial dependency graph to add the result of the analysis to. Set it
                                                to None to skip dependency graph generation.
        :param canonical_size:                  The sizes (in bytes) that objects with an UNKNOWN_SIZE are treated as
                                                for operations where sizes are necessary.
        """

        if not isinstance(subject, Subject):
            self._subject = Subject(subject, func_graph, cc)
        else:
            self._subject = subject
        self._graph_visitor = self._subject.visitor

        ForwardAnalysis.__init__(self, order_jobs=True, allow_merging=True, allow_widening=False,
                                 graph_visitor=self._graph_visitor)

        self._track_tmps = track_tmps
        self._track_calls = track_calls
        self._track_consts = track_consts
        self._max_iterations = max_iterations
        self._observation_points = observation_points
        self._init_state = init_state
        self._maximum_local_call_depth = maximum_local_call_depth
        self._canonical_size = canonical_size

        self._dep_graph = dep_graph

        if function_handler is None:
            self._function_handler = FunctionHandler().hook(self)
        else:
            self._function_handler = function_handler.hook(self)

        self._call_stack: Optional[List[int]] = None
        if call_stack is not None:
            self._call_stack = self._init_call_stack(call_stack, subject)

        if self._init_state is not None:
            self._init_state = self._init_state.copy()
            self._init_state.analysis = self

        self._observe_all = observe_all
        self._observe_callback = observe_callback

        # sanity check
        if self._observation_points and any(not type(op) is tuple for op in self._observation_points):
            raise ValueError('"observation_points" must be tuples.')

        if type(self) is ReachingDefinitionsAnalysis and \
                not self._observe_all and \
                not self._observation_points and \
                not self._observe_callback and \
                not self._dep_graph:
            l.warning('No observation point is specified. '
                      'You cannot get any analysis result from performing the analysis.'
                      )

        self._node_iterations: DefaultDict[int, int] = defaultdict(int)

        self._engine_vex = SimEngineRDVEX(self.project, self._call_stack, self._maximum_local_call_depth,
                                          functions=self.kb.functions,
                                          function_handler=self._function_handler)
        self._engine_ail = SimEngineRDAIL(self.project, self._call_stack, self._maximum_local_call_depth,
                                          function_handler=self._function_handler)

        self._visited_blocks: Set[Any] = visited_blocks or set()
        self.model: ReachingDefinitionsModel = ReachingDefinitionsModel(
            func_addr=self.subject.content.addr if isinstance(self.subject.content, Function) else None)

        self._analyze()
def __init__ ( self , subject : Union [ Subject , ailment . Block , Block , Function ] = None , func_graph = None , max_iterations = 3 , track_tmps = False , track_calls = None , track_consts = False , observation_points : "Iterable[ObservationPoint]" = None , init_state : ReachingDefinitionsState = None , cc = None , function_handler : "Optional[FunctionHandler]" = None , call_stack : Optional [ List [ int ] ] = None , maximum_local_call_depth = 5 , observe_all = False , visited_blocks = None , dep_graph : Optional [ 'DepGraph' ] = None , observe_callback = None , canonical_size = 8 ) : if not isinstance ( subject , Subject ) : self . _subject = Subject ( subject , func_graph , cc ) else : self . _subject = subject self . _graph_visitor = self . _subject . visitor ForwardAnalysis . __init__ ( self , order_jobs = True , allow_merging = True , allow_widening = False , graph_visitor = self . _graph_visitor ) self . _track_tmps = track_tmps self . _track_calls = track_calls self . _track_consts = track_consts self . _max_iterations = max_iterations self . _observation_points = observation_points self . _init_state = init_state self . _maximum_local_call_depth = maximum_local_call_depth self . _canonical_size = canonical_size self . _dep_graph = dep_graph if function_handler is None : self . _function_handler = FunctionHandler ( ) . hook ( self ) else : self . _function_handler = function_handler . hook ( self ) self . _call_stack : Optional [ List [ int ] ] = None if call_stack is not None : self . _call_stack = self . _init_call_stack ( call_stack , subject ) if self . _init_state is not None : self . _init_state = self . _init_state . copy ( ) self . _init_state . analysis = self self . _observe_all = observe_all self . _observe_callback = observe_callback # sanity check if self . _observation_points and any ( not type ( op ) is tuple for op in self . _observation_points ) : raise ValueError ( '"observation_points" must be tuples.' ) if type ( self ) is ReachingDefinitionsAnalysis and not self . _observe_all and not self . _observation_points and not self . _observe_callback and not self . _dep_graph : l . warning ( 'No observation point is specified. ' 'You cannot get any analysis result from performing the analysis.' ) self . _node_iterations : DefaultDict [ int , int ] = defaultdict ( int ) self . _engine_vex = SimEngineRDVEX ( self . project , self . _call_stack , self . _maximum_local_call_depth , functions = self . kb . functions , function_handler = self . _function_handler ) self . _engine_ail = SimEngineRDAIL ( self . project , self . _call_stack , self . _maximum_local_call_depth , function_handler = self . _function_handler ) self . _visited_blocks : Set [ Any ] = visited_blocks or set ( ) self . model : ReachingDefinitionsModel = ReachingDefinitionsModel ( func_addr = self . subject . content . addr if isinstance ( self . subject . content , Function ) else None ) self . _analyze ( )