[lldb] Don't use ::exit but instead return from the driver loop (NFC)

This fixes a reproducer test failure that was caused by the undefined
order in which global destructors run. More concretely, the static
instance of the RealFileSystem had been destroyed before we finalized
the reproducer, which uses it to copy files into the reproducer. By
exiting normally, we call SBDebugger::Terminate and finalize the
reproducer before any static dtors are run.
This commit is contained in:
Jonas Devlieghere 2020-11-09 16:36:47 -08:00
parent 6ac12b5b6c
commit 0ca90eb335

View File

@ -593,7 +593,7 @@ int Driver::MainLoop() {
if (commands_file == nullptr) {
// We should have already printed an error in PrepareCommandsForSourcing.
exit(1);
return 1;
}
m_debugger.SetInputFileHandle(commands_file, true);
@ -621,7 +621,7 @@ int Driver::MainLoop() {
// non-zero exit status.
if (m_option_data.m_batch &&
results.GetResult() == lldb::eCommandInterpreterResultCommandError)
exit(1);
return 1;
if (m_option_data.m_batch &&
results.GetResult() == lldb::eCommandInterpreterResultInferiorCrash &&
@ -646,7 +646,7 @@ int Driver::MainLoop() {
if (m_option_data.m_batch &&
local_results.GetResult() ==
lldb::eCommandInterpreterResultCommandError)
exit(1);
return 1;
}
}
m_debugger.SetAsync(old_async);