about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorMartin Nowack <m.nowack@imperial.ac.uk>2018-09-06 11:29:25 +0100
committerCristian Cadar <c.cadar@imperial.ac.uk>2018-09-10 15:24:17 +0100
commit88e1e0f90eda8c562f5dcf5eaafc45cf2de3522f (patch)
tree5c2e512ce315d158868c2c117296ed518a5fd0d7
parent83fcf1504597b2ee77276d287e70bd0ae8d201ec (diff)
downloadklee-88e1e0f90eda8c562f5dcf5eaafc45cf2de3522f.tar.gz
Unify the error message if that function has not been found.
-rw-r--r--lib/Module/KModule.cpp3
-rw-r--r--lib/Module/ModuleUtil.cpp3
-rw-r--r--test/regression/2016-08-12-empty-file.c2
-rw-r--r--tools/klee/main.cpp4
4 files changed, 7 insertions, 5 deletions
diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp
index 07f3572e..49a1ba69 100644
--- a/lib/Module/KModule.cpp
+++ b/lib/Module/KModule.cpp
@@ -153,7 +153,8 @@ injectStaticConstructorsAndDestructors(Module *m,
 
   Function *mainFn = m->getFunction(entryFunction);
   if (!mainFn)
-    klee_error("Could not find main() function.");
+    klee_error("Entry function '%s' not found in module.",
+               entryFunction.str().c_str());
 
   if (ctors) {
 #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8)
diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp
index 5ca0a55b..5f9a12b7 100644
--- a/lib/Module/ModuleUtil.cpp
+++ b/lib/Module/ModuleUtil.cpp
@@ -223,7 +223,8 @@ klee::linkModules(std::vector<std::unique_ptr<llvm::Module>> &modules,
 
   // fail if not found
   if (!composite) {
-    errorMsg = "'" + entryFunction.str() + "' function not found in module.";
+    errorMsg =
+        "Entry function '" + entryFunction.str() + "' not found in module.";
     return nullptr;
   }
 
diff --git a/test/regression/2016-08-12-empty-file.c b/test/regression/2016-08-12-empty-file.c
index b9650278..fd093d57 100644
--- a/test/regression/2016-08-12-empty-file.c
+++ b/test/regression/2016-08-12-empty-file.c
@@ -7,4 +7,4 @@
 // RUN: not %klee --output-dir=%t.klee-out --posix-runtime %t.bc >%t1.log 2>&1
 // RUN: FileCheck -input-file=%t1.log -check-prefix=CHECK-MAIN-NOT-FOUND %s
 
-// CHECK-MAIN-NOT-FOUND: 'main' function not found in module.
+// CHECK-MAIN-NOT-FOUND: Entry function 'main' not found in module.
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index 0b22f5c1..77b1fe7c 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -639,7 +639,7 @@ preparePOSIX(std::vector<std::unique_ptr<llvm::Module>> &loadedModules,
   }
 
   if (!mainFn)
-    klee_error("'%s' function not found in module.", EntryPoint.c_str());
+    klee_error("Entry function '%s' not found in module.", EntryPoint.c_str());
   mainFn->setName("__klee_posix_wrapped_main");
 
   // Add a definition of the entry function if needed. This is the case if we
@@ -1278,7 +1278,7 @@ int main(int argc, char **argv, char **envp) {
   auto finalModule = interpreter->setModule(loadedModules, Opts);
   Function *mainFn = finalModule->getFunction(EntryPoint);
   if (!mainFn) {
-    klee_error("'%s' function not found in module.", EntryPoint.c_str());
+    klee_error("Entry function '%s' not found in module.", EntryPoint.c_str());
   }
 
   externalsAndGlobalsCheck(finalModule);