MrSlippery

Running KLEE to Find a Magic Square

Feb 18th, 2016
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.69 KB | None | 0 0
  1. user@host:~/magic$ clang -emit-llvm -g -c magicsquare.c -I ../include -I../klee/include
  2. magicsquare.c:85:2: warning: implicit declaration of function '__assert_fail' is invalid in C99
  3.       [-Wimplicit-function-declaration]
  4.         klee_assert(!magic());
  5.         ^
  6. ../klee/include/klee/klee.h:96:6: note: expanded from macro 'klee_assert'
  7.    : __assert_fail (#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__))    \
  8.      ^
  9. 1 warning generated.
  10. user@host:~/magic$ time klee --libc=uclibc --posix-runtime magicsquare.bc
  11. KLEE: NOTE: Using klee-uclibc : /home/user/klee/Release+Asserts/lib/klee-uclibc.bca
  12. KLEE: NOTE: Using model: /home/user/klee/Release+Asserts/lib/libkleeRuntimePOSIX.bca
  13. KLEE: output directory is "/home/user/magic/klee-out-4"
  14. KLEE: WARNING: undefined reference to function: klee_posix_prefer_cex
  15. KLEE: WARNING ONCE: calling external: syscall(16, 0, 21505, 38035904)
  16. KLEE: WARNING ONCE: calling __user_main with extra arguments.
  17. KLEE: ERROR: /home/user/magic/magicsquare.c:85: ASSERTION FAIL: !magic()
  18. KLEE: NOTE: now ignoring this error at this location
  19.  
  20. KLEE: done: total instructions = 16605
  21. KLEE: done: completed paths = 172
  22. KLEE: done: generated tests = 172
  23.  
  24. real    0m52.896s
  25. user    0m51.102s
  26. sys 0m1.729s
  27. user@host:~/magic$ ls klee-last/*.err
  28. klee-last/test000153.assert.err
  29. user@host:~/magic$ ktest-tool klee-last/test000153.ktest
  30. ktest file : 'klee-last/test000153.ktest'
  31. args       : ['magicsquare.bc']
  32. num objects: 2
  33. object    0: name: 'model_version'
  34. object    0: size: 4
  35. object    0: data: '\x01\x00\x00\x00'
  36. object    1: name: 'square'
  37. object    1: size: 9
  38. object    1: data: '\x04\x03\x08\t\x05\x01\x02\x07\x06'
  39.  
  40. ... and, since \t == 9, that would be:
  41. 4 3 8
  42. 9 5 1
  43. 2 7 6
Advertisement
Add Comment
Please, Sign In to add comment