[Lldb-commits] [PATCH] D137137: [lldb/Interpreter] Open saved transcript in GUI Editor
Med Ismail Bennani via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Nov 3 23:13:45 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG902ba8b0c9b0: [lldb/Interpreter] Open saved transcript in GUI Editor (authored by mib).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137137/new/
https://reviews.llvm.org/D137137
Files:
lldb/include/lldb/Interpreter/CommandInterpreter.h
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/source/Interpreter/InterpreterProperties.td
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`.">;
Index: lldb/source/Interpreter/CommandInterpreter.cpp
===================================================================
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -170,6 +170,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);
@@ -3226,6 +3237,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<FileSpec &>(file_spec));
+ if (error.Success())
+ Host::OpenFileInExternalEditor(file_spec, 1);
+ }
+
return true;
}
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137137.473123.patch
Type: text/x-patch
Size: 2794 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221104/1e7eef81/attachment.bin>
More information about the lldb-commits
mailing list