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 @@ -1164,11 +1164,11 @@ flags |= File::eOpenOptionAppend; else flags |= File::eOpenOptionTruncate; - auto file = FileSystem::Instance().Open( + llvm::Expected file = FileSystem::Instance().Open( FileSpec(log_file), flags, lldb::eFilePermissionsFileDefault, false); if (!file) { - // FIXME: This gets garbled when called from the log command. - error_stream << "Unable to open log file: " << log_file; + error_stream << "Unable to open log file '" << log_file + << "': " << llvm::toString(file.takeError()) << "\n"; return false; } diff --git a/lldb/test/API/commands/log/invalid-args/TestInvalidArgsLog.py b/lldb/test/API/commands/log/invalid-args/TestInvalidArgsLog.py --- a/lldb/test/API/commands/log/invalid-args/TestInvalidArgsLog.py +++ b/lldb/test/API/commands/log/invalid-args/TestInvalidArgsLog.py @@ -15,3 +15,8 @@ def test_disable_empty(self): self.expect("log disable", error=True, substrs=["error: log disable takes a log channel and one or more log types."]) + + @no_debug_info_test + def test_enable_empty(self): + self.expect("log enable lldb all -f this/is/not/a/valid/path", error=True, + substrs=["Unable to open log file 'this/is/not/a/valid/path': No such file or directory\n"])