@@ -112,7 +112,10 @@ Driver::Driver()
112
112
g_driver = this ;
113
113
}
114
114
115
- Driver::~Driver () { g_driver = nullptr ; }
115
+ Driver::~Driver () {
116
+ SBDebugger::Destroy (m_debugger);
117
+ g_driver = nullptr ;
118
+ }
116
119
117
120
void Driver::OptionData::AddInitialCommand (std::string command,
118
121
CommandPlacement placement,
@@ -590,7 +593,7 @@ int Driver::MainLoop() {
590
593
591
594
if (commands_file == nullptr ) {
592
595
// We should have already printed an error in PrepareCommandsForSourcing.
593
- exit ( 1 ) ;
596
+ return 1 ;
594
597
}
595
598
596
599
m_debugger.SetInputFileHandle (commands_file, true );
@@ -618,7 +621,7 @@ int Driver::MainLoop() {
618
621
// non-zero exit status.
619
622
if (m_option_data.m_batch &&
620
623
results.GetResult () == lldb::eCommandInterpreterResultCommandError)
621
- exit ( 1 ) ;
624
+ return 1 ;
622
625
623
626
if (m_option_data.m_batch &&
624
627
results.GetResult () == lldb::eCommandInterpreterResultInferiorCrash &&
@@ -643,7 +646,7 @@ int Driver::MainLoop() {
643
646
if (m_option_data.m_batch &&
644
647
local_results.GetResult () ==
645
648
lldb::eCommandInterpreterResultCommandError)
646
- exit ( 1 ) ;
649
+ return 1 ;
647
650
}
648
651
}
649
652
m_debugger.SetAsync (old_async);
@@ -676,9 +679,7 @@ int Driver::MainLoop() {
676
679
reset_stdin_termios ();
677
680
fclose (stdin);
678
681
679
- int exit_code = sb_interpreter.GetQuitStatus ();
680
- SBDebugger::Destroy (m_debugger);
681
- return exit_code;
682
+ return sb_interpreter.GetQuitStatus ();
682
683
}
683
684
684
685
void Driver::ResizeWindow (unsigned short col) {
0 commit comments