Beispiel #1
0
    def actions_before_verification(self, symbiotic):
        if self._use_llvm_backend:
            return

        output = symbiotic.curfile + '.c'
        runcmd(['llvm2c', symbiotic.curfile, '--o', output], DbgWatch('all'))
        symbiotic.curfile = output
Beispiel #2
0
 def actions_before_verification(self, symbiotic):
     # link our specific funs
     self._options.linkundef = ['verifier']
     symbiotic.link_undefined(
         only_func=['__VERIFIER_silent_exit', '__VERIFIER_exit'])
     self._options.linkundef = []
     # translate to C
     output = symbiotic.curfile + '.c'
     runcmd(['llvm2c', symbiotic.curfile, '--add-includes', '--o', output],
            DbgWatch('all'))
     symbiotic.curfile = output
Beispiel #3
0
 def actions_before_verification(self, symbiotic):
     # link our specific funs
     old_undf = self._options.linkundef
     self._options.linkundef = ['verifier']
     funs = ['__VERIFIER_silent_exit', '__VERIFIER_exit',
             '__INSTR_check_nontermination', '__INSTR_fail']
     symbiotic.link_undefined(only_func=funs)
     self._options.linkundef = old_undf
     # translate to C
     output = symbiotic.curfile + '.c'
     runcmd(['llvm2c', symbiotic.curfile, '--add-includes', '--o', output],
             DbgWatch('all'))
     symbiotic.curfile = output
Beispiel #4
0
    def actions_before_verification(self, symbiotic):
        # link our specific funs
        self._options.linkundef = ['verifier']
        symbiotic.link_undefined(
            only_func=['__VERIFIER_silent_exit', '__VERIFIER_exit'])
        self._options.linkundef = []

        if self._use_llvm_backend:
            return

        output = symbiotic.curfile + '.c'
        runcmd([
            'llvm2c', symbiotic.curfile, '--no-function-call-casts', '--o',
            output
        ], DbgWatch('all'))
        symbiotic.curfile = output
Beispiel #5
0
def generate_exec_witness(bindir, sources, opts, saveto = None):
    assert len(sources) == 1 and "Can not generate witnesses for more sources yet"
    if saveto is None:
        saveto = '{0}.exe'.format(sources[:sources.rfind('.')])
    print('Generating executable witness to : {0}'.format(saveto))

    if opts.test_comp:
        pth = get_harness_file(join(opts.testsuite_output))
    else:
        pth = get_harness_file(join(bindir, 'klee-last'))

    from symbiotic.exceptions import SymbioticException
    try:
        from symbiotic.transform import CompileWatch
        flags = ['-D__inline=']
        if opts.property.memsafety():
            flags+=['-fsanitize=address']
        elif opts.property.signedoverflow() or opts.property.undefinedness():
            flags+=['-fsanitize=undefined']
        runcmd(['clang', '-g', pth, sources[0], '-o', saveto] + flags,
               CompileWatch(), 'Generating executable witness failed')
    except SymbioticException as e:
        dbg(str(e))
Beispiel #6
0
 def actions_before_verification(self, symbiotic):
     output = symbiotic.curfile + '.c'
     runcmd(['llvm2c', symbiotic.curfile, '--o', output],
             DbgWatch('all'))
     symbiotic.curfile = output
Beispiel #7
0
 def actions_after_slicing(self, symbiotic):
     llvmfile = symbiotic.llvmfile
     newfile = '{0}-unrolled.bc'.format(llvmfile[:-3])
     runcmd(['nidhugg', '-unroll=5', llvmfile, '-transform', newfile])
     symbiotic.llvmfile = newfile