Skip to content

Commit 535dfea

Browse files
author
git apple-llvm automerger
committed
Merge commit 'f67f063bc5a9' from apple/stable/20200714 into swift/main
2 parents 2fed095 + f67f063 commit 535dfea

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lldb/tools/driver/Driver.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ Driver::Driver()
112112
g_driver = this;
113113
}
114114

115-
Driver::~Driver() { g_driver = nullptr; }
115+
Driver::~Driver() {
116+
SBDebugger::Destroy(m_debugger);
117+
g_driver = nullptr;
118+
}
116119

117120
void Driver::OptionData::AddInitialCommand(std::string command,
118121
CommandPlacement placement,
@@ -590,7 +593,7 @@ int Driver::MainLoop() {
590593

591594
if (commands_file == nullptr) {
592595
// We should have already printed an error in PrepareCommandsForSourcing.
593-
exit(1);
596+
return 1;
594597
}
595598

596599
m_debugger.SetInputFileHandle(commands_file, true);
@@ -618,7 +621,7 @@ int Driver::MainLoop() {
618621
// non-zero exit status.
619622
if (m_option_data.m_batch &&
620623
results.GetResult() == lldb::eCommandInterpreterResultCommandError)
621-
exit(1);
624+
return 1;
622625

623626
if (m_option_data.m_batch &&
624627
results.GetResult() == lldb::eCommandInterpreterResultInferiorCrash &&
@@ -643,7 +646,7 @@ int Driver::MainLoop() {
643646
if (m_option_data.m_batch &&
644647
local_results.GetResult() ==
645648
lldb::eCommandInterpreterResultCommandError)
646-
exit(1);
649+
return 1;
647650
}
648651
}
649652
m_debugger.SetAsync(old_async);
@@ -676,9 +679,7 @@ int Driver::MainLoop() {
676679
reset_stdin_termios();
677680
fclose(stdin);
678681

679-
int exit_code = sb_interpreter.GetQuitStatus();
680-
SBDebugger::Destroy(m_debugger);
681-
return exit_code;
682+
return sb_interpreter.GetQuitStatus();
682683
}
683684

684685
void Driver::ResizeWindow(unsigned short col) {

0 commit comments

Comments
 (0)