about summary refs log tree commit diff homepage
path: root/tools
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-04-19 15:09:37 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-04-19 15:09:37 +0000
commit3a96dd9b7d46247fea7754fdd54049ee723e11e4 (patch)
treedb3818ecf359a52917c14bc333d66c4dcb744b80 /tools
parent1fed781fa4a729f52505facd29d63814f34b6b17 (diff)
downloadklee-3a96dd9b7d46247fea7754fdd54049ee723e11e4.tar.gz
ktest-tool: Add --write-ints option, for printing 4-byte objects as integers.
 - Patch by Li Xuan Ji!


git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@101774 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rwxr-xr-xtools/ktest-tool/ktest-tool8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/ktest-tool/ktest-tool b/tools/ktest-tool/ktest-tool
index 6e13c602..a19e09a5 100755
--- a/tools/ktest-tool/ktest-tool
+++ b/tools/ktest-tool/ktest-tool
@@ -79,6 +79,9 @@ def main(args):
     op.add_option('','--trim-zeros', dest='trimZeros', action='store_true', 
                   default=False,
                   help='trim trailing zeros')
+    op.add_option('','--write-ints', dest='writeInts', action='store_true',
+                  default=False,
+                  help='convert 4-byte sequences to integers')
     
     opts,args = op.parse_args()
     if not args:
@@ -98,7 +101,10 @@ def main(args):
 
             print 'object %4d: name: %r' % (i, name)
             print 'object %4d: size: %r' % (i, len(data))
-            print 'object %4d: data: %r' % (i, str)
+            if opts.writeInts and len(data) == 4: 
+                print 'object %4d: data: %r' % (i, struct.unpack('i',str)[0])
+            else:
+                print 'object %4d: data: %r' % (i, str)
         if file != args[-1]:
             print