Improve bugpoint's error messages when it runs out of memory,
authorDan Gohman <gohman@apple.com>
Mon, 27 Apr 2009 01:30:37 +0000 (01:30 +0000)
committerDan Gohman <gohman@apple.com>
Mon, 27 Apr 2009 01:30:37 +0000 (01:30 +0000)
or when some other std::exception is thrown.

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

tools/bugpoint/bugpoint.cpp

index 543512ce6249d1727f8e509715e8f35fdc140fcc..20f0e99a848881b40180c27afef40bb912d05ce5 100644 (file)
@@ -88,6 +88,14 @@ int main(int argc, char **argv) {
     std::cerr << "Tool execution error: " << TEE.what() << '\n';
   } catch (const std::string& msg) {
     std::cerr << argv[0] << ": " << msg << "\n";
+  } catch (const std::bad_alloc &e) {
+    std::cerr << "Oh no, a bugpoint process ran out of memory!\n"
+                 "To increase the allocation limits for bugpoint child\n"
+                 "processes, use the -mlimit option.\n";
+  } catch (const std::exception &e) {
+    std::cerr << "Whoops, a std::exception leaked out of bugpoint: "
+              << e.what() << "\n"
+              << "This is a bug in bugpoint!\n";
   } catch (...) {
     std::cerr << "Whoops, an exception leaked out of bugpoint.  "
               << "This is a bug in bugpoint!\n";