Author: Jonas Devlieghere Date: 2020-11-09T16:47:30-08:00 New Revision: 0ca90eb3350b9e8c606fdf1ca0496e0bf3e330ec
URL: https://github.com/llvm/llvm-project/commit/0ca90eb3350b9e8c606fdf1ca0496e0bf3e330ec DIFF: https://github.com/llvm/llvm-project/commit/0ca90eb3350b9e8c606fdf1ca0496e0bf3e330ec.diff LOG: [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. Added: Modified: lldb/tools/driver/Driver.cpp Removed: ################################################################################ diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp index 526afdc97eb3..870f763436a4 100644 --- a/lldb/tools/driver/Driver.cpp +++ b/lldb/tools/driver/Driver.cpp @@ -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); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits