BUGPOINT(1)
π BUGPOINT(1) β the LLVM one, bestie
okay so real talk: this is bugpoint(1) from the LLVM manual, and it's genuinely the loml of debugging tools. buckle up π
β¨ NAME β¨
bugpoint β the automatic test case reduction tool, aka the friend who takes your 40,000-line nightmare and hands you back the three lines that actually matter. icon behavior.
πΈ SYNOPSIS πΈ
bugpoint [options] [input LLVM ll/bc files] [LLVM passes] --args program
arguments
π¦ DESCRIPTION π¦
bugpoint narrows down the source of problems in LLVM tools and passes. literally its whole job. π
it can debug three types of failures, no cap:
- optimizer crashes π
- miscompilations by optimizers π
- bad native code generation β including problems in the static and JIT compilers π₯
the goal? take a large test case and reduce it to a small, useful one. it's giving glow-up, but for test cases.
for more info on the design and inner workings of bugpoint, plus advice for using bugpoint, see LLVM bugpoint tool: design and usage in the LLVM distribution. iykyk π
π OPTIONS π
--additional-solibrary β loads the dynamic shared object library into the test program whenever it runs. this is useful if you're debugging programs which depend on non-LLVM libraries (like the X or curses libraries) to run. we love a supporting cast π«Ά--append-exit-code={true,false}β appends the test program's exit code to the output file so that a change in exit code counts as a test failure. defaults tofalse. no accidental vibes-based passing, periodt.--argsprogram args β passes all arguments specified after--argsto the test program whenever it runs. β οΈ note that if any of the program args start with a-, you should use:
bugpoint [bugpoint args] --args -- [program args]
the -- right after the --args option tells bugpoint to consider any options starting with - to be part of the --args option, NOT as options to bugpoint itself. so basically -- is the bouncer at the club πͺ
--tool-argstool args β passes all arguments specified after--tool-argsto the LLVM tool under test (llc,lli, etc.) whenever it runs. use it like this:
bugpoint [bugpoint args] --tool-args -- [tool args]
the -- right after the --tool-args option tells bugpoint to consider any options starting with - to be part of the --tool-args option, not as options to bugpoint itself. (see --args, above.) π«
--safe-tool-argstool args β passes all arguments specified after--safe-tool-argsto the "safe" execution tool.--gcc-tool-argsgcc tool args β passes all arguments specified after--gcc-tool-argsto the invocation ofgcc.--opt-argsopt args β passes all arguments specified after--opt-argsto the invocation ofopt.--disable-{dce,simplifycfg}β do not run the specified passes to clean up and reduce the size of the test program. by default,bugpointuses these passes internally when attempting to reduce test programs. π¨ but heads up: if you're trying to find a bug in one of these passes,bugpointmay crash. you've been warned, babe.--enable-valgrindβ usesvalgrindto find faults in the optimization phase. this letsbugpointfind otherwise asymptomatic problems caused by memory mis-management. detective mode π-find-bugsβ continually randomizes the specified passes and runs them on the test program until a bug is found or the user killsbugpoint. it's giving chaos gremlin and honestly? respect πͺοΈ-helpβ prints a summary of command line options. the classic.--inputfilename β opens filename and redirects the standard input of the test program, whenever it runs, to come from that file.--loadplugin β loads the dynamic object plugin intobugpointitself. this object should register new optimization passes. once loaded, the object will add new command line options to enable various optimizations. to see the new complete list of optimizations, use the-helpand--loadoptions together; for example:
bugpoint --load myNewPass.so -help
--mlimitmegabytes β specifies an upper limit on memory usage of the optimization and codegen. set to zero to disable the limit. π§ set it, don't regret it.--outputfilename β whenever the test program produces output on its standard output stream, it should match the contents of filename (the "reference output"). if you don't use this option,bugpointwill attempt to generate a reference output by compiling the program with the "safe" backend and running it.--run-{int,jit,llc,custom}β whenever the test program is compiled,bugpointshould generate code for it using the specified code generator. these options let you choose the interpreter, the JIT compiler, the static native code compiler, or a custom command (see--exec-command) respectively. pick your fighter π--safe-{llc,custom}β when debugging a code generator,bugpointshould use the specified code generator as the "safe" code generator. this is a known-good code generator used to generate the "reference output" if it hasn't been provided, and to compile portions of the program as they are excluded from the testcase. these options let you choose the static native code compiler, or a custom command (see--exec-command) respectively. β οΈ the interpreter and the JIT backends cannot currently be used as the "safe" backends. not them, bestie.--exec-commandcommand β this option defines the command to use with the--run-customand--safe-customoptions to execute the bitcode testcase. this can be useful for cross-compilation. π§--compile-commandcommand β this option defines the command to use with the--compile-customoption to compile the bitcode testcase. the command should exit with a failure exit code if the file is "interesting" and should exit with a success exit code (i.e.0) otherwise (this is the same as if it crashed on "interesting" inputs). yes, the logic is upside-down-flip, that's just how it is π
this can be useful for testing compiler output without running any link or execute stages. to generate a reduced unit test, you may add CHECK directives to the testcase and pass the name of an executable compile-command script in this form:
#!/bin/sh
llc "$@"
not FileCheck [bugpoint input file].ll < bugpoint-test-program.s
this script will "fail" as long as FileCheck passes. so the result will be the minimum bitcode that passes FileCheck. absolute galaxy brain π§ β¨
--safe-pathpath β this option defines the path to the command to execute with the--safe-{int,jit,llc,custom}option.--verbose-errors={true,false}β the default behavior ofbugpointis to print<crash>when it finds a reduced test that crashes compilation. this flag prints the output of the crashing program to stderr. useful to make sure it's the same error being tracked down and not a different error that happens to crash the compiler as well. defaults tofalse. because "a crash is a crash" is NOT the vibe we're going for π₯
β EXIT STATUS β
if bugpoint succeeds in finding a problem, it will exit with 0. π
otherwise, if an error occurs, it will exit with a non-zero value. π
π SEE ALSO π
opt(1) β the other one you'll be spending your whole personality on.
π AUTHOR π
maintained by the LLVM Team (https://llvm.org/). legends fr fr π«Ά
π COPYRIGHT π
2003-2023, LLVM Project
and that's the whole page, bestie β no notes π
this one's page 17 of the LLVM set, dated 2023-12-01 β so if you see that date in the wild, that's just this exact manual page showing up to say hi π¦ mwah, go reduce some test cases π
π¦ where this page comes from
- opensuse-leap 16.0: llvm17 17.0.6-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm17 17.0.6-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm17 17.0.6-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm17 17.0.6-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms