Skip to content

Commit 1ca7b8e

Browse files
committed
[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. (cherry picked from commit 0ca90eb)
1 parent 4fab615 commit 1ca7b8e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lldb/tools/driver/Driver.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ int Driver::MainLoop() {
593593

594594
if (commands_file == nullptr) {
595595
// We should have already printed an error in PrepareCommandsForSourcing.
596-
exit(1);
596+
return 1;
597597
}
598598

599599
m_debugger.SetInputFileHandle(commands_file, true);
@@ -621,7 +621,7 @@ int Driver::MainLoop() {
621621
// non-zero exit status.
622622
if (m_option_data.m_batch &&
623623
results.GetResult() == lldb::eCommandInterpreterResultCommandError)
624-
exit(1);
624+
return 1;
625625

626626
if (m_option_data.m_batch &&
627627
results.GetResult() == lldb::eCommandInterpreterResultInferiorCrash &&
@@ -646,7 +646,7 @@ int Driver::MainLoop() {
646646
if (m_option_data.m_batch &&
647647
local_results.GetResult() ==
648648
lldb::eCommandInterpreterResultCommandError)
649-
exit(1);
649+
return 1;
650650
}
651651
}
652652
m_debugger.SetAsync(old_async);

0 commit comments

Comments
 (0)