1 //===- bugpoint.cpp - The LLVM BugPoint utility ---------------------------===//
3 // This program is an automated compiler debugger tool. It is used to narrow
4 // down miscompilations and crash problems to a specific pass in the compiler,
5 // and the specific Module or Function input that is causing the problem.
7 //===----------------------------------------------------------------------===//
10 #include "llvm/Support/PassNameParser.h"
11 #include "Support/CommandLine.h"
12 #include "Config/unistd.h"
13 #include <sys/resource.h>
15 static cl::list<std::string>
16 InputFilenames(cl::Positional, cl::OneOrMore,
17 cl::desc("<input llvm ll/bc files>"));
19 // The AnalysesList is automatically populated with registered Passes by the
22 static cl::list<const PassInfo*, bool, PassNameParser>
23 PassList(cl::desc("Passes available:"), cl::ZeroOrMore);
25 int main(int argc, char **argv) {
26 cl::ParseCommandLineOptions(argc, argv);
29 if (D.addSources(InputFilenames)) return 1;
30 D.addPasses(PassList.begin(), PassList.end());
32 // Bugpoint has the ability of generating a plethora of core files, so to
33 // avoid filling up the disk, set the max core file size to 0.
35 rlim.rlim_cur = rlim.rlim_max = 0;
36 int res = setrlimit(RLIMIT_CORE, &rlim);
38 // setrlimit() may have failed, but we're not going to let that stop us
39 perror("setrlimit: RLIMIT_CORE");