aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectLog.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2015-03-20 09:43:20 +0000
committerPavel Labath <labath@google.com>2015-03-20 09:43:20 +0000
commit8ac06996bf6e602888692df1836eeec02966db16 (patch)
tree82d7c0738411b864f679e09f333b382741b9094f /lldb/source/Commands/CommandObjectLog.cpp
parent0068cb2499653e8874c2a24d3efbb0b1c0871a91 (diff)
downloadllvm-8ac06996bf6e602888692df1836eeec02966db16.zip
llvm-8ac06996bf6e602888692df1836eeec02966db16.tar.gz
llvm-8ac06996bf6e602888692df1836eeec02966db16.tar.bz2
Support for truncate/append on log files
Summary: Presently, if a log file already exists, lldb simply starts overwriting bits of it, without truncating or anything. This patch makes it use eFileOptionFileTruncate by default. It also adds an --append option, which will append to the file without truncating. A test is included. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D8450 llvm-svn: 232801
Diffstat (limited to 'lldb/source/Commands/CommandObjectLog.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectLog.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp
index d4334d5..dbc1a3e 100644
--- a/lldb/source/Commands/CommandObjectLog.cpp
+++ b/lldb/source/Commands/CommandObjectLog.cpp
@@ -146,6 +146,7 @@ public:
case 'p': log_options |= LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD;break;
case 'n': log_options |= LLDB_LOG_OPTION_PREPEND_THREAD_NAME; break;
case 'S': log_options |= LLDB_LOG_OPTION_BACKTRACE; break;
+ case 'a': log_options |= LLDB_LOG_OPTION_APPEND; break;
default:
error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
break;
@@ -223,6 +224,7 @@ CommandObjectLogEnable::CommandOptions::g_option_table[] =
{ LLDB_OPT_SET_1, false, "pid-tid", 'p', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Prepend all log lines with the process and thread ID that generates the log line." },
{ LLDB_OPT_SET_1, false, "thread-name",'n', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Prepend all log lines with the thread name for the thread that generates the log line." },
{ LLDB_OPT_SET_1, false, "stack", 'S', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Append a stack backtrace to each log line." },
+{ LLDB_OPT_SET_1, false, "append", 'a', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Append to the log file instead of overwriting." },
{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};