about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorFrank Busse <bb0xfb@gmail.com>2017-11-01 14:40:09 +0000
committerCristian Cadar <c.cadar@imperial.ac.uk>2017-11-24 14:42:35 +0000
commit1b4671cbffd53ab27f48f30aae21da6d08242323 (patch)
tree563066183d8d68125723b776deb0f552e5c66157
parent9caaae0b1b6e52be3c7bb783f3a8be659a1a1869 (diff)
downloadklee-1b4671cbffd53ab27f48f30aae21da6d08242323.tar.gz
klee_make_symbolic: warn on deprecated usage
* terminates state instead of using assertion for illegal argument number
* renames empty names to "unnamed" (otherwise test generation fails)
* deprecates two argument version
-rw-r--r--lib/Core/SpecialFunctionHandler.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/Core/SpecialFunctionHandler.cpp b/lib/Core/SpecialFunctionHandler.cpp
index 88e0d1a0..1c2b245c 100644
--- a/lib/Core/SpecialFunctionHandler.cpp
+++ b/lib/Core/SpecialFunctionHandler.cpp
@@ -665,15 +665,22 @@ void SpecialFunctionHandler::handleMakeSymbolic(ExecutionState &state,
                                                 std::vector<ref<Expr> > &arguments) {
   std::string name;
 
-  // FIXME: For backwards compatibility, we should eventually enforce the
-  // correct arguments.
-  if (arguments.size() == 2) {
+  // FIXME: For backwards compatibility. We should eventually enforce the
+  // correct arguments and types.
+  switch (arguments.size()) {
+    case 2:
+      klee_warning("klee_make_symbolic: deprecated number of arguments (2 instead of 3)");
+      break;
+    case 3:
+      name = readStringAtAddress(state, arguments[2]);
+      break;
+    default:
+      executor.terminateStateOnError(state, "illegal number of arguments to klee_make_symbolic(void*, size_t, char*)", Executor::User);
+      return;
+  }
+  if (name.length() == 0) {
     name = "unnamed";
-  } else {
-    // FIXME: Should be a user.err, not an assert.
-    assert(arguments.size()==3 &&
-           "invalid number of arguments to klee_make_symbolic");  
-    name = readStringAtAddress(state, arguments[2]);
+    klee_warning("klee_make_symbolic: renamed empty name to \"unnamed\"");
   }
 
   Executor::ExactResolutionList rl;