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/SBValue.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/SBValue.cpp')
| -rw-r--r-- | lldb/source/API/SBValue.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp index a4b3db2cc14..538324cb25a 100644 --- a/lldb/source/API/SBValue.cpp +++ b/lldb/source/API/SBValue.cpp @@ -89,7 +89,7 @@ SBValue::GetName() if (m_opaque_sp) name = m_opaque_sp->GetName().GetCString(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (name) @@ -107,7 +107,7 @@ SBValue::GetTypeName () const char *name = NULL; if (m_opaque_sp) name = m_opaque_sp->GetTypeName().GetCString(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (name) @@ -127,7 +127,7 @@ SBValue::GetByteSize () if (m_opaque_sp) result = m_opaque_sp->GetByteSize(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBValue(%p)::GetByteSize () => %zu", m_opaque_sp.get(), result); @@ -142,7 +142,7 @@ SBValue::IsInScope (const SBFrame &frame) if (m_opaque_sp) result = m_opaque_sp->IsInScope (frame.get()); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBValue(%p)::IsInScope () => %i", m_opaque_sp.get(), result); @@ -155,7 +155,7 @@ SBValue::GetValue (const SBFrame &frame) const char *cstr = NULL; if ( m_opaque_sp) cstr = m_opaque_sp->GetValueAsCString (frame.get()); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (cstr) @@ -173,7 +173,7 @@ SBValue::GetValueType () ValueType result = eValueTypeInvalid; if (m_opaque_sp) result = m_opaque_sp->GetValueType(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { switch (result) @@ -198,7 +198,7 @@ SBValue::GetObjectDescription (const SBFrame &frame) const char *cstr = NULL; if ( m_opaque_sp) cstr = m_opaque_sp->GetObjectDescription (frame.get()); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (cstr) @@ -215,7 +215,7 @@ SBValue::GetValueDidChange (const SBFrame &frame) bool result = false; if (m_opaque_sp) result = m_opaque_sp->GetValueDidChange (frame.get()); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBValue(%p)::GetValueDidChange (SBFrame(%p)) => %i", m_opaque_sp.get(), frame.get(), result); @@ -228,7 +228,7 @@ SBValue::GetSummary (const SBFrame &frame) const char *cstr = NULL; if (m_opaque_sp) cstr = m_opaque_sp->GetSummaryAsCString(frame.get()); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (cstr) @@ -245,7 +245,7 @@ SBValue::GetLocation (const SBFrame &frame) const char *cstr = NULL; if (m_opaque_sp) cstr = m_opaque_sp->GetLocationAsCString(frame.get()); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (cstr) @@ -276,7 +276,7 @@ SBValue::GetChildAtIndex (uint32_t idx) } SBValue sb_value (child_sp); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBValue(%p)::GetChildAtIndex (%u) => SBValue(%p)", m_opaque_sp.get(), idx, sb_value.get()); @@ -289,7 +289,7 @@ SBValue::GetIndexOfChildWithName (const char *name) uint32_t idx = UINT32_MAX; if (m_opaque_sp) idx = m_opaque_sp->GetIndexOfChildWithName (ConstString(name)); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (idx == UINT32_MAX) @@ -313,7 +313,7 @@ SBValue::GetChildMemberWithName (const char *name) SBValue sb_value (child_sp); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBValue(%p)::GetChildMemberWithName (name=\"%s\") => SBValue(%p)", m_opaque_sp.get(), name, sb_value.get()); @@ -329,7 +329,7 @@ SBValue::GetNumChildren () if (m_opaque_sp) num_children = m_opaque_sp->GetNumChildren(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBValue(%p)::GetNumChildren () => %u", m_opaque_sp.get(), num_children); @@ -357,7 +357,7 @@ SBValue::Dereference () if (m_opaque_sp->IsPointerType()) sb_value = GetChildAtIndex(0); } - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBValue(%p)::Dereference () => SBValue(%p)", m_opaque_sp.get(), sb_value.get()); @@ -372,7 +372,7 @@ SBValue::TypeIsPointerType () if (m_opaque_sp) is_ptr_type = m_opaque_sp->IsPointerType(); - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBValue(%p)::TypeIsPointerType () => %i", m_opaque_sp.get(), is_ptr_type); |

