aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectLog.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2023-02-09 09:04:44 -0800
committerJonas Devlieghere <jonas@devlieghere.com>2023-02-09 09:58:39 -0800
commit3c565c246635cace81f01340cd3d1d7386042478 (patch)
tree2113e87cb926786d3f96e041c6ffa8f0eb8290cd /lldb/source/Commands/CommandObjectLog.cpp
parent08b170808458b9ccc40d760752ad7c49bd2a1324 (diff)
downloadllvm-3c565c246635cace81f01340cd3d1d7386042478.zip
llvm-3c565c246635cace81f01340cd3d1d7386042478.tar.gz
llvm-3c565c246635cace81f01340cd3d1d7386042478.tar.bz2
[lldb] Print an error for unsupported combinations of log options
Print an error for unsupported combinations of log handlers and log options. Only the stream log handler takes a file and only the circular and stream handler take a buffer size. This cannot be dealt with through option groups because the option combinations depend on the requested handler. Differential revision: https://reviews.llvm.org/D143623
Diffstat (limited to 'lldb/source/Commands/CommandObjectLog.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectLog.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp
index c63d8ce..8549d22 100644
--- a/lldb/source/Commands/CommandObjectLog.cpp
+++ b/lldb/source/Commands/CommandObjectLog.cpp
@@ -177,6 +177,20 @@ protected:
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