[llvm-commits] [klee] r72306 - in /klee/trunk/tools: Makefile klee-bout-tool/ ktest-tool/ ktest-tool/Makefile ktest-tool/klee-bout-tool ktest-tool/ktest-tool
Cristian Cadar
cristic at cs.stanford.edu
Fri May 22 18:13:12 PDT 2009
Author: cristic
Date: Fri May 22 20:13:11 2009
New Revision: 72306
URL: http://llvm.org/viewvc/llvm-project?rev=72306&view=rev
Log:
Renamed klee-bout-tool to ktest-tool.
Added:
klee/trunk/tools/ktest-tool/
- copied from r72305, klee/trunk/tools/klee-bout-tool/
klee/trunk/tools/ktest-tool/ktest-tool
- copied unchanged from r72305, klee/trunk/tools/klee-bout-tool/klee-bout-tool
Removed:
klee/trunk/tools/klee-bout-tool/
klee/trunk/tools/ktest-tool/klee-bout-tool
Modified:
klee/trunk/tools/Makefile
klee/trunk/tools/ktest-tool/Makefile
Modified: klee/trunk/tools/Makefile
URL: http://llvm.org/viewvc/llvm-project/klee/trunk/tools/Makefile?rev=72306&r1=72305&r2=72306&view=diff
==============================================================================
--- klee/trunk/tools/Makefile (original)
+++ klee/trunk/tools/Makefile Fri May 22 20:13:11 2009
@@ -15,7 +15,7 @@
#
# List all of the subdirectories that we will compile.
#
-PARALLEL_DIRS=klee kleaver klee-bout-tool gen-random-bout
+PARALLEL_DIRS=klee kleaver ktest-tool gen-random-bout
# FIXME: Move qplayer functionality into kleaver
include $(LEVEL)/Makefile.common
Modified: klee/trunk/tools/ktest-tool/Makefile
URL: http://llvm.org/viewvc/llvm-project/klee/trunk/tools/ktest-tool/Makefile?rev=72306&r1=72305&r2=72306&view=diff
==============================================================================
--- klee/trunk/tools/ktest-tool/Makefile (original)
+++ klee/trunk/tools/ktest-tool/Makefile Fri May 22 20:13:11 2009
@@ -1,4 +1,4 @@
-#===-- tools/klee-bout-tool/Makefile -----------------------*- Makefile -*--===#
+#===-- tools/ktest-tool/Makefile -----------------------*- Makefile -*--===#
#
# The KLEE Symbolic Virtual Machine
#
@@ -9,7 +9,7 @@
LEVEL = ../..
-TOOLSCRIPTNAME := klee-bout-tool
+TOOLSCRIPTNAME := ktest-tool
include $(LEVEL)/Makefile.common
Removed: klee/trunk/tools/ktest-tool/klee-bout-tool
URL: http://llvm.org/viewvc/llvm-project/klee/trunk/tools/klee-bout-tool/klee-bout-tool?rev=72305&view=auto
==============================================================================
--- klee/trunk/tools/ktest-tool/klee-bout-tool (original)
+++ klee/trunk/tools/ktest-tool/klee-bout-tool (removed)
@@ -1,106 +0,0 @@
-#!/usr/bin/python
-
-import os
-import struct
-import sys
-
-version_no=2
-
-class BOutError(Exception):
- pass
-
-class BOut:
- @staticmethod
- def fromfile(path):
- if not os.path.exists(path):
- print "ERROR: file %s not found" % (path)
- sys.exit(1)
-
- f = open(path,'rb')
- hdr = f.read(5)
- if len(hdr)!=5 or hdr!='BOUT\n':
- raise BOutError,'unrecognized file'
- version, = struct.unpack('>i', f.read(4))
- if version > version_no:
- raise BOutError,'unrecognized version'
- numArgs, = struct.unpack('>i', f.read(4))
- args = []
- for i in range(numArgs):
- size, = struct.unpack('>i', f.read(4))
- args.append(f.read(size))
-
- if version >= 2:
- symArgvs, = struct.unpack('>i', f.read(4))
- symArgvLen, = struct.unpack('>i', f.read(4))
- else:
- symArgvs = 0
- symArgvLen = 0
-
- numObjects, = struct.unpack('>i', f.read(4))
- objects = []
- for i in range(numObjects):
- size, = struct.unpack('>i', f.read(4))
- name = f.read(size)
- size, = struct.unpack('>i', f.read(4))
- bytes = f.read(size)
- objects.append( (name,bytes) )
-
- # Create an instance
- b = BOut(version, args, symArgvs, symArgvLen, objects)
- # Augment with extra filename field
- b.filename = path
- return b
-
- def __init__(self, version, args, symArgvs, symArgvLen, objects):
- self.version = version
- self.symArgvs = symArgvs
- self.symArgvLen = symArgvLen
- self.args = args
- self.objects = objects
-
- # add a field that represents the name of the program used to
- # generate this .bout file:
- program_full_path = self.args[0]
- program_name = os.path.basename(program_full_path)
- # sometimes program names end in .bc, so strip them
- if program_name.endswith('.bc'):
- program_name = program_name[:-3]
- self.programName = program_name
-
-def trimZeros(str):
- for i in range(len(str))[::-1]:
- if str[i] != '\x00':
- return str[:i+1]
- return ''
-
-def main(args):
- from optparse import OptionParser
- op = OptionParser("usage: %prog [options] files")
- op.add_option('','--trim-zeros', dest='trimZeros', action='store_true',
- default=False,
- help='trim trailing zeros')
-
- opts,args = op.parse_args()
- if not args:
- op.error("incorrect number of arguments")
-
- for file in args:
- b = BOut.fromfile(file)
- pos = 0
- print 'bout file : %r' % file
- print 'args : %r' % b.args
- print 'num objects: %r' % len(b.objects)
- for i,(name,data) in enumerate(b.objects):
- if opts.trimZeros:
- str = trimZeros(data)
- else:
- str = data
-
- print 'object %4d: name: %r' % (i, name)
- print 'object %4d: size: %r' % (i, len(data))
- print 'object %4d: data: %r' % (i, str)
- if file != args[-1]:
- print
-
-if __name__=='__main__':
- main(sys.argv)
More information about the llvm-commits
mailing list