summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Thread.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/Target/Thread.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/Target/Thread.cpp')
-rw-r--r--lldb/source/Target/Thread.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 231dc033210..1ca9a9d70e7 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -57,7 +57,7 @@ Thread::Thread (Process &process, lldb::tid_t tid) :
m_unwinder_ap ()
{
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
log->Printf ("%p Thread::Thread(tid = 0x%4.4x)", this, GetID());
@@ -68,7 +68,7 @@ Thread::Thread (Process &process, lldb::tid_t tid) :
Thread::~Thread()
{
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
log->Printf ("%p Thread::~Thread(tid = 0x%4.4x)", this, GetID());
}
@@ -220,7 +220,7 @@ Thread::ShouldStop (Event* event_ptr)
ThreadPlan *current_plan = GetCurrentPlan();
bool should_stop = true;
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
{
StreamString s;
@@ -291,7 +291,7 @@ Vote
Thread::ShouldReportStop (Event* event_ptr)
{
StateType thread_state = GetResumeState ();
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (thread_state == eStateSuspended || thread_state == eStateInvalid)
{
@@ -350,7 +350,7 @@ Thread::PushPlan (ThreadPlanSP &thread_plan_sp)
thread_plan_sp->DidPush();
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
{
StreamString s;
@@ -365,7 +365,7 @@ Thread::PushPlan (ThreadPlanSP &thread_plan_sp)
void
Thread::PopPlan ()
{
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (m_plan_stack.empty())
return;
@@ -492,7 +492,7 @@ Thread::QueueThreadPlan (ThreadPlanSP &thread_plan_sp, bool abort_other_plans)
void
Thread::DiscardThreadPlansUpToPlan (lldb::ThreadPlanSP &up_to_plan_sp)
{
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
{
log->Printf("Discarding thread plans for thread tid = 0x%4.4x, up to %p", GetID(), up_to_plan_sp.get());
@@ -533,7 +533,7 @@ Thread::DiscardThreadPlansUpToPlan (lldb::ThreadPlanSP &up_to_plan_sp)
void
Thread::DiscardThreadPlans(bool force)
{
- Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
{
log->Printf("Discarding thread plans for thread (tid = 0x%4.4x, force %d)", GetID(), force);
OpenPOWER on IntegriCloud