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
This commit is contained in:
Caroline Tice
2010-10-29 21:48:37 +00:00
parent 4a0c2d73c3
commit 20ad3c40f4
30 changed files with 264 additions and 48 deletions

View File

@@ -178,6 +178,7 @@ SBCommunication::ReadThreadStart ()
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 @@ SBCommunication::ReadThreadStart ()
bool
SBCommunication::ReadThreadStop ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
//if (log)
// log->Printf ("SBCommunication::ReadThreadStop ()");
@@ -197,6 +197,7 @@ SBCommunication::ReadThreadStop ()
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"));

View File

@@ -93,6 +93,7 @@ SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t
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);

View File

@@ -385,7 +385,6 @@ SBProcess::WaitUntilProcessHasStopped (SBCommandReturnObject &result)
SBError
SBProcess::Continue ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
SBError sb_error;
if (IsValid())
@@ -401,6 +400,7 @@ SBProcess::Continue ()
else
sb_error.SetErrorString ("SBProcess is invalid");
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
SBStream sstr;
@@ -428,7 +428,6 @@ SBProcess::Destroy ()
SBError
SBProcess::Stop ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
SBError sb_error;
if (IsValid())
@@ -436,6 +435,7 @@ SBProcess::Stop ()
else
sb_error.SetErrorString ("SBProcess is invalid");
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
SBStream sstr;
@@ -452,7 +452,6 @@ SBProcess::Stop ()
SBError
SBProcess::Kill ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
SBError sb_error;
if (m_opaque_sp)
@@ -460,6 +459,7 @@ SBProcess::Kill ()
else
sb_error.SetErrorString ("SBProcess is invalid");
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
SBStream sstr;

View File

@@ -115,12 +115,12 @@ SBTarget::IsValid () const
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 @@ SBTarget::GetDebugger () const
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 @@ SBTarget::LaunchProcess
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 @@ SBTarget::Launch
error.SetErrorString ("SBTarget is invalid");
}
log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
SBStream sstr;

View File

@@ -469,7 +469,6 @@ SBThread::RunToAddress (lldb::addr_t addr)
SBProcess
SBThread::GetProcess ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
SBProcess process;
if (m_opaque_sp)
@@ -478,6 +477,7 @@ SBThread::GetProcess ()
process.SetProcess(m_opaque_sp->GetProcess().GetTarget().GetProcessSP());
}
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
SBStream sstr;