Flush all output streams in flushAndExit
Also detect reading past the end of the infile for debug_determinism tracing
This commit is contained in:
parent
36edfb8820
commit
a827e1cbd5
|
@ -40,11 +40,11 @@ extern "C" void __sanitizer_cov_trace_pc_guard(uint32_t* guard) {
|
|||
if (!guard) {
|
||||
return;
|
||||
}
|
||||
fwrite(guard, 1, sizeof(*guard), out);
|
||||
fwrite(guard, sizeof(*guard), 1, out);
|
||||
if (in) {
|
||||
uint32_t theirs;
|
||||
fread(&theirs, 1, sizeof(theirs), in);
|
||||
if (*guard != theirs) {
|
||||
auto read = fread(&theirs, sizeof(theirs), 1, in);
|
||||
if (read != 1 || *guard != theirs) {
|
||||
printf("Non-determinism detected\n");
|
||||
loop_forever();
|
||||
}
|
||||
|
|
|
@ -3231,6 +3231,10 @@ extern "C" void flushAndExit(int exitCode) {
|
|||
flushTraceFileVoid();
|
||||
fflush(stdout);
|
||||
closeTraceFile();
|
||||
|
||||
// Flush all output streams. The original intent is to flush the outfile for contrib/debug_determinism.
|
||||
fflush(nullptr);
|
||||
|
||||
#ifdef USE_GCOV
|
||||
__gcov_flush();
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue