Пример #1
0
    def _build_vector(self, funcs):
        svs = []

        # for each function
        for func in funcs:
            # collect LHS of @LOG_STORE for the specified return value
            rtn_dic = self.pathbin[func]
            symbol_set = set()
            for retpath in rtn_dic.get(self.rtn, []):
                stores = retpath.get_stores()
                if stores == None:
                    continue
                for store in stores:
                    # collect LHS of stor
                    if store.lhs:
                        assert(store.lhs is not None)
                        symbol_set.add(store.lhs)

            # change them to symbol id 
            sym_id_set = set()
            for symbol in symbol_set:
                fo_symbol = filter_out_non_args(symbol)
                if have_args(fo_symbol):
                    sym_id= self.symbol_tbl.get_symbol_id(fo_symbol)
                    sym_id_set.add( str(sym_id) )
            
            sv = StoreVector(func, self.rtn, list(sym_id_set), self.symbol_tbl)
            svs.append(sv)
        return svs
Пример #2
0
    def _build_vector(self, funcs):
        cvs = []

        # for each function
        for func in funcs:
            # create condition vector
            cv = CondVector(func, self.rtn)

            # collect @CONDITION for the specified return value
            rtn_dic = self.pathbin[func]
            symbol_set = set()
            for retpath in rtn_dic.get(self.rtn, []):
                conds = retpath.get_conds()
                if conds == None:
                    continue

                # create a temp. condition vector for a single path condition 
                tcv = CondVector(func, self.rtn)
                for cond in conds:
                    # first, decide whether a cond is included or not
                    if self.__filter_out_cond(cond):
                        continue
                    nexpr = filter_out_non_args(cond.expr)
                    if not have_args(nexpr):
                        continue
                    # add {nexpr, ranges} to the vector 
                    tcv.add(nexpr, rsf.build([cond.ranges]))

                # add a single path condition to the condition vector for return
                cv.add_path(tcv)

            # now, a condition vector is ready. 
            cv.normalize()
            cvs.append(cv)
        return cvs
Пример #3
0
    def _build_vector(self, funcs):
        svs = []

        # for each function
        for func in funcs:
            # collect LHS of @LOG_STORE for the specified return value
            rtn_dic = self.pathbin[func]
            symbol_set = set()
            for retpath in rtn_dic.get(self.rtn, []):
                stores = retpath.get_stores()
                if stores == None:
                    continue
                for store in stores:
                    # collect LHS of stor
                    if store.lhs:
                        assert (store.lhs is not None)
                        symbol_set.add(store.lhs)

            # change them to symbol id
            sym_id_set = set()
            for symbol in symbol_set:
                fo_symbol = filter_out_non_args(symbol)
                if have_args(fo_symbol):
                    sym_id = self.symbol_tbl.get_symbol_id(fo_symbol)
                    sym_id_set.add(str(sym_id))

            sv = StoreVector(func, self.rtn, list(sym_id_set), self.symbol_tbl)
            svs.append(sv)
        return svs