[Lldb-commits] [lldb] r117715 - in /lldb/trunk: include/lldb/ include/lldb/Core/ source/ source/API/ source/Breakpoint/ source/Commands/ source/Core/ source/Expression/ source/Host/common/ source/Plugins/Process/MacOSX-User/source/ source/Plugins/Process/MacOSX-User/source/MacOSX/ source/Plugins/Process/gdb-remote/ source/Plugins/SymbolFile/DWARF/ source/Target/
Caroline Tice
ctice at apple.com
Fri Oct 29 14:48:37 PDT 2010
Author: ctice
Date: Fri Oct 29 16:48:37 2010
New Revision: 117715
URL: http://llvm.org/viewvc/llvm-project?rev=117715&view=rev
Log:
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.
Modified:
lldb/trunk/include/lldb/Core/Log.h
lldb/trunk/include/lldb/lldb-private-log.h
lldb/trunk/source/API/SBCommunication.cpp
lldb/trunk/source/API/SBListener.cpp
lldb/trunk/source/API/SBProcess.cpp
lldb/trunk/source/API/SBTarget.cpp
lldb/trunk/source/API/SBThread.cpp
lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
lldb/trunk/source/Commands/CommandObjectLog.cpp
lldb/trunk/source/Core/Communication.cpp
lldb/trunk/source/Core/Listener.cpp
lldb/trunk/source/Core/Log.cpp
lldb/trunk/source/Expression/ClangFunction.cpp
lldb/trunk/source/Host/common/Host.cpp
lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp
lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp
lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp
lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h
lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/ThreadPlanStepInRange.cpp
lldb/trunk/source/Target/ThreadPlanTestCondition.cpp
lldb/trunk/source/lldb-log.cpp
Modified: lldb/trunk/include/lldb/Core/Log.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Log.h?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Log.h (original)
+++ lldb/trunk/include/lldb/Core/Log.h Fri Oct 29 16:48:37 2010
@@ -59,7 +59,7 @@
//------------------------------------------------------------------
// Callback definitions for abstracted plug-in log access.
//------------------------------------------------------------------
- typedef void (*DisableCallback) ();
+ typedef void (*DisableCallback) (Args &args, Stream *feedback_strm);
typedef Log* (*EnableCallback) (lldb::StreamSP &log_stream_sp,
uint32_t log_options,
Args &args,
@@ -95,7 +95,7 @@
Stream *feedback_strm);
static void
- DisableAllLogChannels ();
+ DisableAllLogChannels (Stream *feedback_strm);
static void
ListAllLogChannels (Stream *strm);
@@ -194,7 +194,7 @@
FindPlugin (const char *plugin_name);
virtual void
- Disable () = 0;
+ Disable (Args &args, Stream *feedback_strm) = 0;
virtual bool
Enable (lldb::StreamSP &log_stream_sp,
Modified: lldb/trunk/include/lldb/lldb-private-log.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-log.h?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-private-log.h (original)
+++ lldb/trunk/include/lldb/lldb-private-log.h Fri Oct 29 16:48:37 2010
@@ -69,7 +69,7 @@
IsLogVerbose ();
void
-DisableLog ();
+DisableLog (Args &args, Stream *feedback_strm);
Log *
EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm);
Modified: lldb/trunk/source/API/SBCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommunication.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommunication.cpp (original)
+++ lldb/trunk/source/API/SBCommunication.cpp Fri Oct 29 16:48:37 2010
@@ -178,6 +178,7 @@
if (m_opaque)
success = m_opaque->StartReadThread ();
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBCommunication::ReadThreadStart (this.obj=%p) => '%s'", m_opaque, (success ? "true" : "false"));
@@ -188,7 +189,6 @@
bool
SBCommunication::ReadThreadStop ()
{
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
//if (log)
// log->Printf ("SBCommunication::ReadThreadStop ()");
@@ -197,6 +197,7 @@
if (m_opaque)
success = m_opaque->StopReadThread ();
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBCommunication::ReadThreadStop (this.obj=%p) => '%s'", m_opaque, (success ? "true" : "false"));
Modified: lldb/trunk/source/API/SBListener.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBListener.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/API/SBListener.cpp (original)
+++ lldb/trunk/source/API/SBListener.cpp Fri Oct 29 16:48:37 2010
@@ -93,6 +93,7 @@
ret_value = m_opaque_ptr->StartListeningForEvents (broadcaster.get(), event_mask);
}
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBListener(%p)::StartListeneingForEvents (SBBroadcaster(%p), event_mask=0x%8.8x) => %d",
m_opaque_ptr, broadcaster.get(), event_mask, ret_value);
Modified: lldb/trunk/source/API/SBProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/API/SBProcess.cpp (original)
+++ lldb/trunk/source/API/SBProcess.cpp Fri Oct 29 16:48:37 2010
@@ -385,7 +385,6 @@
SBError
SBProcess::Continue ()
{
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
SBError sb_error;
if (IsValid())
@@ -401,6 +400,7 @@
else
sb_error.SetErrorString ("SBProcess is invalid");
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
SBStream sstr;
@@ -428,7 +428,6 @@
SBError
SBProcess::Stop ()
{
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
SBError sb_error;
if (IsValid())
@@ -436,6 +435,7 @@
else
sb_error.SetErrorString ("SBProcess is invalid");
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
SBStream sstr;
@@ -452,7 +452,6 @@
SBError
SBProcess::Kill ()
{
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
SBError sb_error;
if (m_opaque_sp)
@@ -460,6 +459,7 @@
else
sb_error.SetErrorString ("SBProcess is invalid");
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
SBStream sstr;
Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Fri Oct 29 16:48:37 2010
@@ -115,12 +115,12 @@
SBProcess
SBTarget::GetProcess ()
{
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
SBProcess sb_process;
if (m_opaque_sp)
sb_process.SetProcess (m_opaque_sp->GetProcessSP());
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
SBStream sstr;
@@ -146,13 +146,13 @@
SBProcess
SBTarget::CreateProcess ()
{
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
SBProcess sb_process;
if (m_opaque_sp)
sb_process.SetProcess (m_opaque_sp->CreateProcess (m_opaque_sp->GetDebugger().GetListener()));
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
SBStream sstr;
@@ -184,6 +184,7 @@
SBError sb_error;
SBProcess sb_process = Launch (argv, envp, tty, launch_flags, stop_at_entry, sb_error);
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
SBStream sstr;
@@ -263,6 +264,7 @@
error.SetErrorString ("SBTarget is invalid");
}
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
SBStream sstr;
Modified: lldb/trunk/source/API/SBThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/API/SBThread.cpp (original)
+++ lldb/trunk/source/API/SBThread.cpp Fri Oct 29 16:48:37 2010
@@ -469,7 +469,6 @@
SBProcess
SBThread::GetProcess ()
{
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
SBProcess process;
if (m_opaque_sp)
@@ -478,6 +477,7 @@
process.SetProcess(m_opaque_sp->GetProcess().GetTarget().GetProcessSP());
}
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
SBStream sstr;
Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Fri Oct 29 16:48:37 2010
@@ -231,6 +231,7 @@
if (should_stop)
{
ThreadPlanSP condition_plan_sp(GetThreadPlanToTestCondition(context->exe_ctx, errors));
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
if (log && errors.GetSize() > 0)
{
log->Printf("Error evaluating condition: \"%s\".\n", errors.GetData());
@@ -244,6 +245,7 @@
if (should_stop)
{
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
if (log)
{
StreamString s;
Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectLog.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectLog.cpp Fri Oct 29 16:48:37 2010
@@ -291,31 +291,29 @@
}
else
{
- for (size_t i=0; i<argc; ++i)
- {
- Log::Callbacks log_callbacks;
+ Log::Callbacks log_callbacks;
- std::string channel(args.GetArgumentAtIndex(i));
- if (Log::GetLogChannelCallbacks (channel.c_str(), log_callbacks))
+ std::string channel(args.GetArgumentAtIndex(0));
+ args.Shift (); // Shift off the channel
+ if (Log::GetLogChannelCallbacks (channel.c_str(), log_callbacks))
+ {
+ log_callbacks.disable (args, &result.GetErrorStream());
+ result.SetStatus(eReturnStatusSuccessFinishNoResult);
+ }
+ else if (channel == "all")
+ {
+ Log::DisableAllLogChannels(&result.GetErrorStream());
+ }
+ else
+ {
+ LogChannelSP log_channel_sp (GetLogChannelPluginForChannel(channel.c_str()));
+ if (log_channel_sp)
{
- log_callbacks.disable ();
+ log_channel_sp->Disable(args, &result.GetErrorStream());
result.SetStatus(eReturnStatusSuccessFinishNoResult);
}
- else if (channel == "all")
- {
- Log::DisableAllLogChannels();
- }
else
- {
- LogChannelSP log_channel_sp (GetLogChannelPluginForChannel(channel.c_str()));
- if (log_channel_sp)
- {
- log_channel_sp->Disable();
- result.SetStatus(eReturnStatusSuccessFinishNoResult);
- }
- else
- result.AppendErrorWithFormat("Invalid log channel '%s'.\n", args.GetArgumentAtIndex(0));
- }
+ result.AppendErrorWithFormat("Invalid log channel '%s'.\n", args.GetArgumentAtIndex(0));
}
}
return result.Succeeded();
Modified: lldb/trunk/source/Core/Communication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Core/Communication.cpp (original)
+++ lldb/trunk/source/Core/Communication.cpp Fri Oct 29 16:48:37 2010
@@ -338,6 +338,7 @@
break;
}
}
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_COMMUNICATION);
if (log)
log->Printf ("%p Communication::ReadThread () thread exiting...", p);
Modified: lldb/trunk/source/Core/Listener.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Listener.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Core/Listener.cpp (original)
+++ lldb/trunk/source/Core/Listener.cpp Fri Oct 29 16:48:37 2010
@@ -388,12 +388,14 @@
else if (timed_out)
{
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS);
if (log)
log->Printf ("%p Listener::WaitForEvents() timed out for %s", this, m_name.c_str());
break;
}
else
{
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS);
if (log)
log->Printf ("%p Listener::WaitForEvents() unknown error for %s", this, m_name.c_str());
break;
Modified: lldb/trunk/source/Core/Log.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Log.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Core/Log.cpp (original)
+++ lldb/trunk/source/Core/Log.cpp Fri Oct 29 16:48:37 2010
@@ -28,7 +28,7 @@
#include "lldb/Host/Host.h"
#include "lldb/Host/TimeValue.h"
#include "lldb/Host/Mutex.h"
-
+#include "lldb/Interpreter/Args.h"
using namespace lldb;
using namespace lldb_private;
@@ -384,18 +384,19 @@
}
void
-Log::DisableAllLogChannels ()
+Log::DisableAllLogChannels (Stream *feedback_strm)
{
CallbackMap &callback_map = GetCallbackMap ();
CallbackMapIter pos, end = callback_map.end();
+ Args args ("all");
for (pos = callback_map.begin(); pos != end; ++pos)
- pos->second.disable ();
+ pos->second.disable (args, feedback_strm);
LogChannelMap &channel_map = GetChannelMap ();
LogChannelMapIter channel_pos, channel_end = channel_map.end();
for (channel_pos = channel_map.begin(); channel_pos != channel_end; ++channel_pos)
- channel_pos->second->Disable ();
+ channel_pos->second->Disable (args, feedback_strm);
}
void
Modified: lldb/trunk/source/Expression/ClangFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangFunction.cpp (original)
+++ lldb/trunk/source/Expression/ClangFunction.cpp Fri Oct 29 16:48:37 2010
@@ -543,6 +543,7 @@
// Right now this is the only way to tell we've timed out...
// We should interrupt the process here...
// Not really sure what to do if Halt fails here...
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
if (log)
if (try_all_threads)
log->Printf ("Running function with timeout: %d timed out, trying with all threads enabled.",
@@ -609,6 +610,7 @@
}
else
{
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
if (log)
{
StreamString s;
@@ -675,7 +677,9 @@
event_explanation = ts.GetData();
} while (0);
- log->Printf("Execution interrupted: %s %s", s.GetData(), event_explanation);
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+ if (log)
+ log->Printf("Execution interrupted: %s %s", s.GetData(), event_explanation);
}
return_value = eExecutionInterrupted;
Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Fri Oct 29 16:48:37 2010
@@ -122,6 +122,7 @@
struct rusage *rusage = NULL;
while (1)
{
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
if (log)
log->Printf("%s ::wait4 (pid = %i, &status, options = %i, rusage = %p)...", function, pid, options, rusage);
@@ -170,6 +171,7 @@
{
ScopedPThreadCancelDisabler pthread_cancel_disabler;
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
if (log)
log->Printf ("%s ::wait4 (pid = %i, &status, options = %i, rusage = %p) => pid = %i, status = 0x%8.8x (%s), signal = %i, exit_state = %i",
function,
@@ -198,6 +200,7 @@
}
}
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
if (log)
log->Printf ("%s (arg = %p) thread exiting...", __FUNCTION__, arg);
Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp Fri Oct 29 16:48:37 2010
@@ -265,6 +265,7 @@
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)",
Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp Fri Oct 29 16:48:37 2010
@@ -547,6 +547,7 @@
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 @@
{
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 @@
}
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 @@
}
#endif // #if defined (__arm__)
+ log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS);
if (log)
log->Printf ("MachTask::%s (arg = %p) thread exiting...", __FUNCTION__, arg);
return NULL;
Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp Fri Oct 29 16:48:37 2010
@@ -742,6 +742,7 @@
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 @@
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 @@
// 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 @@
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 @@
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 @@
}
}
+ log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS);
if (log)
log->Printf("ProcessMacOSX::%s (%p): thread exiting...", __FUNCTION__, arg);
@@ -1647,6 +1653,7 @@
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);
Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp Fri Oct 29 16:48:37 2010
@@ -35,7 +35,44 @@
}
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 @@
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)
{
Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h Fri Oct 29 16:48:37 2010
@@ -47,7 +47,10 @@
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);
Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp Fri Oct 29 16:48:37 2010
@@ -257,6 +257,7 @@
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 @@
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 @@
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 @@
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);
}
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Fri Oct 29 16:48:37 2010
@@ -209,11 +209,14 @@
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 @@
}
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);
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Oct 29 16:48:37 2010
@@ -1212,6 +1212,7 @@
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 @@
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 @@
{
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 @@
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 @@
}
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 @@
}
}
+ log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
if (log)
log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) thread exiting...", __FUNCTION__, arg, process->GetID());
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp Fri Oct 29 16:48:37 2010
@@ -35,7 +35,7 @@
}
void
-ProcessGDBRemoteLog::DisableLog ()
+ProcessGDBRemoteLog::DeleteLog ()
{
if (g_log)
{
@@ -44,10 +44,53 @@
}
}
+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)
{
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h Fri Oct 29 16:48:37 2010
@@ -39,8 +39,11 @@
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);
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp Fri Oct 29 16:48:37 2010
@@ -112,12 +112,44 @@
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 @@
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;
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h Fri Oct 29 16:48:37 2010
@@ -67,7 +67,10 @@
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,
Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Fri Oct 29 16:48:37 2010
@@ -249,6 +249,7 @@
event_sp))
state = Process::ProcessEventData::GetStateFromEvent(event_sp.get());
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
if (log)
log->Printf ("Process::%s (timeout = %p, event_sp) => %s",
__FUNCTION__,
@@ -268,6 +269,7 @@
Event *event_ptr;
event_ptr = m_listener.PeekAtNextEventForBroadcasterWithType (this,
eBroadcastBitStateChanged);
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
if (log)
{
if (event_ptr)
@@ -1640,6 +1642,8 @@
break;
}
+ // Verify log is still enabled before attempting to write to it...
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
if (log)
log->Printf ("Process::%s (arg = %p, pid = %i) thread exiting...", __FUNCTION__, this, GetID());
Modified: lldb/trunk/source/Target/ThreadPlanStepInRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInRange.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepInRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepInRange.cpp Fri Oct 29 16:48:37 2010
@@ -156,6 +156,7 @@
if (bytes_to_skip != 0)
{
func_start_address.Slide (bytes_to_skip);
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
if (log)
log->Printf ("Pushing past prologue ");
Modified: lldb/trunk/source/Target/ThreadPlanTestCondition.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanTestCondition.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanTestCondition.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanTestCondition.cpp Fri Oct 29 16:48:37 2010
@@ -89,11 +89,13 @@
else
m_did_stop = true;
}
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
if (log)
log->Printf("Condition successfully evaluated, result is %s.\n", m_did_stop ? "true" : "false");
}
else
{
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
if (log)
log->Printf("Failed to get a result from the expression, error: \"%s\"\n", error_stream.GetData());
m_did_stop = true;
@@ -101,6 +103,7 @@
}
else if (m_exe_ctx.thread->WasThreadPlanDiscarded (m_expression_plan_sp.get()))
{
+ log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
if (log)
log->Printf("ExecuteExpression thread plan was discarded.\n");
m_did_stop = true;
Modified: lldb/trunk/source/lldb-log.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb-log.cpp?rev=117715&r1=117714&r2=117715&view=diff
==============================================================================
--- lldb/trunk/source/lldb-log.cpp (original)
+++ lldb/trunk/source/lldb-log.cpp Fri Oct 29 16:48:37 2010
@@ -107,11 +107,54 @@
}
void
-lldb_private::DisableLog ()
+lldb_private::DisableLog (Args &args, Stream *feedback_strm)
{
- LogAccessor (false, NULL);
-}
+ Log *log = LogAccessor (true, NULL);
+ uint32_t flag_bits;
+
+ if (log)
+ {
+ flag_bits = 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 &= ~LIBLLDB_LOG_ALL;
+ else if (strcasecmp(arg, "api") == 0) flag_bits &= ~LIBLLDB_LOG_API;
+ else if (strcasestr(arg, "break") == arg) flag_bits &= ~LIBLLDB_LOG_BREAKPOINTS;
+ else if (strcasecmp(arg, "default") == 0 ) flag_bits &= ~LIBLLDB_LOG_DEFAULT;
+ else if (strcasestr(arg, "event") == arg) flag_bits &= ~LIBLLDB_LOG_EVENTS;
+ else if (strcasestr(arg, "expr") == arg) flag_bits &= ~LIBLLDB_LOG_EXPRESSIONS;
+ else if (strcasestr(arg, "object") == arg) flag_bits &= ~LIBLLDB_LOG_OBJECT;
+ else if (strcasecmp(arg, "process") == 0 ) flag_bits &= ~LIBLLDB_LOG_PROCESS;
+ else if (strcasecmp(arg, "shlib") == 0 ) flag_bits &= ~LIBLLDB_LOG_SHLIB;
+ else if (strcasecmp(arg, "state") == 0 ) flag_bits &= ~LIBLLDB_LOG_STATE;
+ else if (strcasecmp(arg, "step") == 0 ) flag_bits &= ~LIBLLDB_LOG_STEP;
+ else if (strcasecmp(arg, "thread") == 0 ) flag_bits &= ~LIBLLDB_LOG_THREAD;
+ else if (strcasecmp(arg, "verbose") == 0 ) flag_bits &= ~LIBLLDB_LOG_VERBOSE;
+ else if (strcasestr(arg, "watch") == arg) flag_bits &= ~LIBLLDB_LOG_WATCHPOINTS;
+ else if (strcasestr(arg, "temp") == arg) flag_bits &= ~LIBLLDB_LOG_TEMPORARY;
+ else if (strcasestr(arg, "comm") == arg) flag_bits &= ~LIBLLDB_LOG_COMMUNICATION;
+ else if (strcasestr(arg, "conn") == arg) flag_bits &= ~LIBLLDB_LOG_CONNECTION;
+ else if (strcasestr(arg, "host") == arg) flag_bits &= ~LIBLLDB_LOG_HOST;
+ else if (strcasestr(arg, "unwind") == arg) flag_bits &= ~LIBLLDB_LOG_UNWIND;
+ else
+ {
+ feedback_strm->Printf ("error: unrecognized log category '%s'\n", arg);
+ ListLogCategories (feedback_strm);
+ return;
+ }
+
+ }
+ if (flag_bits == 0)
+ LogAccessor (false, NULL);
+ else
+ log->GetMask().Reset (flag_bits);
+ }
+
+ return;
+}
Log *
lldb_private::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm)
More information about the lldb-commits
mailing list