diff options
author | Greg Clayton <gclayton@apple.com> | 2010-11-06 01:53:30 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2010-11-06 01:53:30 +0000 |
commit | 2d4edfbc6ad8c8823791dd0285302282d2d2ed03 (patch) | |
tree | c5462c66c46d3ed32bdd6738e948eb410cb0bfde /lldb/source/API/SBBreakpoint.cpp | |
parent | 8e3d95e7dfb44fcd2d7fbf94f104fe821c42268e (diff) | |
download | bcm5719-llvm-2d4edfbc6ad8c8823791dd0285302282d2d2ed03.tar.gz bcm5719-llvm-2d4edfbc6ad8c8823791dd0285302282d2d2ed03.zip |
Modified all logging calls to hand out shared pointers to make sure we
don't crash if we disable logging when some code already has a copy of the
logger. Prior to this fix, logs were handed out as pointers and if they were
held onto while a log got disabled, then it could cause a crash. Now all logs
are handed out as shared pointers so this problem shouldn't happen anymore.
We are also using our new shared pointers that put the shared pointer count
and the object into the same allocation for a tad better performance.
llvm-svn: 118319
Diffstat (limited to 'lldb/source/API/SBBreakpoint.cpp')
-rw-r--r-- | lldb/source/API/SBBreakpoint.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/lldb/source/API/SBBreakpoint.cpp b/lldb/source/API/SBBreakpoint.cpp index 5791b20edc5..280697370fd 100644 --- a/lldb/source/API/SBBreakpoint.cpp +++ b/lldb/source/API/SBBreakpoint.cpp @@ -95,7 +95,7 @@ SBBreakpoint::operator = (const SBBreakpoint& rhs) break_id_t SBBreakpoint::GetID () const { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (m_opaque_sp) { @@ -195,7 +195,7 @@ SBBreakpoint::GetLocationAtIndex (uint32_t index) void SBBreakpoint::SetEnabled (bool enable) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::SetEnabled (enabled=%i)", m_opaque_sp.get(), enable); @@ -216,7 +216,7 @@ SBBreakpoint::IsEnabled () void SBBreakpoint::SetIgnoreCount (uint32_t count) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::SetIgnoreCount (count=%u)", m_opaque_sp.get(), count); @@ -244,7 +244,7 @@ SBBreakpoint::GetHitCount () const if (m_opaque_sp) count = m_opaque_sp->GetHitCount(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::GetHitCount () => %u", m_opaque_sp.get(), count); @@ -258,7 +258,7 @@ SBBreakpoint::GetIgnoreCount () const if (m_opaque_sp) count = m_opaque_sp->GetIgnoreCount(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::GetIgnoreCount () => %u", m_opaque_sp.get(), count); @@ -270,7 +270,7 @@ SBBreakpoint::SetThreadID (tid_t tid) { if (m_opaque_sp) m_opaque_sp->SetThreadID (tid); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::SetThreadID (tid=0x%4.4x)", m_opaque_sp.get(), tid); @@ -283,7 +283,7 @@ SBBreakpoint::GetThreadID () if (m_opaque_sp) tid = m_opaque_sp->GetThreadID(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::GetThreadID () => 0x%4.4x", m_opaque_sp.get(), tid); return tid; @@ -292,7 +292,7 @@ SBBreakpoint::GetThreadID () void SBBreakpoint::SetThreadIndex (uint32_t index) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::SetThreadIndex (%u)", m_opaque_sp.get(), index); if (m_opaque_sp) @@ -309,7 +309,7 @@ SBBreakpoint::GetThreadIndex() const if (thread_spec == NULL) thread_idx = thread_spec->GetIndex(); } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::GetThreadIndex () => %u", m_opaque_sp.get(), index); @@ -320,7 +320,7 @@ SBBreakpoint::GetThreadIndex() const void SBBreakpoint::SetThreadName (const char *thread_name) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::SetThreadName (%s)", m_opaque_sp.get(), thread_name); @@ -338,7 +338,7 @@ SBBreakpoint::GetThreadName () const if (thread_spec == NULL) name = thread_spec->GetName(); } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::GetThreadName () => %s", m_opaque_sp.get(), name); @@ -348,7 +348,7 @@ SBBreakpoint::GetThreadName () const void SBBreakpoint::SetQueueName (const char *queue_name) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::SetQueueName (%s)", m_opaque_sp.get(), queue_name); if (m_opaque_sp) @@ -364,7 +364,7 @@ SBBreakpoint::GetQueueName () const const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpec(); name = thread_spec->GetQueueName(); } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::GetQueueName () => %s", m_opaque_sp.get(), name); @@ -377,7 +377,7 @@ SBBreakpoint::GetNumResolvedLocations() const size_t num_resolved = 0; if (m_opaque_sp) num_resolved = m_opaque_sp->GetNumResolvedLocations(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %zu", m_opaque_sp.get(), num_resolved); return num_resolved; @@ -389,7 +389,7 @@ SBBreakpoint::GetNumLocations() const size_t num_locs = 0; if (m_opaque_sp) num_locs = m_opaque_sp->GetNumLocations(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::GetNumLocations () => %zu", m_opaque_sp.get(), num_locs); return num_locs; @@ -450,7 +450,7 @@ SBBreakpoint::PrivateBreakpointHitCallback void SBBreakpoint::SetCallback (BreakpointHitCallback callback, void *baton) { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBBreakpoint(%p)::SetCallback (callback=%p, baton=%p)", m_opaque_sp.get(), callback, baton); |