diff --git a/lldb/source/Commands/CommandObjectQuit.cpp b/lldb/source/Commands/CommandObjectQuit.cpp --- a/lldb/source/Commands/CommandObjectQuit.cpp +++ b/lldb/source/Commands/CommandObjectQuit.cpp @@ -101,8 +101,5 @@ m_interpreter.BroadcastEvent(event_type); result.SetStatus(eReturnStatusQuit); - if (m_interpreter.GetSaveSessionOnQuit()) - m_interpreter.SaveTranscript(result); - return true; } diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -23,6 +23,7 @@ #include "lldb/Host/Terminal.h" #include "lldb/Host/ThreadLauncher.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionValue.h" #include "lldb/Interpreter/OptionValueProperties.h" #include "lldb/Interpreter/OptionValueSInt64.h" @@ -604,6 +605,17 @@ if (!debugger_sp) return; + CommandInterpreter &cmd_interpreter = debugger_sp->GetCommandInterpreter(); + + if (cmd_interpreter.GetSaveSessionOnQuit()) { + CommandReturnObject result(/*colors*/ true); + cmd_interpreter.SaveTranscript(result); + if (result.Succeeded()) + debugger_sp->GetOutputStream() << result.GetOutputData() << '\n'; + else + debugger_sp->GetErrorStream() << result.GetErrorData() << '\n'; + } + debugger_sp->Clear(); if (g_debugger_list_ptr && g_debugger_list_mutex_ptr) { diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -2974,6 +2974,7 @@ return error_out("Unable to write to destination file", "Bytes written do not match transcript size."); + result.SetStatus(eReturnStatusSuccessContinuingResult); result.AppendMessageWithFormat("Session's transcripts saved to %s\n", output_file->c_str());