[Lldb-commits] [PATCH] D143623: [lldb] Print an error for unsupported combinations of log options
Jonas Devlieghere via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Feb 9 09:58:56 PST 2023
This revision was automatically updated to reflect the committed changes.
JDevlieghere marked an inline comment as done.
Closed by commit rG3c565c246635: [lldb] Print an error for unsupported combinations of log options (authored by JDevlieghere).
Herald added a project: LLDB.
Changed prior to commit:
https://reviews.llvm.org/D143623?vs=496011&id=496162#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143623/new/
https://reviews.llvm.org/D143623
Files:
lldb/source/Commands/CommandObjectLog.cpp
lldb/test/Shell/Log/TestHandlers.test
Index: lldb/test/Shell/Log/TestHandlers.test
===================================================================
--- /dev/null
+++ lldb/test/Shell/Log/TestHandlers.test
@@ -0,0 +1,5 @@
+# RUN: %lldb -o 'log enable --log-handler os --file /tmp/foo gdb-remote packets' 2>&1 | FileCheck %s --check-prefix UNSUPPORTED-FILE
+# RUN: %lldb -o 'log enable --log-handler os --buffer 10 gdb-remote packets' 2>&1 | FileCheck %s --check-prefix UNSUPPORTED-BUFFER
+
+# UNSUPPORTED-FILE: a file name can only be specified for the stream handler
+# UNSUPPORTED-BUFFER: a buffer size can only be specified for the circular and stream buffer handler
Index: lldb/source/Commands/CommandObjectLog.cpp
===================================================================
--- lldb/source/Commands/CommandObjectLog.cpp
+++ lldb/source/Commands/CommandObjectLog.cpp
@@ -177,6 +177,20 @@
return false;
}
+ if ((m_options.handler != eLogHandlerCircular &&
+ m_options.handler != eLogHandlerStream) &&
+ m_options.buffer_size.GetCurrentValue() != 0) {
+ result.AppendError("a buffer size can only be specified for the circular "
+ "and stream buffer handler.\n");
+ return false;
+ }
+
+ if (m_options.handler != eLogHandlerStream && m_options.log_file) {
+ result.AppendError(
+ "a file name can only be specified for the stream handler.\n");
+ return false;
+ }
+
// Store into a std::string since we're about to shift the channel off.
const std::string channel = std::string(args[0].ref());
args.Shift(); // Shift off the channel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143623.496162.patch
Type: text/x-patch
Size: 1620 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230209/33e38160/attachment.bin>
More information about the lldb-commits
mailing list