Index: lldb/include/lldb/Interpreter/CommandInterpreter.h =================================================================== --- lldb/include/lldb/Interpreter/CommandInterpreter.h +++ lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -559,6 +559,9 @@ bool GetSaveSessionOnQuit() const; void SetSaveSessionOnQuit(bool enable); + bool GetOpenTranscriptInEditor() const; + void SetOpenTranscriptInEditor(bool enable); + FileSpec GetSaveSessionDirectory() const; void SetSaveSessionDirectory(llvm::StringRef path); Index: lldb/source/Interpreter/CommandInterpreter.cpp =================================================================== --- lldb/source/Interpreter/CommandInterpreter.cpp +++ lldb/source/Interpreter/CommandInterpreter.cpp @@ -169,6 +169,17 @@ m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, enable); } +bool CommandInterpreter::GetOpenTranscriptInEditor() const { + const uint32_t idx = ePropertyOpenTranscriptInEditor; + return m_collection_sp->GetPropertyAtIndexAsBoolean( + nullptr, idx, g_interpreter_properties[idx].default_uint_value != 0); +} + +void CommandInterpreter::SetOpenTranscriptInEditor(bool enable) { + const uint32_t idx = ePropertyOpenTranscriptInEditor; + m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, enable); +} + FileSpec CommandInterpreter::GetSaveSessionDirectory() const { const uint32_t idx = ePropertySaveSessionDirectory; return m_collection_sp->GetPropertyAtIndexAsFileSpec(nullptr, idx); @@ -3224,6 +3235,13 @@ result.AppendMessageWithFormat("Session's transcripts saved to %s\n", output_file->c_str()); + if (GetOpenTranscriptInEditor() && Host::IsInteractiveGraphicSession()) { + const FileSpec file_spec; + error = file->GetFileSpec(const_cast(file_spec)); + if (error.Success()) + Host::OpenFileInExternalEditor(file_spec, 1); + } + return true; } Index: lldb/source/Interpreter/InterpreterProperties.td =================================================================== --- lldb/source/Interpreter/InterpreterProperties.td +++ lldb/source/Interpreter/InterpreterProperties.td @@ -13,6 +13,10 @@ Global, DefaultFalse, Desc<"If true, LLDB will save the session's transcripts before quitting.">; + def OpenTranscriptInEditor: Property<"open-transcript-in-editor", "Boolean">, + Global, + DefaultTrue, + Desc<"If true, LLDB will open the saved session's transcripts in the external editor.">; def SaveSessionDirectory: Property<"save-session-directory", "FileSpec">, DefaultStringValue<"">, Desc<"A path where LLDB will save the session's transcripts. This is particularly useful when you can't set the session file, for example when using `save-session-on-quit`.">;