Fix for bug 391.
authorReid Spencer <rspencer@reidspencer.com>
Wed, 7 Jul 2004 21:01:38 +0000 (21:01 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Wed, 7 Jul 2004 21:01:38 +0000 (21:01 +0000)
Improve exeception handling around bcreader invocations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14674 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/ExecutionEngine.cpp
lib/ExecutionEngine/JIT/JIT.cpp
lib/VMCore/Pass.cpp

index c9fd5776546cbfad5c4acc8dd5e2d72afa68f235..4ece8b9c84ba29fc35dbbdb3292f57478f85aebb 100644 (file)
@@ -137,6 +137,8 @@ ExecutionEngine *ExecutionEngine::create(ModuleProvider *MP,
       } catch (...) {
         std::cerr << "Error creating the interpreter!\n";
       }
+    } catch (std::string& errmsg) {
+      std::cerr << "Error reading the bytecode file: " << errmsg << "\n";
     } catch (...) {
       std::cerr << "Error reading the bytecode file!\n";
     }
index 5340a19e3ed041d902f033dd120a06db85398c49..02577df3c424e91f6554effe567eb452c304e740 100644 (file)
@@ -117,6 +117,9 @@ void *JIT::getPointerToFunction(Function *F) {
   // Make sure we read in the function if it exists in this Module
   try {
     MP->materializeFunction(F);
+  } catch ( std::string& errmsg ) {
+    std::cerr << "Error parsing bytecode file: " << errmsg << "\n";
+    abort();
   } catch (...) {
     std::cerr << "Error parsing bytecode file!\n";
     abort();
index 88813297ec6f196a4858724553d23303587e3c6d..b37b4601da9cc9cce76510475dd8ba995a1d9c8b 100644 (file)
@@ -92,7 +92,15 @@ FunctionPassManager::~FunctionPassManager() { delete PM; }
 void FunctionPassManager::add(FunctionPass *P) { PM->add(P); }
 void FunctionPassManager::add(ImmutablePass *IP) { PM->add(IP); }
 bool FunctionPassManager::run(Function &F) { 
-  MP->materializeFunction(&F);
+  try {
+    MP->materializeFunction(&F);
+  } catch (std::string& errstr) {
+    std::cerr << "Error reading bytecode file: " << errstr << "\n";
+    abort();
+  } catch (...) {
+    std::cerr << "Error reading bytecode file:\n";
+    abort();
+  }
   return PM->run(F); 
 }