summaryrefslogtreecommitdiffstats
path: root/llvm/tools
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
commit4e0969b50018db5ebb9623ecf79fd732dc77eb62 (patch)
tree03d00f2c1ccc78024e05d361be18300d253fb559 /llvm/tools
parentbad6478b005ac3e457f7a20f96ff90e18d07ed56 (diff)
downloadbcm5719-llvm-4e0969b50018db5ebb9623ecf79fd732dc77eb62.tar.gz
bcm5719-llvm-4e0969b50018db5ebb9623ecf79fd732dc77eb62.zip
Finally give bugpoint -timeout support!
llvm-svn: 15163
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/bugpoint/BugDriver.cpp2
-rw-r--r--llvm/tools/bugpoint/ExecutionDriver.cpp20
2 files changed, 20 insertions, 2 deletions
diff --git a/llvm/tools/bugpoint/BugDriver.cpp b/llvm/tools/bugpoint/BugDriver.cpp
index 1bac8da2437..1826b7b780c 100644
--- a/llvm/tools/bugpoint/BugDriver.cpp
+++ b/llvm/tools/bugpoint/BugDriver.cpp
@@ -156,7 +156,7 @@ bool BugDriver::run() {
//
bool CreatedOutput = false;
if (ReferenceOutputFile.empty()) {
- std::cout << "Generating reference output from raw program...";
+ std::cout << "Generating reference output from raw program: ";
try {
ReferenceOutputFile = executeProgramWithCBE("bugpoint.reference.out");
CreatedOutput = true;
diff --git a/llvm/tools/bugpoint/ExecutionDriver.cpp b/llvm/tools/bugpoint/ExecutionDriver.cpp
index 7d6c4aaaae2..62f0a242a6f 100644
--- a/llvm/tools/bugpoint/ExecutionDriver.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud