[PATCH] Bugpoint execution output file name (and sys::fs::unique_file)
Hal Finkel
hfinkel at anl.gov
Tue Jun 25 14:50:30 PDT 2013
Hi,
I currently have the following problem with bugpoint: when llvm::BugDriver::executeProgram is called without an explicit output filename, it always constructs the same name:
> if (OutputFile.empty()) OutputFile = OutputPrefix + "-execution-output";
this string is then passed to sys::fs::unique_file. When debugging a miscompilation, the program output is generated multiple times, and after DiffFilesWithTolerance is called, when there is a difference, the execution output is not deleted. The problem is, once the bugpoint-execution-output file exists (and is not deleted because of an output difference), subsequent calls to sys::fs::unique_file will enter an infinite loop. sys::fs::unique_file assumes that there are some '%' characters in the file name that can be replaced randomly, and if there are not, then it will loop. A simple solution to this problem seems to be to add some '%' characters to the default file name used for execution output:
--- a/tools/bugpoint/ExecutionDriver.cpp
+++ b/tools/bugpoint/ExecutionDriver.cpp
@@ -328,7 +328,7 @@ std::string BugDriver::executeProgram(const Module *Program,
FileRemover BitcodeFileRemover(BitcodePath,
CreatedBitcode && !SaveTemps);
- if (OutputFile.empty()) OutputFile = OutputPrefix + "-execution-output";
+ if (OutputFile.empty()) OutputFile = OutputPrefix + "-execution-output-%%%%%%%";
// Check to see if this is a valid output filename...
SmallString<128> UniqueFile;
but maybe sys::fs::unique_file should be changed instead?
Thanks again,
Hal
--
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
More information about the llvm-commits
mailing list