about summary refs log tree commit diff homepage
path: root/tools
diff options
context:
space:
mode:
authorAndrea Mattavelli <andreamattavelli@users.noreply.github.com>2016-09-15 12:56:46 +0100
committerDan Liew <delcypher@gmail.com>2016-09-15 12:56:46 +0100
commit2a3b9fa786228dadda6d7808dadd8e9a2870b169 (patch)
tree086f2298fe9dc3d6be4339863acef4fa730a7ff1 /tools
parent5bf634f6db66c819ed84476807bcee020e5f21aa (diff)
downloadklee-2a3b9fa786228dadda6d7808dadd8e9a2870b169.tar.gz
Check the existence of the entry point during the initialization of the POSIX runtime. If the check fails, exit with an error. (#457)
Diffstat (limited to 'tools')
-rw-r--r--tools/klee/main.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index 3e469a6e..2143c95b 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -669,6 +669,9 @@ static int initEnv(Module *mainModule) {
   */
 
   Function *mainFn = mainModule->getFunction(EntryPoint);
+  if (!mainFn) {
+    klee_error("'%s' function not found in module.", EntryPoint.c_str());
+  }
 
   if (mainFn->arg_size() < 2) {
     klee_error("Cannot handle ""--posix-runtime"" when main() has less than two arguments.\n");
@@ -1276,7 +1279,6 @@ int main(int argc, char **argv, char **envp) {
   }
 #endif
 
-
   if (WithPOSIXRuntime) {
     int r = initEnv(mainModule);
     if (r != 0)
@@ -1331,8 +1333,7 @@ int main(int argc, char **argv, char **envp) {
   // locale and other data and then calls main.
   Function *mainFn = mainModule->getFunction(EntryPoint);
   if (!mainFn) {
-    llvm::errs() << "'" << EntryPoint << "' function not found in module.\n";
-    return -1;
+    klee_error("'%s' function not found in module.", EntryPoint.c_str());
   }
 
   // FIXME: Change me to std types.