angr/state_plugins/javavm_classloader.py
def init_class(self, class_, step_func=None):
        """
        This method simulates the loading of a class by the JVM, during which
        parts of the class (e.g. static fields) are initialized. For this, we
        run the class initializer method <clinit> (if available) and update
        the state accordingly.

        Note: Initialization is skipped, if the class has already been
              initialized (or if it's not loaded in CLE).
        """
        if self.is_class_initialized(class_):
            l.debug("Class %r already initialized.", class_)
            return

        l.debug("Initialize class %r.", class_)
        self.initialized_classes.add(class_)

        if not class_.is_loaded:
            l.warning("Class %r is not loaded in CLE. Skip initializiation.", class_)
            return

        clinit_method = resolve_method(self.state, '<clinit>', class_.name,
                                       include_superclasses=False, init_class=False)
        if clinit_method.is_loaded:
            engine = UberEngine(self.state.project)
            # use a fresh engine, as the default engine instance may be in use at this time
            javavm_simos = self.state.project.simos
            clinit_state = javavm_simos.state_call(addr=SootAddressDescriptor(clinit_method, 0, 0),
                                                   base_state=self.state,
                                                   ret_addr=SootAddressTerminator())
            simgr = self.state.project.factory.simgr(clinit_state)
            l.info(">"*15 + " Run class initializer %r ... " + ">"*15, clinit_method)
            simgr.run(step_func=step_func, engine=engine)
            l.debug("<"*15 + " Run class initializer %r ... done " + "<"*15, clinit_method)
            # The only thing that can be updated during initialization are
            # static or rather global information, which are either stored on
            # the heap or in the vm_static_table
            self.state.memory.vm_static_table = simgr.deadended[-1].memory.vm_static_table.copy()
            self.state.memory.heap = simgr.deadended[-1].memory.heap.copy()
        else:
            l.debug("Class initializer <clinit> is not loaded in CLE. Skip initializiation.")

        This method simulates the loading of a class by the JVM, during which
        parts of the class (e.g. static fields) are initialized. For this, we
        run the class initializer method <clinit> (if available) and update
        the state accordingly.

        Note: Initialization is skipped, if the class has already been
              initialized (or if it's not loaded in CLE).
        
This method simulates the loading of a class by the JVM, during which
parts of the class  are initialized. For this, we
run the class initializer method  (if available) and update
the state accordingly.

Initialization is skipped, if the class has already been
initialized (or if it's not loaded in CLE).
This method simulates the loading of a class by the JVM during which parts of the class are initialized . For this we run the class initializer method ( if available ) and update the state accordingly . Initialization is skipped if the class has already been initialized ( or if it ' s not loaded in CLE ) .
def init_class(self, class_, step_func=None):
        if self.is_class_initialized(class_):
            l.debug("Class %r already initialized.", class_)
            return
        l.debug("Initialize class %r.", class_)
        self.initialized_classes.add(class_)
        if not class_.is_loaded:
            l.warning("Class %r is not loaded in CLE. Skip initializiation.", class_)
            return
        clinit_method = resolve_method(self.state, '<clinit>', class_.name,
                                       include_superclasses=False, init_class=False)
        if clinit_method.is_loaded:
            engine = UberEngine(self.state.project)
            javavm_simos = self.state.project.simos
            clinit_state = javavm_simos.state_call(addr=SootAddressDescriptor(clinit_method, 0, 0),
                                                   base_state=self.state,
                                                   ret_addr=SootAddressTerminator())
            simgr = self.state.project.factory.simgr(clinit_state)
            l.info(">"*15 + " Run class initializer %r ... " + ">"*15, clinit_method)
            simgr.run(step_func=step_func, engine=engine)
            l.debug("<"*15 + " Run class initializer %r ... done " + "<"*15, clinit_method)
            self.state.memory.vm_static_table = simgr.deadended[-1].memory.vm_static_table.copy()
            self.state.memory.heap = simgr.deadended[-1].memory.heap.copy()
        else:
            l.debug("Class initializer <clinit> is not loaded in CLE. Skip initializiation.")
def init_class ( self , class_ , step_func = None ) : if self . is_class_initialized ( class_ ) : l . debug ( "Class %r already initialized." , class_ ) return l . debug ( "Initialize class %r." , class_ ) self . initialized_classes . add ( class_ ) if not class_ . is_loaded : l . warning ( "Class %r is not loaded in CLE. Skip initializiation." , class_ ) return clinit_method = resolve_method ( self . state , '<clinit>' , class_ . name , include_superclasses = False , init_class = False ) if clinit_method . is_loaded : engine = UberEngine ( self . state . project ) javavm_simos = self . state . project . simos clinit_state = javavm_simos . state_call ( addr = SootAddressDescriptor ( clinit_method , 0 , 0 ) , base_state = self . state , ret_addr = SootAddressTerminator ( ) ) simgr = self . state . project . factory . simgr ( clinit_state ) l . info ( ">" * 15 + " Run class initializer %r ... " + ">" * 15 , clinit_method ) simgr . run ( step_func = step_func , engine = engine ) l . debug ( "<" * 15 + " Run class initializer %r ... done " + "<" * 15 , clinit_method ) self . state . memory . vm_static_table = simgr . deadended [ - 1 ] . memory . vm_static_table . copy ( ) self . state . memory . heap = simgr . deadended [ - 1 ] . memory . heap . copy ( ) else : l . debug ( "Class initializer <clinit> is not loaded in CLE. Skip initializiation." )
This method simulates the loading of a class by the JVM, during which
parts of the class (e.g.
This method simulates the loading of a class by the JVM during which parts of the class ( e . g .
"""
        This method simulates the loading of a class by the JVM, during which
        parts of the class (e.g. static fields) are initialized. For this, we
        run the class initializer method <clinit> (if available) and update
        the state accordingly.

        Note: Initialization is skipped, if the class has already been
              initialized (or if it's not loaded in CLE).
        """ # use a fresh engine, as the default engine instance may be in use at this time # The only thing that can be updated during initialization are # static or rather global information, which are either stored on # the heap or in the vm_static_table
self
class_
step_func