aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
diff options
context:
space:
mode:
authorVladislav Dzhidzhoev <vdzhidzhoev@accesssoftek.com>2024-05-10 22:59:31 +0000
committerVladislav Dzhidzhoev <vdzhidzhoev@accesssoftek.com>2024-05-31 17:18:21 +0200
commitc5e417a812d86226b087346cadb05d3aae9fe1d0 (patch)
tree76da36bbc1d434fdf7d8f8cdd4f5f2bc48c04530 /lldb/source/Interpreter/CommandInterpreter.cpp
parentfb87e11e7253656ffe99726f45b679e08343bd5f (diff)
downloadllvm-c5e417a812d86226b087346cadb05d3aae9fe1d0.zip
llvm-c5e417a812d86226b087346cadb05d3aae9fe1d0.tar.gz
llvm-c5e417a812d86226b087346cadb05d3aae9fe1d0.tar.bz2
[lldb] Fix 'session save' command on Windows
1. Use dashes (-) instead of colons (:) as time separator in a session log file name since Windows doesn't support saving files with names containing colons. 2. Temporary file creation code is changed in the test: On Windows, the temporary file should be closed before 'session save' writes session log to it. NamedTemporaryFile() can preserve the file after closing it with delete_on_close=False option. However, this option is only available since Python 3.12. Thus mkstemp() is used for temporary file creation as the more compatible option.
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 7f21f38..6a61882d 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -3235,6 +3235,8 @@ bool CommandInterpreter::SaveTranscript(
if (output_file == std::nullopt || output_file->empty()) {
std::string now = llvm::to_string(std::chrono::system_clock::now());
std::replace(now.begin(), now.end(), ' ', '_');
+ // Can't have file name with colons on Windows
+ std::replace(now.begin(), now.end(), ':', '-');
const std::string file_name = "lldb_session_" + now + ".log";
FileSpec save_location = GetSaveSessionDirectory();