def setUp(self): import esbmc # cwd = regression/python self.ns, self.opts, self.po = esbmc.init_esbmc_process( ['test_data/00_big_endian_01/main.c', '--big-endian', '--bv']) self.funcs = self.po.goto_functions self.main = self.funcs.function_map[esbmc.irep_idt('c::main')].body
def setUp(self): import esbmc # cwd = regression/python self.ns, self.opts, self.po = esbmc.init_esbmc_process(['test_data/00_big_endian_01/main.c', '--big-endian', '--bv']) self.funcs = self.po.goto_functions self.main = self.funcs.function_map[esbmc.irep_idt('main')].body self.insns = self.main.get_instructions()
def test_args(self): import esbmc # Had a problem in the past with the arg list being reversed... ns, opts, po = esbmc.init_esbmc_process([ './test_data/00_big_endian_01/main.c', '--timeout', '1m', '--memlimit', '1g' ]) esbmc.kill_esbmc_process()
def setUp(self): import esbmc # cwd = regression/python self.ns, self.opts, self.po = esbmc.init_esbmc_process(['test_data/00_big_endian_01/main.c', '--big-endian', '--bv']) self.funcs = self.po.goto_functions self.main = self.funcs.function_map[esbmc.irep_idt('main')].body self.eq = esbmc.symex.equation(self.ns) self.art = esbmc.symex.reachability_tree(self.po.goto_functions, self.ns, self.opts, self.eq, self.po.context, self.po.message_handler)
def setUp(self): import esbmc # cwd = regression/python self.ns, self.opts, self.po = esbmc.init_esbmc_process( ['test_data/00_big_endian_01/main.c', '--big-endian', '--bv']) self.funcs = self.po.goto_functions self.main = self.funcs.function_map[esbmc.irep_idt('c::main')].body self.eq = esbmc.symex.equation(self.ns) self.art = esbmc.symex.reachability_tree(self.po.goto_functions, self.ns, self.opts, self.eq, self.po.context, self.po.message_handler)
def setUp(self): import esbmc # cwd = regression/python self.ns, self.opts, self.po = esbmc.init_esbmc_process(['test_data/00_big_endian_01/main.c', '--big-endian', '--bv']) self.funcs = self.po.goto_functions self.main = self.funcs.function_map[esbmc.irep_idt('main')].body self.eq = esbmc.symex.equation(self.ns) self.art = esbmc.symex.reachability_tree(self.po.goto_functions, self.ns, self.opts, self.eq, self.po.context, self.po.message_handler) # Step that art once... self.art.setup_for_new_explore() self.art.get_cur_state().symex_step(self.art) self.curstate = self.art.get_cur_state()
def setUp(self): import esbmc # cwd = regression/python self.ns, self.opts, self.po = esbmc.init_esbmc_process( ['test_data/00_big_endian_01/main.c', '--big-endian', '--bv']) self.funcs = self.po.goto_functions self.main = self.funcs.function_map[esbmc.irep_idt('c::main')].body self.eq = esbmc.symex.equation(self.ns) self.art = esbmc.symex.reachability_tree(self.po.goto_functions, self.ns, self.opts, self.eq, self.po.context, self.po.message_handler) # Step that art once... self.art.setup_for_new_explore() self.art.get_cur_state().symex_step(self.art) self.curstate = self.art.get_cur_state()
#!/usr/bin/python3 import sys import esbmc # Cruft for running below. Pass command line options through to esbmc. # Hopefully this means we effectively wrap esbmc. ns, opts, po = esbmc.init_esbmc_process(sys.argv[1:]) eq = esbmc.symex.equation(ns) art = esbmc.symex.reachability_tree(po.goto_functions, ns, opts, eq, po.context, po.message_handler) art.setup_for_new_explore() result = art.get_next_formula() if result.remaining_claims == 0: print('No remaining claims') print("VERIFICATION SUCCESSFUL") sys.exit(0) esbmc.symex.slice(result.target) lolsolve = esbmc.solve.solvers.z3.make(False, ns, opts) result.target.convert(lolsolve) issat = lolsolve.dec_solve() if issat == esbmc.solve.smt_result.sat: trace = esbmc.symex.goto_tracet() esbmc.symex.build_goto_trace(result.target, lolsolve, trace) print(trace.to_string(ns)) print("VERIFICATION FAILED") elif issat == esbmc.solve.smt_result.unsat: print("VERIFICATION SUCCESSFUL") else:
def setUp(self): import esbmc # cwd = regression/python self.ns, self.opts, self.po = esbmc.init_esbmc_process(['test_data/00_big_endian_01/main.c', '--big-endian', '--bv']) self.funcs = self.po.goto_functions
def test_setup(self): import esbmc # Assumes cwd = python test dir ns, opts, po = esbmc.init_esbmc_process( ['./test_data/00_big_endian_01/main.c']) esbmc.kill_esbmc_process()
#!/usr/bin/python3 import sys import esbmc from esbmc.goto_programs import goto_program_instruction_type as gptypes # Arguments: Anything on the command line, and callintercept.c args = sys.argv[1:] # This may be an empty list args.append('callintercept.c') ns, opts, po = esbmc.init_esbmc_process(args) class ExState2(esbmc.symex.execution_state.dfs_execution_state): def __init__(self, *posargs): # Call superclass constructor super(ExState2, self).__init__(*posargs) def symex_step(self, art): # Pick out src obj gss = art.get_cur_state().get_active_state() src = gss.source # pc becomes an insn number, lookup insns. Select current insn insns = src.prog.get_instructions() localpc = src.pc - insns[0].location_number insn = src.prog.get_instructions()[localpc] normal = True if insn.type == gptypes.FUNCTION_CALL: # Pick out function calls call = esbmc.downcast_expr(insn.code) sym = esbmc.downcast_expr(call.function)