aboutsummaryrefslogtreecommitdiffstats
path: root/tools/bugpoint/ExecutionDriver.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-07-24 07:53:26 +0000
committerChris Lattner <sabre@nondot.org>2004-07-24 07:53:26 +0000
commit7d91e49ff7bcc0fd10a54d45a6185bb05adf3d20 (patch)
tree250e875dc6a9fddbe92cad1b15e4071668f1dcde /tools/bugpoint/ExecutionDriver.cpp
parentc47b6677ae8a71d72db42ea74f296bcf6b14a6dc (diff)
downloadexternal_llvm-7d91e49ff7bcc0fd10a54d45a6185bb05adf3d20.zip
external_llvm-7d91e49ff7bcc0fd10a54d45a6185bb05adf3d20.tar.gz
external_llvm-7d91e49ff7bcc0fd10a54d45a6185bb05adf3d20.tar.bz2
Finally give bugpoint -timeout support!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15163 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint/ExecutionDriver.cpp')
-rw-r--r--tools/bugpoint/ExecutionDriver.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/tools/bugpoint/ExecutionDriver.cpp b/tools/bugpoint/ExecutionDriver.cpp
index 7d6c4aa..62f0a24 100644
--- a/tools/bugpoint/ExecutionDriver.cpp
+++ b/tools/bugpoint/ExecutionDriver.cpp
@@ -53,6 +53,11 @@ namespace {
AdditionalSOs("additional-so",
cl::desc("Additional shared objects to load "
"into executing programs"));
+
+ cl::opt<unsigned>
+ TimeoutValue("timeout", cl::init(300), cl::value_desc("seconds"),
+ cl::desc("Number of seconds program is allowed to run before it "
+ "is killed (default is 300s), 0 disables timeout"));
}
namespace llvm {
@@ -201,7 +206,20 @@ std::string BugDriver::executeProgram(std::string OutputFile,
// Actually execute the program!
int RetVal = AI->ExecuteProgram(BytecodeFile, InputArgv, InputFile,
- OutputFile, SharedObjs);
+ OutputFile, SharedObjs, TimeoutValue);
+
+ if (RetVal == -1) {
+ std::cerr << "<timeout>";
+ static bool FirstTimeout = true;
+ if (FirstTimeout) {
+ std::cout << "\n"
+ "*** Program execution timed out! This mechanism is designed to handle\n"
+ " programs stuck in infinite loops gracefully. The -timeout option\n"
+ " can be used to change the timeout threshold or disable it completely\n"
+ " (with -timeout=0). This message is only displayed once.\n";
+ FirstTimeout = false;
+ }
+ }
if (ProgramExitedNonzero != 0)
*ProgramExitedNonzero = (RetVal != 0);