(self)
return cc, prototype
Get the calling convention for a PLT stub.

        :return:    A calling convention.
Get the calling convention for a PLT stub.
Get the calling convention for a PLT stub .
def _analyze_plt(self) -> Optional[Tuple[SimCC,SimTypeFunction]]:
        """
        Get the calling convention for a PLT stub.

        :return:    A calling convention.
        """

        if len(self._function.jumpout_sites) != 1:
            l.warning("%r has more than one jumpout sites. It does not look like a PLT stub. Please report to GitHub.",
                      self._function)
            return None

        jo_site = self._function.jumpout_sites[0]

        successors = list(self._function.transition_graph.successors(jo_site))
        if len(successors) != 1:
            l.warning("%r has more than one successors. It does not look like a PLT stub. Please report to GitHub.",
                      self._function)
            return None

        try:
            real_func = self.kb.functions.get_by_addr(successors[0].addr)
        except KeyError:
            # the real function does not exist for some reason
            real_func = None

        if real_func is not None:
            if real_func.is_simprocedure and self.project.is_hooked(real_func.addr):
                hooker = self.project.hooked_by(real_func.addr)
                if hooker is not None and not hooker.is_stub:
                    return real_func.calling_convention, real_func.prototype
            else:
                return real_func.calling_convention, real_func.prototype

        # determine the calling convention by analyzing its callsites
        callsite_facts = self._analyze_callsites(max_analyzing_callsites=1)
        cc = DefaultCC[self.project.arch.name](self.project.arch)
        prototype = SimTypeFunction([ ], None)
        prototype = self._adjust_prototype(prototype, callsite_facts,
                                           update_arguments=UpdateArgumentsOption.AlwaysUpdate)
        return cc, prototype
def _analyze_plt ( self ) -> Optional [ Tuple [ SimCC , SimTypeFunction ] ] : if len ( self . _function . jumpout_sites ) != 1 : l . warning ( "%r has more than one jumpout sites. It does not look like a PLT stub. Please report to GitHub." , self . _function ) return None jo_site = self . _function . jumpout_sites [ 0 ] successors = list ( self . _function . transition_graph . successors ( jo_site ) ) if len ( successors ) != 1 : l . warning ( "%r has more than one successors. It does not look like a PLT stub. Please report to GitHub." , self . _function ) return None try : real_func = self . kb . functions . get_by_addr ( successors [ 0 ] . addr ) except KeyError : # the real function does not exist for some reason real_func = None if real_func is not None : if real_func . is_simprocedure and self . project . is_hooked ( real_func . addr ) : hooker = self . project . hooked_by ( real_func . addr ) if hooker is not None and not hooker . is_stub : return real_func . calling_convention , real_func . prototype else : return real_func . calling_convention , real_func . prototype # determine the calling convention by analyzing its callsites callsite_facts = self . _analyze_callsites ( max_analyzing_callsites = 1 ) cc = DefaultCC [ self . project . arch . name ] ( self . project . arch ) prototype = SimTypeFunction ( [ ] , None ) prototype = self . _adjust_prototype ( prototype , callsite_facts , update_arguments = UpdateArgumentsOption . AlwaysUpdate ) return cc , prototype