(self, b)
Perform a pre-check on the slice to determine whether it is a jump table or not. Please refer to the docstring
        of JumpTableProcessor for how precheck and statement instrumentation works. A NotAJumpTableNotification
        exception will be raised if the slice fails this precheck.

        :param b:   The statement slice generated by Blade.
        :return:    A list of statements to instrument, and a list of of registers to initialize.
        :rtype:     tuple of lists
Perform a pre-check on the slice to determine whether it is a jump table or not. Please refer to the docstring
        of JumpTableProcessor for how precheck and statement instrumentation works. A NotAJumpTableNotification
        exception will be raised if the slice fails this precheck.
Perform a pre - check on the slice to determine whether it is a jump table or not . Please refer to the docstring of JumpTableProcessor for how precheck and statement instrumentation works . A NotAJumpTableNotification exception will be raised if the slice fails this precheck .
def _jumptable_precheck(self, b):
        """
        Perform a pre-check on the slice to determine whether it is a jump table or not. Please refer to the docstring
        of JumpTableProcessor for how precheck and statement instrumentation works. A NotAJumpTableNotification
        exception will be raised if the slice fails this precheck.

        :param b:   The statement slice generated by Blade.
        :return:    A list of statements to instrument, and a list of of registers to initialize.
        :rtype:     tuple of lists
        """

        # pylint:disable=no-else-continue

        engine = JumpTableProcessor(self.project)

        sources = [ n for n in b.slice.nodes() if b.slice.in_degree(n) == 0 ]

        annotatedcfg = AnnotatedCFG(self.project, None, detect_loops=False)
        annotatedcfg.from_digraph(b.slice)

        for src in sources:
            state = JumpTableProcessorState(self.project.arch)
            traced = { src[0] }
            while src is not None:
                state._tmpvar_source.clear()
                block_addr, _ = src

                block = self.project.factory.block(block_addr, cross_insn_opt=True, backup_state=self.base_state)
                stmt_whitelist = annotatedcfg.get_whitelisted_statements(block_addr)
                engine.process(state, block=block, whitelist=stmt_whitelist)

                if state.is_jumptable:
                    return state.stmts_to_instrument, state.regs_to_initialize
                if state.is_jumptable is False:
                    raise NotAJumpTableNotification()

                # find the next block
                src = None
                for idx in reversed(stmt_whitelist):
                    loc = (block_addr, idx)
                    successors = list(b.slice.successors(loc))
                    if len(successors) == 1:
                        block_addr_ = successors[0][0]
                        if block_addr_ not in traced:
                            src = successors[0]
                            traced.add(block_addr_)
                            break

        raise NotAJumpTableNotification()
def _jumptable_precheck ( self , b ) : # pylint:disable=no-else-continue engine = JumpTableProcessor ( self . project ) sources = [ n for n in b . slice . nodes ( ) if b . slice . in_degree ( n ) == 0 ] annotatedcfg = AnnotatedCFG ( self . project , None , detect_loops = False ) annotatedcfg . from_digraph ( b . slice ) for src in sources : state = JumpTableProcessorState ( self . project . arch ) traced = { src [ 0 ] } while src is not None : state . _tmpvar_source . clear ( ) block_addr , _ = src block = self . project . factory . block ( block_addr , cross_insn_opt = True , backup_state = self . base_state ) stmt_whitelist = annotatedcfg . get_whitelisted_statements ( block_addr ) engine . process ( state , block = block , whitelist = stmt_whitelist ) if state . is_jumptable : return state . stmts_to_instrument , state . regs_to_initialize if state . is_jumptable is False : raise NotAJumpTableNotification ( ) # find the next block src = None for idx in reversed ( stmt_whitelist ) : loc = ( block_addr , idx ) successors = list ( b . slice . successors ( loc ) ) if len ( successors ) == 1 : block_addr_ = successors [ 0 ] [ 0 ] if block_addr_ not in traced : src = successors [ 0 ] traced . add ( block_addr_ ) break raise NotAJumpTableNotification ( )