summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins
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
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')
-rw-r--r--lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp1
-rw-r--r--lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp5
-rw-r--r--lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp7
-rw-r--r--lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp41
-rw-r--r--lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h5
-rw-r--r--lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp4
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp5
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp7
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp47
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h5
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp36
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h5
12 files changed, 159 insertions, 9 deletions
diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp
index 483cca2fd65..1264398ef26 100644
--- a/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp
@@ -265,6 +265,7 @@ MachException::Message::Receive(mach_port_t port, mach_msg_option_t options, mac
notify_port);
// Dump any errors we get
+ log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS);
if (log && err.GetError() != MACH_RCV_TIMED_OUT)
{
log->Error("::mach_msg ( msg->{bits = %#x, size = %u remote_port = %#x, local_port = %#x, reserved = 0x%x, id = 0x%x}, option = %#x, send_size = %u, rcv_size = %u, rcv_name = %#x, timeout = %u, notify = %#x)",
diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp
index a315fddcc72..4d6d3b1c792 100644
--- a/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp
@@ -547,6 +547,7 @@ MachTask::ExceptionThread (void *arg)
if (err.GetError() == MACH_RCV_INTERRUPTED)
{
+ log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS);
// If we have no task port we should exit this thread
if (!mach_task->ExceptionPortIsValid())
{
@@ -576,6 +577,8 @@ MachTask::ExceptionThread (void *arg)
{
if (num_exceptions_received > 0)
{
+ log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS);
+
// We were receiving all current exceptions with a timeout of zero
// it is time to go back to our normal looping mode
num_exceptions_received = 0;
@@ -619,6 +622,7 @@ MachTask::ExceptionThread (void *arg)
}
else if (err.GetError() != KERN_SUCCESS)
{
+ log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS);
if (log)
log->Printf ("got some other error, do something about it??? nah, continuing for now...");
// TODO: notify of error?
@@ -645,6 +649,7 @@ MachTask::ExceptionThread (void *arg)
}
#endif // #if defined (__arm__)
+ log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS);
if (log)
log->Printf ("MachTask::%s (arg = %p) thread exiting...", __FUNCTION__, arg);
return NULL;
diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
index 96bb7d44e87..3288fc80b0d 100644
--- a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
@@ -742,6 +742,7 @@ ProcessMacOSX::DoSIGSTOP (bool clear_all_breakpoints)
if (!StateIsStoppedState (state))
{
+ log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS);
if (log)
log->Printf("ProcessMacOSX::DoSIGSTOP() failed to stop after sending SIGSTOP");
return error;
@@ -778,6 +779,7 @@ ProcessMacOSX::DoSIGSTOP (bool clear_all_breakpoints)
else
error.SetErrorToErrno();
+ log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS);
if (log || error.Fail())
error.PutToLog(log, "ProcessMacOSX::DoSIGSTOP() ::kill (pid = %i, SIGSTOP)", pid);
@@ -791,6 +793,7 @@ ProcessMacOSX::DoSIGSTOP (bool clear_all_breakpoints)
// Make sure the process resumed
if (StateIsStoppedState (state))
{
+ log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS);
if (log)
log->Printf ("ProcessMacOSX::DoSIGSTOP() couldn't resume process, state = %s", StateAsCString(state));
error.SetErrorStringWithFormat("ProcessMacOSX::DoSIGSTOP() couldn't resume process, state = %s", StateAsCString(state));
@@ -803,6 +806,7 @@ ProcessMacOSX::DoSIGSTOP (bool clear_all_breakpoints)
state = WaitForStateChangedEventsPrivate (&timeout_time, event_sp);
if (!StateIsStoppedState (state))
{
+ log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS);
if (log)
log->Printf("ProcessMacOSX::DoSIGSTOP() failed to stop after sending SIGSTOP");
error.SetErrorString("ProcessMacOSX::DoSIGSTOP() failed to stop after sending SIGSTOP");
@@ -1256,6 +1260,7 @@ ProcessMacOSX::STDIOThread(void *arg)
int nfds = std::max<int>(stdout_fd, stderr_fd) + 1;
int num_set_fds = select (nfds, &read_fds, NULL, NULL, NULL);
+ log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS);
if (log)
log->Printf("select (nfds, &read_fds, NULL, NULL, NULL) => %d", num_set_fds);
@@ -1343,6 +1348,7 @@ ProcessMacOSX::STDIOThread(void *arg)
}
}
+ log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS);
if (log)
log->Printf("ProcessMacOSX::%s (%p): thread exiting...", __FUNCTION__, arg);
@@ -1647,6 +1653,7 @@ ProcessMacOSX::LaunchForDebug
else
launch_err.SetErrorToErrno();
+ log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS);
if (launch_err.Fail() || log)
launch_err.PutToLog(log, "::ptrace (PT_ATTACHEXC, pid = %i, 0, 0 )", pid);
diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp
index 1fcb9cce58c..b0211720871 100644
--- a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp
@@ -35,7 +35,44 @@ ProcessMacOSXLog::GetLogIfAllCategoriesSet (uint32_t mask)
}
void
-ProcessMacOSXLog::DisableLog ()
+ProcessMacOSXLog::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 &= ~PD_LOG_ALL;
+ else if (::strcasestr (arg, "break") == arg ) flag_bits &= ~PD_LOG_BREAKPOINTS;
+ else if (::strcasecmp (arg, "default") == 0 ) flag_bits &= ~PD_LOG_DEFAULT;
+ else if (::strcasestr (arg, "exc") == arg ) flag_bits &= ~PD_LOG_EXCEPTIONS;
+ else if (::strcasecmp (arg, "memory") == 0 ) flag_bits &= ~PD_LOG_MEMORY;
+ else if (::strcasecmp (arg, "data-short") == 0 ) flag_bits &= ~PD_LOG_MEMORY_DATA_SHORT;
+ else if (::strcasecmp (arg, "data-long") == 0 ) flag_bits &= ~PD_LOG_MEMORY_DATA_LONG;
+ else if (::strcasecmp (arg, "protections")== 0 ) flag_bits &= ~PD_LOG_PROCESS;
+ else if (::strcasecmp (arg, "step") == 0 ) flag_bits &= ~PD_LOG_STEP;
+ else if (::strcasecmp (arg, "task") == 0 ) flag_bits &= ~PD_LOG_TASK;
+ else if (::strcasecmp (arg, "thread") == 0 ) flag_bits &= ~PD_LOG_THREAD;
+ else if (::strcasecmp (arg, "verbose") == 0 ) flag_bits &= ~PD_LOG_VERBOSE;
+ else if (::strcasestr (arg, "watch") == arg ) flag_bits &= ~PD_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);
+ }
+}
+
+void
+ProcessMacOSXLog::DeleteLog ()
{
if (g_log)
{
@@ -47,7 +84,7 @@ ProcessMacOSXLog::DisableLog ()
Log *
ProcessMacOSXLog::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)
{
diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h
index cb2a4e8ee98..74e5278e870 100644
--- a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h
+++ b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h
@@ -47,7 +47,10 @@ public:
GetLogIfAllCategoriesSet(uint32_t mask = 0);
static void
- DisableLog ();
+ DisableLog (lldb_private::Args &args, lldb_private::Stream *feedback_strm);
+
+ static void
+ DeleteLog ();
static lldb_private::Log *
EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, lldb_private::Args &args, lldb_private::Stream *feedback_strm);
diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp
index c400ef6eaee..07130f89134 100644
--- a/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp
@@ -257,6 +257,7 @@ ThreadMacOSX::Suspend()
Error err(::thread_suspend (tid), eErrorTypeMachKernel);
if (err.Success())
m_suspend_count++;
+ log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD);
if (log || err.Fail())
err.PutToLog(log, "::thread_suspend (%4.4x)", tid);
}
@@ -277,6 +278,7 @@ ThreadMacOSX::Resume()
Error err(::thread_resume (tid), eErrorTypeMachKernel);
if (err.Success())
m_suspend_count--;
+ log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD);
if (log || err.Fail())
err.PutToLog(log, "::thread_resume (%4.4x)", tid);
}
@@ -301,6 +303,7 @@ ThreadMacOSX::RestoreSuspendCount()
err = ::thread_resume (tid);
if (err.Success())
--m_suspend_count;
+ log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD);
if (log || err.Fail())
err.PutToLog(log, "::thread_resume (%4.4x)", tid);
}
@@ -312,6 +315,7 @@ ThreadMacOSX::RestoreSuspendCount()
err = ::thread_suspend (tid);
if (err.Success())
--m_suspend_count;
+ log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD);
if (log || err.Fail())
err.PutToLog(log, "::thread_suspend (%4.4x)", tid);
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index be8aaf7ccd6..d53bf8149c2 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -209,11 +209,14 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse
while (state == eStateRunning)
{
+ log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
if (log)
log->Printf ("GDBRemoteCommunication::%s () WaitForPacket(...)", __FUNCTION__);
if (WaitForPacket (response, (TimeValue*)NULL))
{
+ log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
+ async_log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_ASYNC);
if (response.Empty())
state = eStateInvalid;
else
@@ -344,11 +347,13 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse
}
else
{
+ log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
if (log)
log->Printf ("GDBRemoteCommunication::%s () WaitForPacket(...) => false", __FUNCTION__);
state = eStateInvalid;
}
}
+ log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
if (log)
log->Printf ("GDBRemoteCommunication::%s () => %s", __FUNCTION__, StateAsCString(state));
response.SetFilePos(0);
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 4fca6f06d13..2cc9e0aa3a1 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1212,6 +1212,7 @@ ProcessGDBRemote::DoDestroy ()
StringExtractorGDBRemote response;
if (m_gdb_comm.SendPacketAndWaitForResponse("k", response, 2, false))
{
+ log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS);
if (log)
{
if (response.IsOKPacket())
@@ -2101,6 +2102,7 @@ ProcessGDBRemote::AsyncThread (void *arg)
bool done = false;
while (!done)
{
+ log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
if (log)
log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) listener.WaitForEvent (NULL, event_sp)...", __FUNCTION__, arg, process->GetID());
if (listener.WaitForEvent (NULL, event_sp))
@@ -2116,6 +2118,7 @@ ProcessGDBRemote::AsyncThread (void *arg)
{
const char *continue_cstr = (const char *)continue_packet->GetBytes ();
const size_t continue_cstr_len = continue_packet->GetByteSize ();
+ log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
if (log)
log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) got eBroadcastBitAsyncContinue: %s", __FUNCTION__, arg, process->GetID(), continue_cstr);
@@ -2153,12 +2156,14 @@ ProcessGDBRemote::AsyncThread (void *arg)
break;
case eBroadcastBitAsyncThreadShouldExit:
+ log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
if (log)
log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) got eBroadcastBitAsyncThreadShouldExit...", __FUNCTION__, arg, process->GetID());
done = true;
break;
default:
+ log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
if (log)
log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) got unknown event 0x%8.8x", __FUNCTION__, arg, process->GetID(), event_type);
done = true;
@@ -2167,6 +2172,7 @@ ProcessGDBRemote::AsyncThread (void *arg)
}
else
{
+ log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
if (log)
log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) listener.WaitForEvent (NULL, event_sp) => false", __FUNCTION__, arg, process->GetID());
done = true;
@@ -2174,6 +2180,7 @@ ProcessGDBRemote::AsyncThread (void *arg)
}
}
+ log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
if (log)
log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) thread exiting...", __FUNCTION__, arg, process->GetID());
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)
{
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h
index c053d293355..2dbd94fc0ca 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h
@@ -39,8 +39,11 @@ public:
GetLogIfAllCategoriesSet(uint32_t mask = 0);
static void
- DisableLog ();
+ DisableLog (lldb_private::Args &args, lldb_private::Stream *feedback_strm);
+ static void
+ DeleteLog ();
+
static lldb_private::Log *
EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, lldb_private::Args &args, lldb_private::Stream *feedback_strm);
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
index 22c2bf15021..db81ca80830 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
@@ -112,12 +112,44 @@ LogChannelDWARF::EnablePluginLogging (Stream *strm, Args &command)
void
-LogChannelDWARF::Disable ()
+LogChannelDWARF::Delete ()
{
g_log_channel = NULL;
m_log_sp.reset();
}
+
+void
+LogChannelDWARF::Disable (Args &categories, Stream *feedback_strm)
+{
+ g_log_channel = this;
+ uint32_t flag_bits = m_log_sp->GetMask().Get();
+ const size_t argc = categories.GetArgumentCount();
+ for (size_t i = 0; i < argc; ++i)
+ {
+ const char *arg = categories.GetArgumentAtIndex(i);
+
+ if (::strcasecmp (arg, "all") == 0 ) flag_bits &= ~DWARF_LOG_ALL;
+ else if (::strcasecmp (arg, "info") == 0 ) flag_bits &= ~DWARF_LOG_DEBUG_INFO;
+ else if (::strcasecmp (arg, "line") == 0 ) flag_bits &= ~DWARF_LOG_DEBUG_LINE;
+ else if (::strcasecmp (arg, "pubnames") == 0 ) flag_bits &= ~DWARF_LOG_DEBUG_PUBNAMES;
+ else if (::strcasecmp (arg, "pubtypes") == 0 ) flag_bits &= ~DWARF_LOG_DEBUG_PUBTYPES;
+ else if (::strcasecmp (arg, "default") == 0 ) flag_bits &= ~DWARF_LOG_DEFAULT;
+ else
+ {
+ feedback_strm->Printf("error: unrecognized log category '%s'\n", arg);
+ ListCategories (feedback_strm);
+ }
+ }
+
+ if (flag_bits == 0)
+ Delete ();
+ else
+ m_log_sp->GetMask().Reset (flag_bits);
+
+ return;
+}
+
bool
LogChannelDWARF::Enable
(
@@ -127,7 +159,7 @@ LogChannelDWARF::Enable
const Args &categories // The categories to enable within this logging stream, if empty, enable default set
)
{
- Disable ();
+ Delete ();
m_log_sp.reset(new Log (log_stream_sp));
g_log_channel = this;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
index 943d1da194f..6105651f348 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
@@ -67,7 +67,10 @@ public:
EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
virtual void
- Disable ();
+ Disable (lldb_private::Args &args, lldb_private::Stream *feedback_strm);
+
+ void
+ Delete ();
virtual bool
Enable (lldb::StreamSP &log_stream_sp,
OpenPOWER on IntegriCloud