(self)
Configure the project to set up global settings (like SimProcedures).
Configure the project to set up global settings (like SimProcedures).
Configure the project to set up global settings ( like SimProcedures ) .
def configure_project(self):
        """
        Configure the project to set up global settings (like SimProcedures).
        """
        self.return_deadend = self.project.loader.extern_object.allocate()
        self.project.hook(self.return_deadend, P['stubs']['CallReturn']())

        self.unresolvable_jump_target = self.project.loader.extern_object.allocate()
        self.project.hook(self.unresolvable_jump_target, P['stubs']['UnresolvableJumpTarget']())
        self.unresolvable_call_target = self.project.loader.extern_object.allocate()
        self.project.hook(self.unresolvable_call_target, P['stubs']['UnresolvableCallTarget']())

        def irelative_resolver(resolver_addr):
            # autohooking runs before this does, might have provided this already
            # in that case, we want to advertise the _resolver_ address, since it is now
            # providing the behavior of the actual function
            if self.project.is_hooked(resolver_addr):
                return resolver_addr


            base_state = self.state_blank(addr=0,
                add_options={o.SYMBOL_FILL_UNCONSTRAINED_MEMORY, o.SYMBOL_FILL_UNCONSTRAINED_REGISTERS})
            prototype = 'void *x(long)' if isinstance(self.arch, ArchS390X) else 'void *x(void)'
            resolver = self.project.factory.callable(
                resolver_addr,
                concrete_only=True,
                base_state=base_state,
                prototype=prototype)
            try:
                if isinstance(self.arch, ArchS390X):
                    # On s390x ifunc resolvers expect hwcaps.
                    val = resolver(0)
                else:
                    val = resolver()
            except AngrCallableMultistateError:
                _l.error("Resolver at %#x failed to resolve! (multivalued)", resolver_addr)
                return None
            except AngrCallableError:
                _l.error("Resolver at %#x failed to resolve!", resolver_addr)
                return None

            return val._model_concrete.value

        self.project.loader.perform_irelative_relocs(irelative_resolver)
def configure_project ( self ) : self . return_deadend = self . project . loader . extern_object . allocate ( ) self . project . hook ( self . return_deadend , P [ 'stubs' ] [ 'CallReturn' ] ( ) ) self . unresolvable_jump_target = self . project . loader . extern_object . allocate ( ) self . project . hook ( self . unresolvable_jump_target , P [ 'stubs' ] [ 'UnresolvableJumpTarget' ] ( ) ) self . unresolvable_call_target = self . project . loader . extern_object . allocate ( ) self . project . hook ( self . unresolvable_call_target , P [ 'stubs' ] [ 'UnresolvableCallTarget' ] ( ) ) def irelative_resolver ( resolver_addr ) : # autohooking runs before this does, might have provided this already # in that case, we want to advertise the _resolver_ address, since it is now # providing the behavior of the actual function if self . project . is_hooked ( resolver_addr ) : return resolver_addr base_state = self . state_blank ( addr = 0 , add_options = { o . SYMBOL_FILL_UNCONSTRAINED_MEMORY , o . SYMBOL_FILL_UNCONSTRAINED_REGISTERS } ) prototype = 'void *x(long)' if isinstance ( self . arch , ArchS390X ) else 'void *x(void)' resolver = self . project . factory . callable ( resolver_addr , concrete_only = True , base_state = base_state , prototype = prototype ) try : if isinstance ( self . arch , ArchS390X ) : # On s390x ifunc resolvers expect hwcaps. val = resolver ( 0 ) else : val = resolver ( ) except AngrCallableMultistateError : _l . error ( "Resolver at %#x failed to resolve! (multivalued)" , resolver_addr ) return None except AngrCallableError : _l . error ( "Resolver at %#x failed to resolve!" , resolver_addr ) return None return val . _model_concrete . value self . project . loader . perform_irelative_relocs ( irelative_resolver )