summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBCommunication.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-11-06 01:53:30 +0000
committerGreg Clayton <gclayton@apple.com>2010-11-06 01:53:30 +0000
commit2d4edfbc6ad8c8823791dd0285302282d2d2ed03 (patch)
treec5462c66c46d3ed32bdd6738e948eb410cb0bfde /lldb/source/API/SBCommunication.cpp
parent8e3d95e7dfb44fcd2d7fbf94f104fe821c42268e (diff)
downloadbcm5719-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/SBCommunication.cpp')
-rw-r--r--lldb/source/API/SBCommunication.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/lldb/source/API/SBCommunication.cpp b/lldb/source/API/SBCommunication.cpp
index fca4882f523..ac3042fd904 100644
--- a/lldb/source/API/SBCommunication.cpp
+++ b/lldb/source/API/SBCommunication.cpp
@@ -28,7 +28,7 @@ SBCommunication::SBCommunication(const char * broadcaster_name) :
m_opaque (new Communication (broadcaster_name)),
m_opaque_owned (true)
{
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommunication::SBCommunication (broadcaster_name=\"%s\") => "
@@ -82,7 +82,7 @@ SBCommunication::Connect (const char *url)
ConnectionStatus
SBCommunication::AdoptFileDesriptor (int fd, bool owns_fd)
{
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
ConnectionStatus status = eConnectionStatusNoConnection;
if (m_opaque)
@@ -110,7 +110,7 @@ SBCommunication::AdoptFileDesriptor (int fd, bool owns_fd)
ConnectionStatus
SBCommunication::Disconnect ()
{
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
ConnectionStatus status= eConnectionStatusNoConnection;
if (m_opaque)
@@ -126,7 +126,7 @@ SBCommunication::Disconnect ()
bool
SBCommunication::IsConnected () const
{
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
bool result = false;
if (m_opaque)
result = m_opaque->IsConnected ();
@@ -140,7 +140,7 @@ SBCommunication::IsConnected () const
size_t
SBCommunication::Read (void *dst, size_t dst_len, uint32_t timeout_usec, ConnectionStatus &status)
{
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%zu, timeout_usec=%u, &status)...",
m_opaque, dst, dst_len, timeout_usec);
@@ -167,7 +167,7 @@ SBCommunication::Write (const void *src, size_t src_len, ConnectionStatus &statu
else
status = eConnectionStatusNoConnection;
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommunication(%p)::Write (src=%p, src_len=%zu, &status=%s) => %zu",
m_opaque, src, src_len, Communication::ConnectionStatusAsCString (status), bytes_written);
@@ -178,7 +178,7 @@ SBCommunication::Write (const void *src, size_t src_len, ConnectionStatus &statu
bool
SBCommunication::ReadThreadStart ()
{
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
bool success = false;
if (m_opaque)
@@ -195,7 +195,7 @@ SBCommunication::ReadThreadStart ()
bool
SBCommunication::ReadThreadStop ()
{
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommunication(%p)::ReadThreadStop ()...", m_opaque);
@@ -215,7 +215,7 @@ SBCommunication::ReadThreadIsRunning ()
bool result = false;
if (m_opaque)
result = m_opaque->ReadThreadIsRunning ();
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommunication(%p)::ReadThreadIsRunning () => %i", m_opaque, result);
return result;
@@ -228,7 +228,7 @@ SBCommunication::SetReadThreadBytesReceivedCallback
void *callback_baton
)
{
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
bool result = false;
if (m_opaque)
@@ -249,7 +249,7 @@ SBCommunication::GetBroadcaster ()
{
SBBroadcaster broadcaster (m_opaque, false);
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommunication(%p)::GetBroadcaster () => SBBroadcaster (%p)",
OpenPOWER on IntegriCloud