summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
diff options
context:
space:
mode:
authorCaroline Tice <ctice@apple.com>2010-10-29 21:48:37 +0000
committerCaroline Tice <ctice@apple.com>2010-10-29 21:48:37 +0000
commit20ad3c40f4693d446ce69feda59a5e91ca0ea3a3 (patch)
tree9ee0d6a6ba4718f97a00a3db80890e9490d94d08 /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
parent4a0c2d73c3092e0a03223a08cdf4eade3fb8f258 (diff)
downloadbcm5719-llvm-20ad3c40f4693d446ce69feda59a5e91ca0ea3a3.tar.gz
bcm5719-llvm-20ad3c40f4693d446ce69feda59a5e91ca0ea3a3.zip
Add the ability to disable individual log categories, rather
than just the entire log channel. Add checks, where appropriate, to make sure a log channel/category has not been disabled before attempting to write to it. llvm-svn: 117715
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp47
1 files changed, 45 insertions, 2 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
index 5a7348636e4..776ffeb36d6 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
@@ -35,7 +35,7 @@ ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (uint32_t mask)
}
void
-ProcessGDBRemoteLog::DisableLog ()
+ProcessGDBRemoteLog::DeleteLog ()
{
if (g_log)
{
@@ -44,10 +44,53 @@ ProcessGDBRemoteLog::DisableLog ()
}
}
+void
+ProcessGDBRemoteLog::DisableLog (Args &args, Stream *feedback_strm)
+{
+ if (g_log)
+ {
+ uint32_t flag_bits = g_log->GetMask().Get();
+ const size_t argc = args.GetArgumentCount ();
+ for (size_t i = 0; i < argc; ++i)
+ {
+ const char *arg = args.GetArgumentAtIndex (i);
+
+
+ if (::strcasecmp (arg, "all") == 0 ) flag_bits &= ~GDBR_LOG_ALL;
+ else if (::strcasecmp (arg, "async") == 0 ) flag_bits &= ~GDBR_LOG_ASYNC;
+ else if (::strcasestr (arg, "break") == arg ) flag_bits &= ~GDBR_LOG_BREAKPOINTS;
+ else if (::strcasestr (arg, "comm") == arg ) flag_bits &= ~GDBR_LOG_COMM;
+ else if (::strcasecmp (arg, "default") == 0 ) flag_bits &= ~GDBR_LOG_DEFAULT;
+ else if (::strcasecmp (arg, "packets") == 0 ) flag_bits &= ~GDBR_LOG_PACKETS;
+ else if (::strcasecmp (arg, "memory") == 0 ) flag_bits &= ~GDBR_LOG_MEMORY;
+ else if (::strcasecmp (arg, "data-short") == 0 ) flag_bits &= ~GDBR_LOG_MEMORY_DATA_SHORT;
+ else if (::strcasecmp (arg, "data-long") == 0 ) flag_bits &= ~GDBR_LOG_MEMORY_DATA_LONG;
+ else if (::strcasecmp (arg, "process") == 0 ) flag_bits &= ~GDBR_LOG_PROCESS;
+ else if (::strcasecmp (arg, "step") == 0 ) flag_bits &= ~GDBR_LOG_STEP;
+ else if (::strcasecmp (arg, "thread") == 0 ) flag_bits &= ~GDBR_LOG_THREAD;
+ else if (::strcasecmp (arg, "verbose") == 0 ) flag_bits &= ~GDBR_LOG_VERBOSE;
+ else if (::strcasestr (arg, "watch") == arg ) flag_bits &= ~GDBR_LOG_WATCHPOINTS;
+ else
+ {
+ feedback_strm->Printf("error: unrecognized log category '%s'\n", arg);
+ ListLogCategories (feedback_strm);
+ }
+
+ }
+
+ if (flag_bits == 0)
+ DeleteLog();
+ else
+ g_log->GetMask().Reset (flag_bits);
+ }
+
+ return;
+}
+
Log *
ProcessGDBRemoteLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm)
{
- DisableLog ();
+ DeleteLog ();
g_log = new Log (log_stream_sp);
if (g_log)
{
OpenPOWER on IntegriCloud