return Result;
}
-BugDriver::BugDriver(const char *toolname, bool as_child)
+BugDriver::BugDriver(const char *toolname, bool as_child, unsigned timeout)
: ToolName(toolname), ReferenceOutputFile(OutputFile),
- Program(0), Interpreter(0), cbe(0), gcc(0), run_as_child(as_child) {}
+ Program(0), Interpreter(0), cbe(0), gcc(0), run_as_child(as_child),
+ Timeout(timeout) {}
/// ParseInputFile - Given a bytecode or assembly input filename, parse and
CBE *cbe;
GCC *gcc;
bool run_as_child;
+ unsigned Timeout;
// FIXME: sort out public/private distinctions...
friend class ReducePassList;
friend class ReduceMisCodegenFunctions;
public:
- BugDriver(const char *toolname, bool as_child);
+ BugDriver(const char *toolname, bool as_child, unsigned timeout);
const std::string &getToolName() const { return ToolName; }
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"));
-
cl::list<std::string>
AdditionalLinkerArgs("Xlinker",
cl::desc("Additional arguments to pass to the linker"));
if (InterpreterSel == RunLLC || InterpreterSel == RunCBE)
RetVal = AI->ExecuteProgram(BytecodeFile, InputArgv, InputFile,
OutputFile, AdditionalLinkerArgs, SharedObjs,
- TimeoutValue);
+ Timeout);
else
RetVal = AI->ExecuteProgram(BytecodeFile, InputArgv, InputFile,
OutputFile, std::vector<std::string>(),
- SharedObjs, TimeoutValue);
+ SharedObjs, Timeout);
if (RetVal == -1) {
std::cerr << "<timeout>";
args[n++] = 0;
sys::Path prog(sys::Program::FindProgramByName(ToolName));
- int result = sys::Program::ExecuteAndWait(prog,args);
+ int result = sys::Program::ExecuteAndWait(prog,args,0,0,Timeout);
// If we are supposed to delete the bytecode file or if the passes crashed,
// remove it now. This may fail if the file was never created, but that's ok.
InputFilenames(cl::Positional, cl::OneOrMore,
cl::desc("<input llvm ll/bc files>"));
+static 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"));
+
// The AnalysesList is automatically populated with registered Passes by the
// PassNameParser.
//
sys::PrintStackTraceOnErrorSignal();
sys::SetInterruptFunction(BugpointInterruptFunction);
- BugDriver D(argv[0],AsChild);
+ BugDriver D(argv[0],AsChild,TimeoutValue);
if (D.addSources(InputFilenames)) return 1;
D.addPasses(PassList.begin(), PassList.end());