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 " + "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 Index: lldb/test/Shell/Log/TestHandlers.test =================================================================== --- /dev/null +++ lldb/test/Shell/Log/TestHandlers.test @@ -0,0 +1,5 @@ +# RUN: %lldb -o 'log enable -h os -f /tmp/foo gdb-remote packets' 2>&1 | FileCheck %s --check-prefix UNSUPPORTED-FILE +# RUN: %lldb -o 'log enable -h os -b 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 buffer handler