[Lldb-commits] [lldb] r118319 - in /lldb/trunk: include/lldb/ include/lldb/Core/ include/lldb/Expression/ include/lldb/Utility/ source/ source/API/ source/Breakpoint/ source/Core/ source/Expression/ source/Host/common/ source/Host/macosx/ source/Plugins/ABI/SysV-x86_64/ source/Plugins/DynamicLoader/MacOSX-DYLD/ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/ source/Plugins/Process/MacOSX-User/source/ source/Plugins/Process/MacOSX-User/source/MacOSX/ source/Plugins/Process/Utility/ source/Plugins/Process/gdb-remot...

Greg Clayton gclayton at apple.com
Fri Nov 5 18:53:31 PDT 2010


Author: gclayton
Date: Fri Nov  5 20:53:30 2010
New Revision: 118319

URL: http://llvm.org/viewvc/llvm-project?rev=118319&view=rev
Log:
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.


Modified:
    lldb/trunk/include/lldb/Core/Log.h
    lldb/trunk/include/lldb/Expression/RecordingMemoryManager.h
    lldb/trunk/include/lldb/Utility/SharingPtr.h
    lldb/trunk/include/lldb/lldb-private-log.h
    lldb/trunk/source/API/SBAddress.cpp
    lldb/trunk/source/API/SBBreakpoint.cpp
    lldb/trunk/source/API/SBBreakpointLocation.cpp
    lldb/trunk/source/API/SBBroadcaster.cpp
    lldb/trunk/source/API/SBCommandInterpreter.cpp
    lldb/trunk/source/API/SBCommandReturnObject.cpp
    lldb/trunk/source/API/SBCommunication.cpp
    lldb/trunk/source/API/SBCompileUnit.cpp
    lldb/trunk/source/API/SBDebugger.cpp
    lldb/trunk/source/API/SBError.cpp
    lldb/trunk/source/API/SBEvent.cpp
    lldb/trunk/source/API/SBFileSpec.cpp
    lldb/trunk/source/API/SBFrame.cpp
    lldb/trunk/source/API/SBFunction.cpp
    lldb/trunk/source/API/SBHostOS.cpp
    lldb/trunk/source/API/SBInputReader.cpp
    lldb/trunk/source/API/SBLineEntry.cpp
    lldb/trunk/source/API/SBListener.cpp
    lldb/trunk/source/API/SBModule.cpp
    lldb/trunk/source/API/SBProcess.cpp
    lldb/trunk/source/API/SBSymbol.cpp
    lldb/trunk/source/API/SBSymbolContext.cpp
    lldb/trunk/source/API/SBTarget.cpp
    lldb/trunk/source/API/SBThread.cpp
    lldb/trunk/source/API/SBType.cpp
    lldb/trunk/source/API/SBValue.cpp
    lldb/trunk/source/API/SBValueList.cpp
    lldb/trunk/source/Breakpoint/Breakpoint.cpp
    lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
    lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp
    lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp
    lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
    lldb/trunk/source/Core/AddressResolverFileLine.cpp
    lldb/trunk/source/Core/AddressResolverName.cpp
    lldb/trunk/source/Core/Broadcaster.cpp
    lldb/trunk/source/Core/Communication.cpp
    lldb/trunk/source/Core/ConnectionFileDescriptor.cpp
    lldb/trunk/source/Core/Listener.cpp
    lldb/trunk/source/Core/Module.cpp
    lldb/trunk/source/Expression/ASTResultSynthesizer.cpp
    lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
    lldb/trunk/source/Expression/ClangExpressionParser.cpp
    lldb/trunk/source/Expression/ClangFunction.cpp
    lldb/trunk/source/Expression/ClangUserExpression.cpp
    lldb/trunk/source/Expression/DWARFExpression.cpp
    lldb/trunk/source/Expression/IRDynamicChecks.cpp
    lldb/trunk/source/Expression/IRForTarget.cpp
    lldb/trunk/source/Expression/IRToDWARF.cpp
    lldb/trunk/source/Expression/RecordingMemoryManager.cpp
    lldb/trunk/source/Host/common/Host.cpp
    lldb/trunk/source/Host/macosx/Host.mm
    lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
    lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMMemory.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMRegion.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h
    lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
    lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h
    lldb/trunk/source/Symbol/ClangASTContext.cpp
    lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
    lldb/trunk/source/Target/ObjCLanguageRuntime.cpp
    lldb/trunk/source/Target/Process.cpp
    lldb/trunk/source/Target/SectionLoadList.cpp
    lldb/trunk/source/Target/StopInfo.cpp
    lldb/trunk/source/Target/Target.cpp
    lldb/trunk/source/Target/Thread.cpp
    lldb/trunk/source/Target/ThreadList.cpp
    lldb/trunk/source/Target/ThreadPlan.cpp
    lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
    lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp
    lldb/trunk/source/Target/ThreadPlanStepInRange.cpp
    lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp
    lldb/trunk/source/Target/ThreadPlanStepOut.cpp
    lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp
    lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp
    lldb/trunk/source/Target/ThreadPlanStepRange.cpp
    lldb/trunk/source/Target/ThreadPlanStepThrough.cpp
    lldb/trunk/source/Target/ThreadPlanStepUntil.cpp
    lldb/trunk/source/Target/ThreadPlanTestCondition.cpp
    lldb/trunk/source/lldb-log.cpp

Modified: lldb/trunk/include/lldb/Core/Log.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Log.h?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Log.h (original)
+++ lldb/trunk/include/lldb/Core/Log.h Fri Nov  5 20:53:30 2010
@@ -60,10 +60,10 @@
     // Callback definitions for abstracted plug-in log access.
     //------------------------------------------------------------------
     typedef void (*DisableCallback) (Args &args, Stream *feedback_strm);
-    typedef Log* (*EnableCallback) (lldb::StreamSP &log_stream_sp,
-                                    uint32_t log_options,
-                                    Args &args,
-                                    Stream *feedback_strm);
+    typedef lldb::LogSP (*EnableCallback) (lldb::StreamSP &log_stream_sp,
+                                           uint32_t log_options,
+                                           Args &args,
+                                           Stream *feedback_strm);
     typedef void (*ListCategoriesCallback) (Stream *strm);
 
     struct Callbacks

Modified: lldb/trunk/include/lldb/Expression/RecordingMemoryManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/RecordingMemoryManager.h?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/RecordingMemoryManager.h (original)
+++ lldb/trunk/include/lldb/Expression/RecordingMemoryManager.h Fri Nov  5 20:53:30 2010
@@ -285,7 +285,7 @@
     std::map<uint8_t *, uintptr_t> m_globals;           ///< A map from the base addresses of globals to their sizes.
     std::map<uint8_t *, uint8_t *> m_exception_tables;  ///< A map from the base addresses of exception tables to their end addresses.
     
-    lldb_private::Log *m_log;                           ///< The log to use when printing log messages.  May be NULL.
+    lldb::LogSP m_log; ///< The log to use when printing log messages.  May be NULL.
 
     //----------------------------------------------------------------------
     /// @class LocalToRemoteAddressRange RecordingMemoryManager.h "lldb/Expression/RecordingMemoryManager.h"

Modified: lldb/trunk/include/lldb/Utility/SharingPtr.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/SharingPtr.h?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/SharingPtr.h (original)
+++ lldb/trunk/include/lldb/Utility/SharingPtr.h Fri Nov  5 20:53:30 2010
@@ -267,7 +267,7 @@
     typedef imp::shared_ptr_emplace<T> CntrlBlk;
     SharingPtr<T> r;
     r.cntrl_ = new CntrlBlk();
-    r.ptr_ = r.cntrl_->get();
+    r.ptr_ = static_cast<CntrlBlk*>(r.cntrl_)->get();
     return r;
 }
 

Modified: lldb/trunk/include/lldb/lldb-private-log.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-log.h?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-private-log.h (original)
+++ lldb/trunk/include/lldb/lldb-private-log.h Fri Nov  5 20:53:30 2010
@@ -56,10 +56,10 @@
 void
 LogIfAnyCategoriesSet (uint32_t mask, const char *format, ...);
 
-Log *
+lldb::LogSP
 GetLogIfAllCategoriesSet (uint32_t mask);
 
-Log *
+lldb::LogSP
 GetLogIfAnyCategoriesSet (uint32_t mask);
 
 uint32_t
@@ -71,7 +71,7 @@
 void
 DisableLog (Args &args, Stream *feedback_strm);
 
-Log *
+lldb::LogSP
 EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm);
 
 void

Modified: lldb/trunk/source/API/SBAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBAddress.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBAddress.cpp (original)
+++ lldb/trunk/source/API/SBAddress.cpp Fri Nov  5 20:53:30 2010
@@ -87,7 +87,7 @@
 lldb::addr_t
 SBAddress::GetLoadAddress (const SBTarget &target) const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (m_opaque_ap.get())
     {

Modified: lldb/trunk/source/API/SBBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpoint.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBreakpoint.cpp (original)
+++ lldb/trunk/source/API/SBBreakpoint.cpp Fri Nov  5 20:53:30 2010
@@ -95,7 +95,7 @@
 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 @@
 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 @@
 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 @@
     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 @@
     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 @@
 {
     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 @@
     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 @@
 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 @@
         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 @@
 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 @@
         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 @@
 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 @@
         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 @@
     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 @@
     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 @@
 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);

Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBreakpointLocation.cpp (original)
+++ lldb/trunk/source/API/SBBreakpointLocation.cpp Fri Nov  5 20:53:30 2010
@@ -33,7 +33,7 @@
 SBBreakpointLocation::SBBreakpointLocation (const lldb::BreakpointLocationSP &break_loc_sp) :
     m_opaque_sp (break_loc_sp)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
     {
@@ -244,7 +244,7 @@
 SBBreakpoint
 SBBreakpointLocation::GetBreakpoint ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     //if (log)
     //    log->Printf ("SBBreakpointLocation::GetBreakpoint ()");

Modified: lldb/trunk/source/API/SBBroadcaster.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBroadcaster.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBroadcaster.cpp (original)
+++ lldb/trunk/source/API/SBBroadcaster.cpp Fri Nov  5 20:53:30 2010
@@ -30,7 +30,7 @@
     m_opaque_ptr (NULL)
 {
     m_opaque_ptr = m_opaque_sp.get();
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE));
 
     if (log)
         log->Printf ("SBBroadcaster::SBBroadcaster (name=\"%s\") => SBBroadcaster(%p)",
@@ -41,7 +41,7 @@
     m_opaque_sp (owns ? broadcaster : NULL),
     m_opaque_ptr (broadcaster)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE));
 
     if (log)
         log->Printf ("SBBroadcaster::SBBroadcaster (broadcaster=%p, bool owns=%i) => SBBroadcaster(%p)", 
@@ -73,7 +73,7 @@
 void
 SBBroadcaster::BroadcastEventByType (uint32_t event_type, bool unique)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (event_type=0x%8.8x, unique=%i)", m_opaque_ptr, event_type, unique);
@@ -90,7 +90,7 @@
 void
 SBBroadcaster::BroadcastEvent (const SBEvent &event, bool unique)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (SBEvent(%p), unique=%i)", m_opaque_ptr, event.get(), unique);
@@ -108,7 +108,7 @@
 void
 SBBroadcaster::AddInitialEventsToListener (const SBListener &listener, uint32_t requested_events)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBBroadcaster(%p)::AddInitialEventsToListener (SBListener(%p), event_mask=0x%8.8x)", m_opaque_ptr, listener.get(), requested_events);
     if (m_opaque_ptr)

Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommandInterpreter.cpp (original)
+++ lldb/trunk/source/API/SBCommandInterpreter.cpp Fri Nov  5 20:53:30 2010
@@ -33,7 +33,7 @@
 SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) :
     m_opaque_ptr (interpreter)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBCommandInterpreter::SBCommandInterpreter (interpreter=%p)"
@@ -82,7 +82,7 @@
 lldb::ReturnStatus
 SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnObject &result, bool add_to_history)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBCommandInterpreter(%p)::HandleCommand (command=\"%s\", SBCommandReturnObject(%p), add_to_history=%i)", 
@@ -168,7 +168,7 @@
         if (target)
             process.SetProcess(target->GetProcessSP());
     }
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBCommandInterpreter(%p)::GetProcess () => SBProcess(%p)", 
@@ -187,7 +187,7 @@
 ssize_t
 SBCommandInterpreter::WriteToScriptInterpreter (const char *src, size_t src_len)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     ssize_t bytes_written = 0;
     if (m_opaque_ptr && src && src[0])
@@ -236,7 +236,7 @@
         result->AppendError ("SBCommandInterpreter is not valid");
         result->SetStatus (eReturnStatusFailed);
     }
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBCommandInterpreter(%p)::SourceInitFileInHomeDirectory (&SBCommandReturnObject(%p))", 
@@ -257,7 +257,7 @@
         result->AppendError ("SBCommandInterpreter is not valid");
         result->SetStatus (eReturnStatusFailed);
     }
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBCommandInterpreter(%p)::SourceInitFileInCurrentWorkingDirectory (&SBCommandReturnObject(%p))", 
@@ -267,7 +267,7 @@
 SBBroadcaster
 SBCommandInterpreter::GetBroadcaster ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBBroadcaster broadcaster (m_opaque_ptr, false);
 

Modified: lldb/trunk/source/API/SBCommandReturnObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandReturnObject.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommandReturnObject.cpp (original)
+++ lldb/trunk/source/API/SBCommandReturnObject.cpp Fri Nov  5 20:53:30 2010
@@ -57,7 +57,7 @@
 const char *
 SBCommandReturnObject::GetOutput ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (m_opaque_ap.get())
     {
@@ -77,7 +77,7 @@
 const char *
 SBCommandReturnObject::GetError ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (m_opaque_ap.get())
     {

Modified: lldb/trunk/source/API/SBCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommunication.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommunication.cpp (original)
+++ lldb/trunk/source/API/SBCommunication.cpp Fri Nov  5 20:53:30 2010
@@ -28,7 +28,7 @@
     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 @@
 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 @@
 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 @@
 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 @@
 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 @@
     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 @@
 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 @@
 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 @@
     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 @@
     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 @@
 {
     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)",

Modified: lldb/trunk/source/API/SBCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCompileUnit.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCompileUnit.cpp (original)
+++ lldb/trunk/source/API/SBCompileUnit.cpp Fri Nov  5 20:53:30 2010
@@ -71,7 +71,7 @@
 SBLineEntry
 SBCompileUnit::GetLineEntryAtIndex (uint32_t idx) const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBLineEntry sb_line_entry;
     if (m_opaque_ptr)
@@ -99,7 +99,7 @@
 uint32_t
 SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec *inline_file_spec) const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     uint32_t index = UINT32_MAX;
     if (m_opaque_ptr)

Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Fri Nov  5 20:53:30 2010
@@ -37,7 +37,7 @@
 void
 SBDebugger::Initialize ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBDebugger::Initialize ()");
@@ -54,7 +54,7 @@
 void
 SBDebugger::Clear ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBDebugger(%p)::Clear ()", m_opaque_sp.get());
@@ -65,7 +65,7 @@
 SBDebugger
 SBDebugger::Create()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBDebugger debugger;
     debugger.reset(Debugger::CreateInstance());
@@ -130,7 +130,7 @@
 void
 SBDebugger::SetInputFileHandle (FILE *fh, bool transfer_ownership)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBDebugger(%p)::SetInputFileHandle (fh=%p, transfer_ownership=%i)", m_opaque_sp.get(),
@@ -143,7 +143,7 @@
 void
 SBDebugger::SetOutputFileHandle (FILE *fh, bool transfer_ownership)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
 
     if (log)
@@ -157,7 +157,7 @@
 void
 SBDebugger::SetErrorFileHandle (FILE *fh, bool transfer_ownership)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
 
     if (log)
@@ -195,7 +195,7 @@
 SBCommandInterpreter
 SBDebugger::GetCommandInterpreter ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBCommandInterpreter sb_interpreter;
     if (m_opaque_sp)
@@ -243,7 +243,7 @@
 SBListener
 SBDebugger::GetListener ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBListener sb_listener;
     if (m_opaque_sp)
@@ -432,7 +432,7 @@
 bool
 SBDebugger::StateIsRunningState (lldb::StateType state)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     const bool result = lldb_private::StateIsRunningState (state);
     if (log)
@@ -445,7 +445,7 @@
 bool
 SBDebugger::StateIsStoppedState (lldb::StateType state)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     const bool result = lldb_private::StateIsStoppedState (state);
     if (log)
@@ -471,7 +471,7 @@
         target.reset (target_sp);
     }
     
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
         log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndTargetTriple (filename=\"%s\", triple=%s) => SBTarget(%p)", 
@@ -484,7 +484,7 @@
 SBTarget
 SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *archname)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBTarget target;
     if (m_opaque_sp)
@@ -565,7 +565,7 @@
             target.reset (target_sp);
         }
     }
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
         log->Printf ("SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)", 
@@ -628,7 +628,7 @@
 SBTarget
 SBDebugger::GetSelectedTarget ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBTarget sb_target;
     if (m_opaque_sp)
@@ -648,7 +648,7 @@
 void
 SBDebugger::DispatchInput (void *baton, const void *data, size_t data_len)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBDebugger(%p)::DispatchInput (baton=%p, data=\"%.*s\", size_t=%zu)", m_opaque_sp.get(),
@@ -661,7 +661,7 @@
 void
 SBDebugger::PushInputReader (SBInputReader &reader)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBDebugger(%p)::PushInputReader (SBInputReader(%p))", m_opaque_sp.get(), &reader);
@@ -768,7 +768,7 @@
 const char *
 SBDebugger::GetPrompt() const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     
     if (log)
         log->Printf ("SBDebugger(%p)::GetPrompt () => \"%s\"", m_opaque_sp.get(), 

Modified: lldb/trunk/source/API/SBError.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBError.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBError.cpp (original)
+++ lldb/trunk/source/API/SBError.cpp Fri Nov  5 20:53:30 2010
@@ -70,7 +70,7 @@
 bool
 SBError::Fail () const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     bool ret_value = false;
     if (m_opaque_ap.get())
@@ -85,7 +85,7 @@
 bool
 SBError::Success () const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     bool ret_value = false;
     if (m_opaque_ap.get())
         ret_value = m_opaque_ap->Success();
@@ -99,7 +99,7 @@
 uint32_t
 SBError::GetError () const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     uint32_t err = 0;
     if (m_opaque_ap.get())
@@ -115,7 +115,7 @@
 ErrorType
 SBError::GetType () const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     ErrorType err_type = eErrorTypeInvalid;
     if (m_opaque_ap.get())
         err_type = m_opaque_ap->GetType();

Modified: lldb/trunk/source/API/SBEvent.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBEvent.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBEvent.cpp (original)
+++ lldb/trunk/source/API/SBEvent.cpp Fri Nov  5 20:53:30 2010
@@ -75,7 +75,7 @@
 uint32_t
 SBEvent::GetType () const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     const Event *lldb_event = get();
     uint32_t event_type = 0;
@@ -123,7 +123,7 @@
         success = lldb_event->BroadcasterIs (broadcaster.get());
 
     // For logging, this gets a little chatty so only enable this when verbose logging is on
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE));
     if (log)
         log->Printf ("SBEvent(%p)::BroadcasterMatchesRef (SBBroadcaster(%p): %s) => %i", 
                      get(),
@@ -187,7 +187,7 @@
 const char *
 SBEvent::GetCStringFromEvent (const SBEvent &event)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBEvent(%p)::GetCStringFromEvent () => \"%s\"", 

Modified: lldb/trunk/source/API/SBFileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFileSpec.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFileSpec.cpp (original)
+++ lldb/trunk/source/API/SBFileSpec.cpp Fri Nov  5 20:53:30 2010
@@ -25,7 +25,7 @@
 SBFileSpec::SBFileSpec (const SBFileSpec &rhs) :
     m_opaque_ap()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (rhs.m_opaque_ap.get())
         m_opaque_ap.reset (new FileSpec (rhs.get()));
@@ -48,7 +48,7 @@
 SBFileSpec::SBFileSpec (const char *path, bool resolve) :
     m_opaque_ap(new FileSpec (path, resolve))
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBFileSpec::SBFileSpec (path=\"%s\", resolve=%i) => SBFileSpec(%p)", path, 
@@ -79,7 +79,7 @@
 bool
 SBFileSpec::Exists () const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     bool result = false;
     if (m_opaque_ap.get())
@@ -112,7 +112,7 @@
     if (m_opaque_ap.get())
         s = m_opaque_ap->GetFilename().AsCString();
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
         if (s)
@@ -130,7 +130,7 @@
     const char *s = NULL;
     if (m_opaque_ap.get())
         s = m_opaque_ap->GetDirectory().AsCString();
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
         if (s)
@@ -144,7 +144,7 @@
 uint32_t
 SBFileSpec::GetPath (char *dst_path, size_t dst_len) const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     uint32_t result = 0;
     if (m_opaque_ap.get())

Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Fri Nov  5 20:53:30 2010
@@ -51,7 +51,7 @@
 SBFrame::SBFrame (const lldb::StackFrameSP &lldb_object_sp) :
     m_opaque_sp (lldb_object_sp)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
     {
@@ -86,7 +86,7 @@
 {
     void *old_ptr = m_opaque_sp.get();
     m_opaque_sp = lldb_object_sp;
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
     {
@@ -111,7 +111,7 @@
     if (m_opaque_sp)
         sb_sym_ctx.SetSymbolContext(&m_opaque_sp->GetSymbolContext (resolve_scope));
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBFrame(%p)::GetSymbolContext (resolve_scope=0x%8.8x) => SBSymbolContext(%p)", 
                      m_opaque_sp.get(), resolve_scope, sb_sym_ctx.get());
@@ -123,7 +123,7 @@
 SBFrame::GetModule () const
 {
     SBModule sb_module (m_opaque_sp->GetSymbolContext (eSymbolContextModule).module_sp);
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBFrame(%p)::GetModule () => SBModule(%p)", 
                      m_opaque_sp.get(), sb_module.get());
@@ -136,7 +136,7 @@
 {
     SBCompileUnit sb_comp_unit(m_opaque_sp->GetSymbolContext (eSymbolContextCompUnit).comp_unit);
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBFrame(%p)::GetModule () => SBCompileUnit(%p)", 
                      m_opaque_sp.get(), sb_comp_unit.get());
@@ -149,7 +149,7 @@
 {
     SBFunction sb_function(m_opaque_sp->GetSymbolContext (eSymbolContextFunction).function);
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBFrame(%p)::GetFunction () => SBFunction(%p)", 
                      m_opaque_sp.get(), sb_function.get());
@@ -161,7 +161,7 @@
 SBFrame::GetSymbol () const
 {
     SBSymbol sb_symbol(m_opaque_sp->GetSymbolContext (eSymbolContextSymbol).symbol);
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBFrame(%p)::GetSymbol () => SBSymbol(%p)", 
                      m_opaque_sp.get(), sb_symbol.get());
@@ -172,7 +172,7 @@
 SBFrame::GetBlock () const
 {
     SBBlock sb_block(m_opaque_sp->GetSymbolContext (eSymbolContextBlock).block);
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBFrame(%p)::GetBlock () => SBBlock(%p)", 
                      m_opaque_sp.get(), sb_block.get());
@@ -183,7 +183,7 @@
 SBFrame::GetFrameBlock () const
 {
     SBBlock sb_block(m_opaque_sp->GetFrameBlock ());
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBFrame(%p)::GetFrameBlock () => SBBlock(%p)", 
                      m_opaque_sp.get(), sb_block.get());
@@ -194,7 +194,7 @@
 SBFrame::GetLineEntry () const
 {
     SBLineEntry sb_line_entry(&m_opaque_sp->GetSymbolContext (eSymbolContextLineEntry).line_entry);
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBFrame(%p)::GetLineEntry () => SBLineEntry(%p)", 
                      m_opaque_sp.get(), sb_line_entry.get());
@@ -206,7 +206,7 @@
 {
     uint32_t frame_idx = m_opaque_sp ? m_opaque_sp->GetFrameIndex () : UINT32_MAX;
     
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBFrame(%p)::GetFrameID () => %u", 
                      m_opaque_sp.get(), frame_idx);
@@ -221,7 +221,7 @@
     if (m_opaque_sp)
         addr = m_opaque_sp->GetFrameCodeAddress().GetLoadAddress (&m_opaque_sp->GetThread().GetProcess().GetTarget());
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBFrame(%p)::GetPC () => 0x%llx", m_opaque_sp.get(), addr);
 
@@ -236,7 +236,7 @@
     if (m_opaque_sp)
         ret_val = m_opaque_sp->GetRegisterContext()->SetPC (new_pc);
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBFrame(%p)::SetPC (new_pc=0x%llx) => %i", 
                      m_opaque_sp.get(), new_pc, ret_val);
@@ -250,7 +250,7 @@
     addr_t addr = LLDB_INVALID_ADDRESS;
     if (m_opaque_sp)
         addr = m_opaque_sp->GetRegisterContext()->GetSP();
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBFrame(%p)::GetSP () => 0x%llx", m_opaque_sp.get(), addr);
 
@@ -265,7 +265,7 @@
     if (m_opaque_sp)
         addr = m_opaque_sp->GetRegisterContext()->GetFP();
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBFrame(%p)::GetFP () => 0x%llx", m_opaque_sp.get(), addr);
     return addr;
@@ -278,7 +278,7 @@
     SBAddress sb_addr;
     if (m_opaque_sp)
         sb_addr.SetAddress (&m_opaque_sp->GetFrameCodeAddress());
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBFrame(%p)::GetPCAddress () => SBAddress(%p)", m_opaque_sp.get(), sb_addr.get());
     return sb_addr;
@@ -322,7 +322,7 @@
     if (var_sp)
         *sb_value = ValueObjectSP (new ValueObjectVariable (var_sp));
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBFrame(%p)::LookupVar (name=\"%s\") => SBValue(%p)", 
                      m_opaque_sp.get(), var_name, sb_value.get());
@@ -377,7 +377,7 @@
     if (var_sp)
         *sb_value = ValueObjectSP (new ValueObjectVariable (var_sp));
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBFrame(%p)::LookupVarInScope (name=\"%s\", scope=%s) => SBValue(%p)", 
                      m_opaque_sp.get(), var_name, scope, sb_value.get());
@@ -414,7 +414,7 @@
 SBThread
 SBFrame::GetThread () const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     //if (log)
     //    log->Printf ("SBFrame::GetThread ()");
@@ -438,7 +438,7 @@
     const char *disassembly = NULL;
     if (m_opaque_sp)
         disassembly = m_opaque_sp->Disassemble();
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBFrame(%p)::Disassemble () => %s", m_opaque_sp.get(), disassembly);
@@ -453,7 +453,7 @@
                        bool statics,
                        bool in_scope_only)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBFrame(%p)::GetVariables (arguments=%i, locals=%i, statics=%i, in_scope_only=%i)", 
@@ -522,7 +522,7 @@
 lldb::SBValueList
 SBFrame::GetRegisters ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBValueList value_list;
     if (m_opaque_sp)
@@ -561,7 +561,7 @@
 lldb::SBValue
 SBFrame::EvaluateExpression (const char *expr)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     lldb::SBValue expr_result;
     if (log)

Modified: lldb/trunk/source/API/SBFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFunction.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFunction.cpp (original)
+++ lldb/trunk/source/API/SBFunction.cpp Fri Nov  5 20:53:30 2010
@@ -62,7 +62,7 @@
     if (m_opaque_ptr)
         cstr = m_opaque_ptr->GetMangled().GetName().AsCString();
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
         if (cstr)
@@ -79,7 +79,7 @@
     const char *cstr = NULL;
     if (m_opaque_ptr)
         cstr = m_opaque_ptr->GetMangled().GetMangledName().AsCString();
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
         if (cstr)

Modified: lldb/trunk/source/API/SBHostOS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBHostOS.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBHostOS.cpp (original)
+++ lldb/trunk/source/API/SBHostOS.cpp Fri Nov  5 20:53:30 2010
@@ -35,7 +35,7 @@
     SBError *error_ptr
 )
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBHostOS::ThreadCreate (name=\"%s\", thread_function=%p, thread_arg=%p, error_ptr=%p)", name, 

Modified: lldb/trunk/source/API/SBInputReader.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBInputReader.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBInputReader.cpp (original)
+++ lldb/trunk/source/API/SBInputReader.cpp Fri Nov  5 20:53:30 2010
@@ -33,7 +33,7 @@
 SBInputReader::SBInputReader (const lldb::InputReaderSP &reader_sp) :
     m_opaque_sp (reader_sp)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBInputReader::SBInputReader (reader_sp=%p) => SBInputReader(%p)", reader_sp.get(), 
@@ -43,7 +43,7 @@
 SBInputReader::SBInputReader (const SBInputReader &rhs) :
     m_opaque_sp (rhs.m_opaque_sp)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf("SBInputReader::SBInputReader (rhs.sp=%p) => SBInputReader(%p)", 
@@ -84,7 +84,7 @@
     bool echo
 )
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf("SBInputReader(%p)::Initialize (SBDebugger(%p), callback_function=%p, callback_baton=%p, "
@@ -194,7 +194,7 @@
 bool
 SBInputReader::IsActive () const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     bool ret_value = false;
     if (m_opaque_sp)

Modified: lldb/trunk/source/API/SBLineEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBLineEntry.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBLineEntry.cpp (original)
+++ lldb/trunk/source/API/SBLineEntry.cpp Fri Nov  5 20:53:30 2010
@@ -69,7 +69,7 @@
     if (m_opaque_ap.get())
         sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress());
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
         StreamString sstr;
@@ -91,7 +91,7 @@
         sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress());
         sb_address.OffsetAddress(m_opaque_ap->range.GetByteSize());
     }
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
         StreamString sstr;
@@ -113,7 +113,7 @@
 SBFileSpec
 SBLineEntry::GetFileSpec () const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBFileSpec sb_file_spec;
     if (m_opaque_ap.get() && m_opaque_ap->file)
@@ -133,7 +133,7 @@
 uint32_t
 SBLineEntry::GetLine () const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     uint32_t line = 0;
     if (m_opaque_ap.get())

Modified: lldb/trunk/source/API/SBListener.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBListener.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBListener.cpp (original)
+++ lldb/trunk/source/API/SBListener.cpp Fri Nov  5 20:53:30 2010
@@ -34,7 +34,7 @@
 {
     m_opaque_ptr = m_opaque_sp.get();
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBListener::SBListener (name=\"%s\") => SBListener(%p)",
@@ -93,7 +93,7 @@
 uint32_t
 SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t event_mask)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     uint32_t acquired_event_mask = 0;
     if (m_opaque_ptr && broadcaster.IsValid())
@@ -152,7 +152,7 @@
 bool
 SBListener::WaitForEvent (uint32_t timeout_secs, SBEvent &event)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
         if (timeout_secs == UINT32_MAX)

Modified: lldb/trunk/source/API/SBModule.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBModule.cpp (original)
+++ lldb/trunk/source/API/SBModule.cpp Fri Nov  5 20:53:30 2010
@@ -56,7 +56,7 @@
 SBFileSpec
 SBModule::GetFileSpec () const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBFileSpec file_spec;
     if (m_opaque_sp)
@@ -74,7 +74,7 @@
 const uint8_t *
 SBModule::GetUUIDBytes () const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     const uint8_t *uuid_bytes = NULL;
     if (m_opaque_sp)

Modified: lldb/trunk/source/API/SBProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBProcess.cpp (original)
+++ lldb/trunk/source/API/SBProcess.cpp Fri Nov  5 20:53:30 2010
@@ -99,7 +99,7 @@
 uint32_t
 SBProcess::GetNumThreads ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     uint32_t num_threads = 0;
     if (m_opaque_sp)
@@ -117,7 +117,7 @@
 SBThread
 SBProcess::GetSelectedThread () const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBThread sb_thread;
     if (m_opaque_sp)
@@ -134,7 +134,7 @@
 SBTarget
 SBProcess::GetTarget() const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBTarget sb_target;
     if (m_opaque_sp)
@@ -150,7 +150,7 @@
 size_t
 SBProcess::PutSTDIN (const char *src, size_t src_len)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     size_t ret_val = 0;
     if (m_opaque_sp != NULL)
@@ -179,7 +179,7 @@
         bytes_read = m_opaque_sp->GetSTDOUT (dst, dst_len, error);
     }
     
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBProcess(%p)::GetSTDOUT (dst=\"%.*s\", dst_len=%zu) => %zu", 
                      m_opaque_sp.get(), (int) bytes_read, dst, dst_len, bytes_read);
@@ -197,7 +197,7 @@
         bytes_read = m_opaque_sp->GetSTDERR (dst, dst_len, error);
     }
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBProcess(%p)::GetSTDERR (dst=\"%.*s\", dst_len=%zu) => %zu",
                      m_opaque_sp.get(), (int) bytes_read, dst, dst_len, bytes_read);
@@ -254,7 +254,7 @@
 bool
 SBProcess::SetSelectedThreadByID (uint32_t tid)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     bool ret_val = false;
     if (m_opaque_sp != NULL)
@@ -270,7 +270,7 @@
 SBThread
 SBProcess::GetThreadAtIndex (size_t index)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBThread thread;
     if (m_opaque_sp)
@@ -293,7 +293,7 @@
     if (m_opaque_sp != NULL)
         ret_val = m_opaque_sp->GetState();
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBProcess(%p)::GetState () => %s", 
                      m_opaque_sp.get(),
@@ -309,7 +309,7 @@
     int exit_status = 0;
     if (m_opaque_sp)
         exit_status = m_opaque_sp->GetExitStatus ();
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBProcess(%p)::GetExitStatus () => %i (0x%8.8x)", 
                      m_opaque_sp.get(), exit_status, exit_status);
@@ -323,7 +323,7 @@
     const char *exit_desc = NULL;
     if (m_opaque_sp != NULL)
         exit_desc = m_opaque_sp->GetExitDescription ();
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBProcess(%p)::GetExitDescription () => %s", 
                      m_opaque_sp.get(), exit_desc);
@@ -337,7 +337,7 @@
     if (m_opaque_sp)
         ret_val = m_opaque_sp->GetID();
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBProcess(%p)::GetProcessID () => %d", m_opaque_sp.get(), ret_val);
 
@@ -351,7 +351,7 @@
     if (m_opaque_sp)
         size =  m_opaque_sp->GetAddressByteSize();
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBProcess(%p)::GetAddressByteSize () => %d", m_opaque_sp.get(), size);
 
@@ -361,7 +361,7 @@
 SBError
 SBProcess::Continue ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBProcess(%p)::Continue ()...", m_opaque_sp.get());
     
@@ -403,7 +403,7 @@
     else
         sb_error.SetErrorString ("SBProcess is invalid");
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
         SBStream sstr;
@@ -425,7 +425,7 @@
     else
         sb_error.SetErrorString ("SBProcess is invalid");
     
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
         SBStream sstr;
@@ -449,7 +449,7 @@
     else
         sb_error.SetErrorString ("SBProcess is invalid");
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
         SBStream sstr;
@@ -514,7 +514,7 @@
         sb_error.SetError (m_opaque_sp->Signal (signo));
     else
         sb_error.SetErrorString ("SBProcess is invalid");    
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
         SBStream sstr;
@@ -535,7 +535,7 @@
     if (m_opaque_sp)
         sb_thread.SetThread (m_opaque_sp->GetThreadList().FindThreadByID ((tid_t) tid));
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
         log->Printf ("SBProcess(%p)::GetThreadByID (tid=0x%4.4x) => SBThread (%p)", 
@@ -550,7 +550,7 @@
 StateType
 SBProcess::GetStateFromEvent (const SBEvent &event)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     StateType ret_val = Process::ProcessEventData::GetStateFromEvent (event.get());
     
@@ -578,7 +578,7 @@
 SBBroadcaster
 SBProcess::GetBroadcaster () const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBBroadcaster broadcaster(m_opaque_sp.get(), false);
 
@@ -598,7 +598,7 @@
 size_t
 SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     size_t bytes_read = 0;
 
@@ -645,7 +645,7 @@
 {
     size_t bytes_written = 0;
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
         log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%llx, src=%p, dst_len=%zu, SBError (%p))...",

Modified: lldb/trunk/source/API/SBSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbol.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSymbol.cpp (original)
+++ lldb/trunk/source/API/SBSymbol.cpp Fri Nov  5 20:53:30 2010
@@ -60,7 +60,7 @@
     if (m_opaque_ptr)
         name = m_opaque_ptr->GetMangled().GetName().AsCString();
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBSymbol(%p)::GetName () => \"%s\"", m_opaque_ptr, name ? name : "");
     return name;
@@ -72,7 +72,7 @@
     const char *name = NULL;
     if (m_opaque_ptr)
         name = m_opaque_ptr->GetMangled().GetMangledName().AsCString();
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBSymbol(%p)::GetMangledName () => \"%s\"", m_opaque_ptr, name ? name : "");
 

Modified: lldb/trunk/source/API/SBSymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbolContext.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSymbolContext.cpp (original)
+++ lldb/trunk/source/API/SBSymbolContext.cpp Fri Nov  5 20:53:30 2010
@@ -86,7 +86,7 @@
 SBModule
 SBSymbolContext::GetModule ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBModule sb_module;
     if (m_opaque_ap.get())
@@ -112,7 +112,7 @@
 SBFunction
 SBSymbolContext::GetFunction ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     Function *function = NULL;
     
@@ -137,7 +137,7 @@
 SBLineEntry
 SBSymbolContext::GetLineEntry ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBLineEntry sb_line_entry;
     if (m_opaque_ap.get())
@@ -155,7 +155,7 @@
 SBSymbol
 SBSymbolContext::GetSymbol ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     Symbol *symbol = NULL;
     

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Fri Nov  5 20:53:30 2010
@@ -93,7 +93,7 @@
     if (m_opaque_sp)
         sb_process.SetProcess (m_opaque_sp->GetProcessSP());
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
         log->Printf ("SBTarget(%p)::GetProcess () => SBProcess(%p)", 
@@ -123,7 +123,7 @@
     if (m_opaque_sp)
         sb_process.SetProcess (m_opaque_sp->CreateProcess (m_opaque_sp->GetDebugger().GetListener()));
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
         log->Printf ("SBTarget(%p)::CreateProcess () => SBProcess(%p)", 
@@ -144,7 +144,7 @@
     bool stop_at_entry
 )
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBTarget(%p)::LaunchProcess (argv=%p, envp=%p, tty=\"%s\", launch_flags=%d, stop_at_entry=%i)",
@@ -174,7 +174,7 @@
     SBError &error
 )
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
     {
@@ -333,7 +333,7 @@
             exe_file_spec.SetFileSpec (exe_module_sp->GetFileSpec());
     }
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
         log->Printf ("SBTarget(%p)::GetExecutable () => SBFileSpec(%p)", 
@@ -392,7 +392,7 @@
 SBBreakpoint
 SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, uint32_t line)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBBreakpoint sb_bp;
     if (m_opaque_sp.get() && line != 0)
@@ -418,7 +418,7 @@
 SBBreakpoint
 SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_name)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBBreakpoint sb_bp;
     if (m_opaque_sp.get() && symbol_name && symbol_name[0])
@@ -446,7 +446,7 @@
 SBBreakpoint
 SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBBreakpoint sb_bp;
     if (m_opaque_sp.get() && symbol_name_regex && symbol_name_regex[0])
@@ -479,7 +479,7 @@
 SBBreakpoint
 SBTarget::BreakpointCreateByAddress (addr_t address)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBBreakpoint sb_bp;
     if (m_opaque_sp.get())
@@ -496,7 +496,7 @@
 SBBreakpoint
 SBTarget::FindBreakpointByID (break_id_t bp_id)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBBreakpoint sb_breakpoint;
     if (m_opaque_sp && bp_id != LLDB_INVALID_BREAK_ID)
@@ -531,7 +531,7 @@
 bool
 SBTarget::BreakpointDelete (break_id_t bp_id)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     bool result = false;
     if (m_opaque_sp)
@@ -582,7 +582,7 @@
 uint32_t
 SBTarget::GetNumModules () const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     uint32_t num = 0;
     if (m_opaque_sp)
@@ -597,7 +597,7 @@
 void
 SBTarget::Clear ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBTarget(%p)::Clear ()", m_opaque_sp.get());
@@ -618,7 +618,7 @@
 SBModule
 SBTarget::GetModuleAtIndex (uint32_t idx)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBModule sb_module;
     if (m_opaque_sp)
@@ -637,7 +637,7 @@
 SBBroadcaster
 SBTarget::GetBroadcaster () const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBBroadcaster broadcaster(m_opaque_sp.get(), false);
     

Modified: lldb/trunk/source/API/SBThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBThread.cpp (original)
+++ lldb/trunk/source/API/SBThread.cpp Fri Nov  5 20:53:30 2010
@@ -91,7 +91,7 @@
 StopReason
 SBThread::GetStopReason()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     StopReason reason = eStopReasonInvalid;
     if (m_opaque_sp)
@@ -111,7 +111,7 @@
 size_t
 SBThread::GetStopDescription (char *dst, size_t dst_len)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (m_opaque_sp)
     {
@@ -218,7 +218,7 @@
 lldb::tid_t
 SBThread::GetThreadID () const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     lldb::tid_t id = LLDB_INVALID_THREAD_ID;
     if (m_opaque_sp)
@@ -244,7 +244,7 @@
     if (m_opaque_sp)
         name = m_opaque_sp->GetName();
     
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBThread(%p)::GetName () => %s", m_opaque_sp.get(), name ? name : "NULL");
 
@@ -258,7 +258,7 @@
     if (m_opaque_sp)
         name = m_opaque_sp->GetQueueName();
     
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
         log->Printf ("SBThread(%p)::GetQueueName () => %s", m_opaque_sp.get(), name ? name : "NULL");
 
@@ -269,7 +269,7 @@
 void
 SBThread::StepOver (lldb::RunMode stop_other_threads)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBThread(%p)::StepOver (stop_other_threads='%s')", m_opaque_sp.get(), 
@@ -318,7 +318,7 @@
 void
 SBThread::StepInto (lldb::RunMode stop_other_threads)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBThread(%p)::StepInto (stop_other_threads='%s')", m_opaque_sp.get(),
@@ -365,7 +365,7 @@
 void
 SBThread::StepOut ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBThread(%p)::StepOut ()", m_opaque_sp.get());
@@ -393,7 +393,7 @@
 void
 SBThread::StepInstruction (bool step_over)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBThread(%p)::StepInstruction (step_over=%i)", m_opaque_sp.get(), step_over);
@@ -417,7 +417,7 @@
 void
 SBThread::RunToAddress (lldb::addr_t addr)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (log)
         log->Printf ("SBThread(%p)::RunToAddress (addr=0x%llx)", m_opaque_sp.get(), addr);
@@ -455,7 +455,7 @@
         process.SetProcess(m_opaque_sp->GetProcess().GetTarget().GetProcessSP());
     }
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
     {
         SBStream sstr;
@@ -470,7 +470,7 @@
 uint32_t
 SBThread::GetNumFrames ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     uint32_t num_frames = 0;
     if (m_opaque_sp)
@@ -485,7 +485,7 @@
 SBFrame
 SBThread::GetFrameAtIndex (uint32_t idx)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBFrame sb_frame;
     if (m_opaque_sp)

Modified: lldb/trunk/source/API/SBType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBType.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBType.cpp (original)
+++ lldb/trunk/source/API/SBType.cpp Fri Nov  5 20:53:30 2010
@@ -21,7 +21,7 @@
 bool
 SBType::IsPointerType (void *opaque_type)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     //if (log)
     //    log->Printf ("SBType::IsPointerType (%p)", opaque_type);

Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Fri Nov  5 20:53:30 2010
@@ -89,7 +89,7 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 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 @@
     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 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 @@
     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 @@
         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 @@
     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);
 

Modified: lldb/trunk/source/API/SBValueList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValueList.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValueList.cpp (original)
+++ lldb/trunk/source/API/SBValueList.cpp Fri Nov  5 20:53:30 2010
@@ -27,7 +27,7 @@
 SBValueList::SBValueList (const SBValueList &rhs) :
     m_opaque_ap ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (rhs.IsValid())
         m_opaque_ap.reset (new lldb_private::ValueObjectList (*rhs));
@@ -51,7 +51,7 @@
 SBValueList::SBValueList (const lldb_private::ValueObjectList *lldb_object_ptr) :
     m_opaque_ap ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     if (lldb_object_ptr)
         m_opaque_ap.reset (new lldb_private::ValueObjectList (*lldb_object_ptr));
@@ -144,7 +144,7 @@
 SBValue
 SBValueList::GetValueAtIndex (uint32_t idx) const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     //if (log)
     //    log->Printf ("SBValueList::GetValueAtIndex (uint32_t idx) idx = %d", idx);
@@ -167,7 +167,7 @@
 uint32_t
 SBValueList::GetSize () const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     //if (log)
     //    log->Printf ("SBValueList::GetSize ()");

Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Fri Nov  5 20:53:30 2010
@@ -304,7 +304,7 @@
 
                     if (!break_loc->ResolveBreakpointSite())
                     {
-                        Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+                        LogSP log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
                         if (log)
                             log->Printf ("Warning: could not set breakpoint site for breakpoint location %d of breakpoint %d.\n",
                                          break_loc->GetID(), GetID());

Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Fri Nov  5 20:53:30 2010
@@ -209,7 +209,7 @@
 BreakpointLocation::ShouldStop (StoppointCallbackContext *context)
 {
     bool should_stop = true;
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+    LogSP log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
 
     m_hit_count++;
 
@@ -287,7 +287,7 @@
 
     if (new_id == LLDB_INVALID_BREAK_ID)
     {
-        Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+        LogSP log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
         if (log)
             log->Warning ("Tried to add breakpoint site at 0x%llx but it was already present.\n",
                           m_address.GetLoadAddress(&m_owner.GetTarget()));

Modified: lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp Fri Nov  5 20:53:30 2010
@@ -83,7 +83,7 @@
         {
             StreamString s;
             bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
-            Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+            LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
             if (log)
                 log->Printf ("Added location: %s\n", s.GetData());
         }

Modified: lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp Fri Nov  5 20:53:30 2010
@@ -56,7 +56,7 @@
     CompileUnit *cu = context.comp_unit;
 
     assert (m_breakpoint != NULL);
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
 
     sc_list_size = cu->ResolveSymbolContext (m_file_spec, m_line_number, m_inlines, false, eSymbolContextEverything, sc_list);
     for (uint32_t i = 0; i < sc_list_size; i++)

Modified: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp Fri Nov  5 20:53:30 2010
@@ -81,7 +81,7 @@
     {
         if (!m_regex.Compile (m_func_name.AsCString()))
         {
-            Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+            LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
 
             if (log)
                 log->Warning ("function name regexp: \"%s\" did not compile.", m_func_name.AsCString());
@@ -146,7 +146,7 @@
     Address break_addr;
     assert (m_breakpoint != NULL);
     
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
     
     if (m_class_name)
     {

Modified: lldb/trunk/source/Core/AddressResolverFileLine.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/AddressResolverFileLine.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Core/AddressResolverFileLine.cpp (original)
+++ lldb/trunk/source/Core/AddressResolverFileLine.cpp Fri Nov  5 20:53:30 2010
@@ -50,7 +50,7 @@
     uint32_t sc_list_size;
     CompileUnit *cu = context.comp_unit;
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
 
     sc_list_size = cu->ResolveSymbolContext (m_file_spec, m_line_number, m_inlines, false, eSymbolContextEverything,
                                              sc_list);

Modified: lldb/trunk/source/Core/AddressResolverName.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/AddressResolverName.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Core/AddressResolverName.cpp (original)
+++ lldb/trunk/source/Core/AddressResolverName.cpp Fri Nov  5 20:53:30 2010
@@ -32,7 +32,7 @@
     {
         if (!m_regex.Compile (m_func_name.AsCString()))
         {
-            Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+            LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
 
             if (log)
                 log->Warning ("function name regexp: \"%s\" did not compile.", m_func_name.AsCString());
@@ -93,7 +93,7 @@
     SymbolContext sc;
     Address func_addr;
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
 
     if (m_class_name)
     {

Modified: lldb/trunk/source/Core/Broadcaster.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Broadcaster.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Core/Broadcaster.cpp (original)
+++ lldb/trunk/source/Core/Broadcaster.cpp Fri Nov  5 20:53:30 2010
@@ -28,7 +28,7 @@
     m_hijacking_listener(NULL),
     m_hijacking_mask(UINT32_MAX)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
         log->Printf ("%p Broadcaster::Broadcaster(\"%s\")", this, m_broadcaster_name.AsCString());
 
@@ -36,7 +36,7 @@
 
 Broadcaster::~Broadcaster()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
+    LogSP log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
         log->Printf ("%p Broadcaster::~Broadcaster(\"%s\")", this, m_broadcaster_name.AsCString());
 
@@ -210,7 +210,7 @@
 
     const uint32_t event_type = event_sp->GetType();
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS));
     if (log)
     {
         StreamString event_description;

Modified: lldb/trunk/source/Core/Communication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Core/Communication.cpp (original)
+++ lldb/trunk/source/Core/Communication.cpp Fri Nov  5 20:53:30 2010
@@ -301,7 +301,7 @@
 {
     Communication *comm = (Communication *)p;
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_COMMUNICATION);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_COMMUNICATION));
 
     if (log)
         log->Printf ("%p Communication::ReadThread () thread starting...", p);
@@ -334,7 +334,8 @@
         default:
         case eConnectionStatusError:            // Check GetError() for details
         case eConnectionStatusTimedOut:         // Request timed out
-            error.LogIfError(log, "%p Communication::BytesAvailable () => status = %i", p, status);
+            if (log)
+                error.LogIfError(log.get(), "%p Communication::BytesAvailable () => status = %i", p, status);
             break;
         }
     }

Modified: lldb/trunk/source/Core/ConnectionFileDescriptor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ConnectionFileDescriptor.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Core/ConnectionFileDescriptor.cpp (original)
+++ lldb/trunk/source/Core/ConnectionFileDescriptor.cpp Fri Nov  5 20:53:30 2010
@@ -145,7 +145,7 @@
 size_t
 ConnectionFileDescriptor::Read (void *dst, size_t dst_len, ConnectionStatus &status, Error *error_ptr)
 {
-    Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION);
+    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
     if (log)
         log->Printf ("%p ConnectionFileDescriptor::Read () ::read (fd = %i, dst = %p, dst_len = %zu)...",
                      this, m_fd, dst, dst_len);
@@ -227,7 +227,7 @@
 size_t
 ConnectionFileDescriptor::Write (const void *src, size_t src_len, ConnectionStatus &status, Error *error_ptr)
 {
-    Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION);
+    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
     if (log)
         log->Printf ("%p ConnectionFileDescriptor::Write (src = %p, src_len = %zu)", this, src, src_len);
 
@@ -297,7 +297,7 @@
 ConnectionStatus
 ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_ptr)
 {
-    Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION);
+    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
     if (log)
         log->Printf("%p ConnectionFileDescriptor::BytesAvailable (timeout_usec = %u)", this, timeout_usec);
     struct timeval *tv_ptr;

Modified: lldb/trunk/source/Core/Listener.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Listener.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Core/Listener.cpp (original)
+++ lldb/trunk/source/Core/Listener.cpp Fri Nov  5 20:53:30 2010
@@ -32,14 +32,14 @@
     m_events_mutex (Mutex::eMutexTypeRecursive),
     m_cond_wait()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
         log->Printf ("%p Listener::Listener('%s')", this, m_name.c_str());
 }
 
 Listener::~Listener()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
         log->Printf ("%p Listener::~Listener('%s')", this, m_name.c_str());
     Clear();
@@ -75,7 +75,7 @@
         {
 
         }
-        Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS);
+        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS));
         if (log)
             log->Printf ("%p Listener::StartListeningForEvents (broadcaster = %p, mask = 0x%8.8x) acquired_mask = 0x%8.8x for %s",
                          this,
@@ -104,7 +104,7 @@
 
         uint32_t acquired_mask = broadcaster->AddListener (this, event_mask);
 
-        Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS);
+        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS));
         if (log)
             log->Printf ("%p Listener::StartListeningForEvents (broadcaster = %p, mask = 0x%8.8x, callback = %p, user_data = %p) acquired_mask = 0x%8.8x for %s",
                         this, broadcaster, event_mask, callback, callback_user_data, acquired_mask, m_name.c_str());
@@ -164,7 +164,7 @@
 void
 Listener::AddEvent (EventSP &event_sp)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS));
     if (log)
         log->Printf ("%p Listener('%s')::AddEvent (event_sp = {%p})", this, m_name.c_str(), event_sp.get());
 
@@ -251,7 +251,7 @@
     EventSP &event_sp,
     bool remove)
 {
-    //Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS);
+    //LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS));
 
     Mutex::Locker lock(m_events_mutex);
 
@@ -365,7 +365,7 @@
     EventSP &event_sp
 )
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS));
     bool timed_out = false;
 
     if (log)

Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Fri Nov  5 20:53:30 2010
@@ -36,7 +36,7 @@
 {
     if (object_name)
         m_object_name = *object_name;
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
         log->Printf ("%p Module::Module((%s) '%s/%s%s%s%s')",
                      this,
@@ -50,7 +50,7 @@
 
 Module::~Module()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
         log->Printf ("%p Module::~Module((%s) '%s/%s%s%s%s')",
                      this,

Modified: lldb/trunk/source/Expression/ASTResultSynthesizer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ASTResultSynthesizer.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ASTResultSynthesizer.cpp (original)
+++ lldb/trunk/source/Expression/ASTResultSynthesizer.cpp Fri Nov  5 20:53:30 2010
@@ -99,7 +99,7 @@
 {
     ASTContext &Ctx(*m_ast_context);
     
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     if (!m_sema)
         return false;

Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Fri Nov  5 20:53:30 2010
@@ -151,7 +151,7 @@
     off_t alignment
 )
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     m_struct_laid_out = false;
     
@@ -510,7 +510,7 @@
     Error &err
 )
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     if (!m_struct_laid_out)
     {
@@ -675,7 +675,7 @@
     Error &err
 )
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     if (!exe_ctx.frame || !exe_ctx.process)
         return false;
@@ -923,7 +923,7 @@
     TypeFromUser *type
 )
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     VariableList *var_list = frame.GetVariableList(true);
     
@@ -961,7 +961,7 @@
     const ConstString &name
 )
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
         
     if (log)
         log->Printf("Hunting for a definition for '%s'", name.GetCString());
@@ -1109,7 +1109,7 @@
     TypeFromParser *parser_type
 )
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     Type *var_type = var->GetType();
     
@@ -1216,7 +1216,7 @@
 ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context,
                                        Variable* var)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     TypeFromUser ut;
     TypeFromParser pt;
@@ -1255,7 +1255,7 @@
 ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context,
                                        ClangExpressionVariable *pvar)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     TypeFromUser user_type = pvar->m_user_type;
     
@@ -1288,7 +1288,7 @@
                                        Function* fun,
                                        Symbol* symbol)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     NamedDecl *fun_decl;
     std::auto_ptr<Value> fun_location(new Value);

Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Fri Nov  5 20:53:30 2010
@@ -408,7 +408,7 @@
                                 lldb::addr_t &func_end, 
                                 ExecutionContext &exe_ctx)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
     Error err;
     
@@ -578,7 +578,7 @@
 Error
 ClangExpressionParser::DisassembleFunction (Stream &stream, ExecutionContext &exe_ctx)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     const char *name = m_expr.FunctionName();
     
@@ -664,10 +664,10 @@
                             exe_ctx.process->GetByteOrder(),
                             exe_ctx.target->GetArchitecture().GetAddressByteSize());
     
-    if(log)
+    if (log)
     {
         log->Printf("Function data has contents:");
-        extractor.PutToLog (log,
+        extractor.PutToLog (log.get(),
                             0,
                             extractor.GetByteSize(),
                             func_remote_addr,

Modified: lldb/trunk/source/Expression/ClangFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangFunction.cpp (original)
+++ lldb/trunk/source/Expression/ClangFunction.cpp Fri Nov  5 20:53:30 2010
@@ -207,7 +207,7 @@
     m_wrapper_function_text.append (args_list_buffer);
     m_wrapper_function_text.append (");\n}\n");
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     if (log)
         log->Printf ("Expression: \n\n%s\n\n", m_wrapper_function_text.c_str());
         
@@ -357,7 +357,7 @@
     if (!WriteFunctionArguments(exe_ctx, args_addr_ref, errors))
         return false;
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     if (log)
         log->Printf ("Call Address: 0x%llx Struct Address: 0x%llx.\n", m_wrapper_function_addr, args_addr_ref);
         
@@ -542,7 +542,7 @@
         return eExecutionSetupError;
     }
     
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     
     while (1)
     {

Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Fri Nov  5 20:53:30 2010
@@ -117,7 +117,7 @@
 bool
 ClangUserExpression::Parse (Stream &error_stream, ExecutionContext &exe_ctx)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     ScanContext(exe_ctx);
     
@@ -271,7 +271,7 @@
                                                     lldb::addr_t &struct_address,
                                                     lldb::addr_t &object_ptr)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
     if (m_jit_addr != LLDB_INVALID_ADDRESS)
     {

Modified: lldb/trunk/source/Expression/DWARFExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/DWARFExpression.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Expression/DWARFExpression.cpp (original)
+++ lldb/trunk/source/Expression/DWARFExpression.cpp Fri Nov  5 20:53:30 2010
@@ -864,7 +864,7 @@
             error_ptr->SetErrorString ("Invalid offset and/or length for opcodes buffer.");
         return false;
     }
-    Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
 
     while (opcodes.ValidOffset(offset) && offset < end_offset)

Modified: lldb/trunk/source/Expression/IRDynamicChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRDynamicChecks.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRDynamicChecks.cpp (original)
+++ lldb/trunk/source/Expression/IRDynamicChecks.cpp Fri Nov  5 20:53:30 2010
@@ -296,7 +296,7 @@
 private:
     bool InstrumentInstruction(llvm::Instruction *inst)
     {
-        lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+        lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
         if(log)
             log->Printf("Instrumenting load/store instruction: %s\n", 
@@ -396,7 +396,7 @@
     
     bool InspectInstruction(llvm::Instruction &i)
     {
-        lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+        lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
         CallInst *call_inst = dyn_cast<CallInst>(&i);
         
@@ -460,7 +460,7 @@
 bool
 IRDynamicChecks::runOnModule(llvm::Module &M)
 {
-    lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     llvm::Function* function = M.getFunction(StringRef(m_func_name.c_str()));
     

Modified: lldb/trunk/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRForTarget.cpp (original)
+++ lldb/trunk/source/Expression/IRForTarget.cpp Fri Nov  5 20:53:30 2010
@@ -76,7 +76,7 @@
 bool 
 IRForTarget::createResultVariable (llvm::Module &llvm_module, llvm::Function &llvm_function)
 {
-    lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     if (!m_resolve_vars)
         return true;
@@ -270,7 +270,7 @@
 IRForTarget::RewriteObjCSelector(Instruction* selector_load,
                                  Module &M)
 {
-    lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
     LoadInst *load = dyn_cast<LoadInst>(selector_load);
     
@@ -382,7 +382,7 @@
 IRForTarget::rewriteObjCSelectors(Module &M, 
                                   BasicBlock &BB)
 {
-    lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
     BasicBlock::iterator ii;
     
@@ -481,7 +481,7 @@
     if (!m_resolve_vars)
         return true;
     
-    lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     BasicBlock::iterator ii;
     
@@ -567,7 +567,7 @@
     bool Store
 )
 {
-    lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
     if (ConstantExpr *constant_expr = dyn_cast<ConstantExpr>(llvm_value_ptr))
     {
@@ -641,7 +641,7 @@
 IRForTarget::MaybeHandleCallArguments(Module &M,
                                       CallInst *C)
 {
-    // lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    // lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     for (unsigned op_index = 0, num_ops = C->getNumArgOperands();
          op_index < num_ops;
@@ -656,7 +656,7 @@
 IRForTarget::MaybeHandleCall(Module &llvm_module,
                              CallInst *llvm_call_inst)
 {
-    lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
     Function *fun = llvm_call_inst->getCalledFunction();
     
@@ -924,7 +924,7 @@
 static bool
 UnfoldConstant(Constant *C, Value *new_value, Instruction *first_entry_instruction)
 {
-    lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
     Value::use_iterator ui;
     
@@ -1028,7 +1028,7 @@
     if (!m_resolve_vars)
         return true;
     
-    lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
     m_decl_map->DoStructLayout();
     
@@ -1118,7 +1118,7 @@
 bool
 IRForTarget::runOnModule(Module &M)
 {
-    lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     Function* function = M.getFunction(StringRef(m_func_name.c_str()));
     

Modified: lldb/trunk/source/Expression/IRToDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRToDWARF.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRToDWARF.cpp (original)
+++ lldb/trunk/source/Expression/IRToDWARF.cpp Fri Nov  5 20:53:30 2010
@@ -171,7 +171,7 @@
 bool
 IRToDWARF::runOnModule(Module &M)
 {
-    lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     llvm::Function* function = M.getFunction(StringRef(m_func_name.c_str()));
     

Modified: lldb/trunk/source/Expression/RecordingMemoryManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/RecordingMemoryManager.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Expression/RecordingMemoryManager.cpp (original)
+++ lldb/trunk/source/Expression/RecordingMemoryManager.cpp Fri Nov  5 20:53:30 2010
@@ -17,9 +17,9 @@
 
 RecordingMemoryManager::RecordingMemoryManager () :
     llvm::JITMemoryManager(),
-    m_default_mm_ap (llvm::JITMemoryManager::CreateDefaultMemManager())
+    m_default_mm_ap (llvm::JITMemoryManager::CreateDefaultMemManager()),
+    m_log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS))
 {
-    m_log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
 }
 
 RecordingMemoryManager::~RecordingMemoryManager ()

Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Fri Nov  5 20:53:30 2010
@@ -104,7 +104,7 @@
 static void *
 MonitorChildProcessThreadFunction (void *arg)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
     const char *function = __FUNCTION__;
     if (log)
         log->Printf ("%s (arg = %p) thread starting...", function, arg);
@@ -426,7 +426,7 @@
     thread_func_t thread_fptr = info->thread_fptr;
     thread_arg_t thread_arg = info->thread_arg;
     
-    Log * log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD));
     if (log)
         log->Printf("thread created");
     

Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Fri Nov  5 20:53:30 2010
@@ -538,7 +538,7 @@
         uint32_t  reserved2;  // must be zero
     } BabelAESelInfo;
     
-    Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST);
+    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST));
     char file_path[PATH_MAX];
     file_spec.GetPath(file_path, PATH_MAX);
     CFCString file_cfstr (file_path, kCFStringEncodingUTF8);

Modified: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Fri Nov  5 20:53:30 2010
@@ -61,7 +61,7 @@
                                     lldb::addr_t arg,
                                     lldb::addr_t *this_arg) const
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     if (log)
         log->Printf("ABISysV_x86_64::PrepareTrivialCall\n(\n  thread = %p\n  sp = 0x%llx\n  functionAddress = 0x%llx\n  returnAddress = 0x%llx\n  arg = 0x%llx\n  this_arg = %p(0x%llx)\n)",

Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Fri Nov  5 20:53:30 2010
@@ -500,7 +500,7 @@
 uint32_t
 DynamicLoaderMacOSXDYLD::UpdateAllImageInfos()
 {
-    Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER);
+    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER));
     if (ReadAllImageInfosStructure ())
     {
         Mutex::Locker locker(m_mutex);
@@ -587,7 +587,7 @@
                 if (old_dyld_all_image_infos[old_idx].address != LLDB_INVALID_ADDRESS)
                 {
                     if (log)
-                        old_dyld_all_image_infos[old_idx].PutToLog (log);
+                        old_dyld_all_image_infos[old_idx].PutToLog (log.get());
                     ModuleSP unload_image_module_sp(m_process->GetTarget().GetImages().FindFirstModuleForFileSpec (old_dyld_all_image_infos[old_idx].file_spec));
                     if (unload_image_module_sp.get())
                     {
@@ -603,7 +603,7 @@
         else
         {
             if (log)
-                PutToLog(log);
+                PutToLog(log.get());
         }
     }
     else
@@ -1094,7 +1094,7 @@
     StackFrame *current_frame = thread.GetStackFrameAtIndex(0).get();
     const SymbolContext &current_context = current_frame->GetSymbolContext(eSymbolContextSymbol);
     Symbol *current_symbol = current_context.symbol;
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
     if (current_symbol != NULL)
     {

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp Fri Nov  5 20:53:30 2010
@@ -340,7 +340,7 @@
     if (!m_process_sp)
         return false;
         
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     
     // We aren't starting at the trampoline symbol.
     InitializeVTableSymbols ();
@@ -494,7 +494,7 @@
     
     if (found_it)
     {
-        Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
         
         lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0);

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp Fri Nov  5 20:53:30 2010
@@ -114,7 +114,7 @@
             m_impl_function->DeallocateFunctionResults(exc_context, m_args_addr);
             lldb::addr_t target_addr = target_addr_value.GetScalar().ULongLong();
             Address target_address(NULL, target_addr);
-            Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+            LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
             if (target_addr == 0)
             {
                 if (log)

Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp Fri Nov  5 20:53:30 2010
@@ -18,6 +18,7 @@
 #include "MachException.h"
 #include "ProcessMacOSXLog.h"
 
+using namespace lldb;
 using namespace lldb_private;
 
 // Routine mach_exception_raise
@@ -91,7 +92,7 @@
     mach_msg_type_number_t *    new_stateCnt
 )
 {
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS));
     if (log)
     {
         log->Printf("::%s ( exc_port = 0x%4.4x, exc_type = %d ( %s ), exc_data = " MACH_EXCEPTION_DATA_FMT_HEX ", exc_data_count = %d)",
@@ -122,7 +123,7 @@
 )
 {
     kern_return_t kret;
-    Log * log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS));
     if (log)
     {
         log->Printf("::%s ( exc_port = 0x%4.4x, thd_port = 0x%4.4x, tsk_port = 0x%4.4x, exc_type = %d ( %s ), exc_data[%d] = { " MACH_EXCEPTION_DATA_FMT_HEX ",  " MACH_EXCEPTION_DATA_FMT_HEX " })",
@@ -152,7 +153,7 @@
     mach_exception_data_t   exc_data,
     mach_msg_type_number_t  exc_data_count)
 {
-    Log * log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS));
     if (log)
     {
         log->Printf("::%s ( exc_port = 0x%4.4x, thd_port = 0x%4.4x, tsk_port = 0x%4.4x, exc_type = %d ( %s ), exc_data[%d] = { " MACH_EXCEPTION_DATA_FMT_HEX ",  " MACH_EXCEPTION_DATA_FMT_HEX " })",
@@ -215,7 +216,7 @@
 void
 MachException::Data::DumpStopReason() const
 {
-    Log * log = ProcessMacOSXLog::GetLogIfAllCategoriesSet();
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet());
     if (log)
     {
         int signal = SoftSignal();
@@ -236,7 +237,7 @@
 MachException::Message::Receive(mach_port_t port, mach_msg_option_t options, mach_msg_timeout_t timeout, mach_port_t notify_port)
 {
     Error err;
-    Log * log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS));
     mach_msg_timeout_t mach_msg_timeout = options & MACH_RCV_TIMEOUT ? timeout : 0;
     if (log && ((options & MACH_RCV_TIMEOUT) == 0))
     {
@@ -313,7 +314,7 @@
     }
     else
     {
-        Log * log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS);
+        LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS));
         if (log)
             log->Printf ("mach_exc_server returned zero...");
     }
@@ -329,7 +330,7 @@
     // Reply to the exception...
     Error err;
 
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet();
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet());
     if (log)
         log->Printf("MachException::Message::Reply (task = 0x%4.4x, pid = %i, signal = %i)", task, pid, signal);
 
@@ -369,7 +370,7 @@
             err.Clear();
 
         if (log && log->GetMask().Test(PD_LOG_EXCEPTIONS) || err.Fail())
-            err.PutToLog(log, "::ptrace (request = PT_THUPDATE, pid = %i, tid = 0x%4.4x, signal = %i)", state_pid, state.thread_port, signal);
+            err.PutToLog(log.get(), "::ptrace (request = PT_THUPDATE, pid = %i, tid = 0x%4.4x, signal = %i)", state_pid, state.thread_port, signal);
     }
 
     err = ::mach_msg (  &reply_msg.hdr,
@@ -401,18 +402,18 @@
     {
         if (err.GetError() == MACH_SEND_INTERRUPTED)
         {
-            err.PutToLog(log, "::mach_msg() - send interrupted");
+            err.PutToLog(log.get(), "::mach_msg() - send interrupted");
         }
         else
         {
             if (state.task_port == task)
             {
-                err.PutToLog(log, "::mach_msg() - failed (task)");
+                err.PutToLog(log.get(), "::mach_msg() - failed (task)");
                 abort ();
             }
             else
             {
-                err.PutToLog(log, "::mach_msg() - failed (child of task)");
+                err.PutToLog(log.get(), "::mach_msg() - failed (child of task)");
             }
         }
     }
@@ -465,7 +466,7 @@
 MachException::PortInfo::Save (task_t task)
 {
     count = EXC_TYPES_COUNT;
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS));
     if (log)
         log->Printf ("MachException::PortInfo::Save (task = 0x%4.4x)", task);
     Error err;
@@ -473,7 +474,7 @@
         log->Printf("::task_get_exception_ports (task=0x%4.4x, mask=0x%x, maskCnt<=>%u, ports, behaviors, flavors)...", task, EXC_MASK_ALL, count);
     err = ::task_get_exception_ports (task, EXC_MASK_ALL, masks, &count, ports, behaviors, flavors);
     if (log || err.Fail())
-        err.PutToLog(log, "::task_get_exception_ports (task=0x%4.4x, mask=0x%x, maskCnt<=>%u, ports, behaviors, flavors)", task, EXC_MASK_ALL, count);
+        err.PutToLog(log.get(), "::task_get_exception_ports (task=0x%4.4x, mask=0x%x, maskCnt<=>%u, ports, behaviors, flavors)", task, EXC_MASK_ALL, count);
     if (log)
     {
         mach_msg_type_number_t i;
@@ -490,7 +491,7 @@
 kern_return_t
 MachException::PortInfo::Restore (task_t task)
 {
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS));
     if (log && log->GetMask().Test(PD_LOG_VERBOSE))
         log->Printf("MachException::PortInfo::Restore (task = 0x%4.4x)", task);
     uint32_t i = 0;
@@ -501,7 +502,7 @@
         {
             err = ::task_set_exception_ports (task, masks[i], ports[i], behaviors[i], flavors[i]);
             if (log || err.Fail())
-                err.PutToLog(log, "::task_set_exception_ports ( task = 0x%4.4x, exception_mask = 0x%8.8x, new_port = 0x%4.4x, behavior = 0x%8.8x, new_flavor = 0x%8.8x )", task, masks[i], ports[i], behaviors[i], flavors[i]);
+                err.PutToLog(log.get(), "::task_set_exception_ports ( task = 0x%4.4x, exception_mask = 0x%8.8x, new_port = 0x%4.4x, behavior = 0x%8.8x, new_flavor = 0x%8.8x )", task, masks[i], ports[i], behaviors[i], flavors[i]);
 
             if (err.Fail())
                 break;

Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp Fri Nov  5 20:53:30 2010
@@ -65,9 +65,9 @@
     Error err;
     task_t task = GetTaskPort();
     err = ::task_suspend (task);
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK));
     if (log || err.Fail())
-        err.PutToLog(log, "::task_suspend ( target_task = 0x%4.4x )", task);
+        err.PutToLog(log.get(), "::task_suspend ( target_task = 0x%4.4x )", task);
     return err.GetError();
 }
 
@@ -81,9 +81,9 @@
     Error err;
     task_t task = GetTaskPort();
     err = ::task_resume (task);
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK));
     if (log || err.Fail())
-        err.PutToLog(log, "::task_resume ( target_task = 0x%4.4x )", task);
+        err.PutToLog(log.get(), "::task_resume ( target_task = 0x%4.4x )", task);
     return err.GetError();
 }
 
@@ -159,14 +159,14 @@
     if (task != TASK_NULL)
     {
         n = m_vm_memory.Read(task, addr, buf, size, error);
-        Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY);
+        LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY));
         if (log)
         {
             log->Printf ("MachTask::ReadMemory ( addr = 0x%16.16llx, size = %zu, buf = %8.8p) => %u bytes read", (uint64_t)addr, size, buf, n);
             if (log->GetMask().Test(PD_LOG_MEMORY_DATA_LONG) || (log->GetMask().Test(PD_LOG_MEMORY_DATA_SHORT) && size <= 8))
             {
                 DataExtractor data((uint8_t*)buf, n, eByteOrderHost, 4);
-                data.PutToLog(log, 0, n, addr, 16, DataExtractor::TypeUInt8);
+                data.PutToLog(log.get(), 0, n, addr, 16, DataExtractor::TypeUInt8);
             }
         }
     }
@@ -185,14 +185,14 @@
     if (task != TASK_NULL)
     {
         n = m_vm_memory.Write(task, addr, buf, size, error);
-        Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY);
+        LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY));
         if (log)
         {
             log->Printf ("MachTask::WriteMemory ( addr = 0x%16.16llx, size = %zu, buf = %8.8p) => %u bytes written", (uint64_t)addr, size, buf, n);
             if (log->GetMask().Test(PD_LOG_MEMORY_DATA_LONG) || (log->GetMask().Test(PD_LOG_MEMORY_DATA_SHORT) && size <= 8))
             {
                 DataExtractor data((uint8_t*)buf, n, eByteOrderHost, 4);
-                data.PutToLog(log, 0, n, addr, 16, DataExtractor::TypeUInt8);
+                data.PutToLog(log.get(), 0, n, addr, 16, DataExtractor::TypeUInt8);
             }
         }
     }
@@ -212,7 +212,7 @@
 
     kern_return_t kret;
     mach_vm_address_t addr;
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY));
 
     kret = ::mach_vm_allocate (GetTaskPort(), &addr, size, TRUE);
     if (kret == KERN_SUCCESS)
@@ -295,10 +295,10 @@
     {
         mach_port_t task_self = mach_task_self ();
         err = ::task_for_pid ( task_self, pid, &task);
-        Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK);
+        LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK));
         if (log || err.Fail())
         {
-            err.PutToLog(log, "::task_for_pid ( target_tport = 0x%4.4x, pid = %d, task => 0x%4.4x ) %u/%u %u/%u", task_self, pid, task, getuid(), geteuid(), getgid(), getegid());
+            err.PutToLog(log.get(), "::task_for_pid ( target_tport = 0x%4.4x, pid = %d, task => 0x%4.4x ) %u/%u %u/%u", task_self, pid, task, getuid(), geteuid(), getgid(), getegid());
         }
     }
     return task;
@@ -326,9 +326,9 @@
     Error err;
     mach_msg_type_number_t count = TASK_BASIC_INFO_COUNT;
     err = ::task_info (task, TASK_BASIC_INFO, (task_info_t)info, &count);
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK));
     if (log || err.Fail())
-        err.PutToLog(log, "::task_info ( target_task = 0x%4.4x, flavor = TASK_BASIC_INFO, task_info_out => %p, task_info_outCnt => %u )", task, info, count);
+        err.PutToLog(log.get(), "::task_info ( target_task = 0x%4.4x, flavor = TASK_BASIC_INFO, task_info_out => %p, task_info_outCnt => %u )", task, info, count);
     if (log && log->GetMask().Test(PD_LOG_VERBOSE) && err.Success())
     {
         float user = (float)info->user_time.seconds + (float)info->user_time.microseconds / 1000000.0f;
@@ -371,7 +371,7 @@
 bool
 MachTask::StartExceptionThread(Error &err)
 {
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS));
 
     if (log)
         log->Printf ("MachTask::%s ( )", __FUNCTION__);
@@ -384,7 +384,7 @@
         // Allocate an exception port that we will use to track our child process
         err = ::mach_port_allocate (task_self, MACH_PORT_RIGHT_RECEIVE, &m_exception_port);
         if (log || err.Fail())
-            err.PutToLog(log, "::mach_port_allocate (task_self=0x%4.4x, MACH_PORT_RIGHT_RECEIVE, &m_exception_port => 0x%4.4x)",
+            err.PutToLog(log.get(), "::mach_port_allocate (task_self=0x%4.4x, MACH_PORT_RIGHT_RECEIVE, &m_exception_port => 0x%4.4x)",
                          task_self, m_exception_port);
         if (err.Fail())
             return false;
@@ -392,7 +392,7 @@
         // Add the ability to send messages on the new exception port
         err = ::mach_port_insert_right (task_self, m_exception_port, m_exception_port, MACH_MSG_TYPE_MAKE_SEND);
         if (log || err.Fail())
-            err.PutToLog(log, "::mach_port_insert_right (task_self=0x%4.4x, m_exception_port=0x%4.4x, m_exception_port=0x%4.4x, MACH_MSG_TYPE_MAKE_SEND)",
+            err.PutToLog(log.get(), "::mach_port_insert_right (task_self=0x%4.4x, m_exception_port=0x%4.4x, m_exception_port=0x%4.4x, MACH_MSG_TYPE_MAKE_SEND)",
                          task_self, m_exception_port, m_exception_port);
         if (err.Fail())
             return false;
@@ -403,7 +403,7 @@
         // Set the ability to get all exceptions on this port
         err = ::task_set_exception_ports (task, EXC_MASK_ALL, m_exception_port, EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES, THREAD_STATE_NONE);
         if (log || err.Fail())
-            err.PutToLog(log, "::task_set_exception_ports (task, EXC_MASK_ALL, m_exception_port, EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES, THREAD_STATE_NONE)");
+            err.PutToLog(log.get(), "::task_set_exception_ports (task, EXC_MASK_ALL, m_exception_port, EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES, THREAD_STATE_NONE)");
         if (err.Fail())
             return false;
 
@@ -427,7 +427,7 @@
 
     err = RestoreExceptionPortInfo();
 
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS));
 
     // NULL our our exception port and let our exception thread exit
     mach_port_t exception_port = m_exception_port;
@@ -435,17 +435,17 @@
 
     Host::ThreadCancel (m_exception_thread, &err);
     if (log || err.Fail())
-        err.PutToLog(log, "Host::ThreadCancel ( thread = %p )", m_exception_thread);
+        err.PutToLog(log.get(), "Host::ThreadCancel ( thread = %p )", m_exception_thread);
 
     Host::ThreadJoin (m_exception_thread, NULL, &err);
     if (log || err.Fail())
-        err.PutToLog(log, "Host::ThreadJoin ( thread = %p, result_ptr = NULL)", m_exception_thread);
+        err.PutToLog(log.get(), "Host::ThreadJoin ( thread = %p, result_ptr = NULL)", m_exception_thread);
 
     // Deallocate our exception port that we used to track our child process
     mach_port_t task_self = mach_task_self ();
     err = ::mach_port_deallocate (task_self, exception_port);
     if (log || err.Fail())
-        err.PutToLog(log, "::mach_port_deallocate ( task = 0x%4.4x, name = 0x%4.4x )", task_self, exception_port);
+        err.PutToLog(log.get(), "::mach_port_deallocate ( task = 0x%4.4x, name = 0x%4.4x )", task_self, exception_port);
     exception_port = NULL;
 
     Clear();
@@ -461,7 +461,7 @@
 
     MachTask *mach_task = (MachTask*) arg;
     ProcessMacOSX *mach_proc = mach_task->Process();
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS));
     if (log)
         log->Printf ("MachTask::%s (arg = %p) thread starting...", __FUNCTION__, arg);
 

Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_arm.cpp Fri Nov  5 20:53:30 2010
@@ -335,7 +335,7 @@
 MachThreadContext_arm::EnableHardwareSingleStep (bool enable)
 {
     Error err;
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_STEP);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_STEP));
 
     if (log) log->Printf("%s( enable = %d )", __FUNCTION__, enable);
 

Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMMemory.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMMemory.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMMemory.cpp Fri Nov  5 20:53:30 2010
@@ -14,6 +14,7 @@
 #include "MachVMRegion.h"
 #include "ProcessMacOSXLog.h"
 
+using namespace lldb;
 using namespace lldb_private;
 
 MachVMMemory::MachVMMemory() :
@@ -73,17 +74,17 @@
         mach_msg_type_number_t curr_bytes_read = 0;
         vm_offset_t vm_memory = NULL;
         error = ::mach_vm_read (task, curr_addr, curr_size, &vm_memory, &curr_bytes_read);
-        Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY|PD_LOG_VERBOSE);
+        LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY|PD_LOG_VERBOSE));
 
         if (log || error.Fail())
-            error.PutToLog (log, "::mach_vm_read (task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, data => %8.8p, dataCnt => %i)", task, (uint64_t)curr_addr, (uint64_t)curr_size, vm_memory, curr_bytes_read);
+            error.PutToLog (log.get(), "::mach_vm_read (task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, data => %8.8p, dataCnt => %i)", task, (uint64_t)curr_addr, (uint64_t)curr_size, vm_memory, curr_bytes_read);
 
         if (error.Success())
         {
             if (curr_bytes_read != curr_size)
             {
                 if (log)
-                    error.PutToLog (log, "::mach_vm_read (task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, data => %8.8p, dataCnt=>%i) only read %u of %llu bytes", task, (uint64_t)curr_addr, (uint64_t)curr_size, vm_memory, curr_bytes_read, curr_bytes_read, (uint64_t)curr_size);
+                    error.PutToLog (log.get(), "::mach_vm_read (task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, data => %8.8p, dataCnt=>%i) only read %u of %llu bytes", task, (uint64_t)curr_addr, (uint64_t)curr_size, vm_memory, curr_bytes_read, curr_bytes_read, (uint64_t)curr_size);
             }
             ::memcpy (curr_data, (void *)vm_memory, curr_bytes_read);
             ::vm_deallocate (mach_task_self (), vm_memory, curr_bytes_read);
@@ -168,16 +169,16 @@
     {
         mach_msg_type_number_t curr_data_count = MaxBytesLeftInPage(curr_addr, data_count - total_bytes_written);
         error = ::mach_vm_write (task, curr_addr, (pointer_t) curr_data, curr_data_count);
-        Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY);
+        LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY));
         if (log || error.Fail())
-            error.PutToLog (log, "::mach_vm_write ( task = 0x%4.4x, addr = 0x%8.8llx, data = %8.8p, dataCnt = %u )", task, (uint64_t)curr_addr, curr_data, curr_data_count);
+            error.PutToLog (log.get(), "::mach_vm_write ( task = 0x%4.4x, addr = 0x%8.8llx, data = %8.8p, dataCnt = %u )", task, (uint64_t)curr_addr, curr_data, curr_data_count);
 
 #if defined (__powerpc__) || defined (__ppc__)
         vm_machine_attribute_val_t mattr_value = MATTR_VAL_CACHE_FLUSH;
 
         error = ::vm_machine_attribute (task, curr_addr, curr_data_count, MATTR_CACHE, &mattr_value);
         if (log || error.Fail())
-            error.Log(log, "::vm_machine_attribute ( task = 0x%4.4x, addr = 0x%8.8llx, size = %u, attr = MATTR_CACHE, mattr_value => MATTR_VAL_CACHE_FLUSH )", task, (uint64_t)curr_addr, curr_data_count);
+            error.Log(log.get(), "::vm_machine_attribute ( task = 0x%4.4x, addr = 0x%8.8llx, size = %u, attr = MATTR_CACHE, mattr_value => MATTR_VAL_CACHE_FLUSH )", task, (uint64_t)curr_addr, curr_data_count);
 #endif
 
         if (error.Success())

Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMRegion.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMRegion.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMRegion.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMRegion.cpp Fri Nov  5 20:53:30 2010
@@ -12,6 +12,7 @@
 #include "MachVMRegion.h"
 #include "ProcessMacOSXLog.h"
 
+using namespace lldb;
 using namespace lldb_private;
 
 MachVMRegion::MachVMRegion(task_t task) :
@@ -61,7 +62,7 @@
             prot_size = end_addr - addr;
 
 
-        Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY_PROTECTIONS);
+        LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY_PROTECTIONS));
         if (prot_size > 0)
         {
             if (prot == (m_curr_protection & VM_PROT_ALL))
@@ -75,13 +76,13 @@
             {
                 m_err = ::mach_vm_protect (m_task, addr, prot_size, 0, prot);
                 if (log || m_err.Fail())
-                    m_err.PutToLog(log, "::mach_vm_protect ( task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, set_max = %i, prot = %u )", m_task, (uint64_t)addr, (uint64_t)prot_size, 0, prot);
+                    m_err.PutToLog(log.get(), "::mach_vm_protect ( task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, set_max = %i, prot = %u )", m_task, (uint64_t)addr, (uint64_t)prot_size, 0, prot);
                 if (m_err.Fail())
                 {
                     // Try again with the ability to create a copy on write region
                     m_err = ::mach_vm_protect (m_task, addr, prot_size, 0, prot | VM_PROT_COPY);
                     if (log || m_err.Fail())
-                        m_err.PutToLog(log, "::mach_vm_protect ( task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, set_max = %i, prot = %u )", m_task, (uint64_t)addr, (uint64_t)prot_size, 0, prot | VM_PROT_COPY);
+                        m_err.PutToLog(log.get(), "::mach_vm_protect ( task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, set_max = %i, prot = %u )", m_task, (uint64_t)addr, (uint64_t)prot_size, 0, prot | VM_PROT_COPY);
                 }
                 if (m_err.Success())
                 {
@@ -106,9 +107,9 @@
     if (m_curr_protection != m_data.protection && m_protection_size > 0)
     {
         m_err = ::mach_vm_protect (m_task, m_protection_addr, m_protection_size, 0, m_data.protection);
-        Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY_PROTECTIONS);
+        LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY_PROTECTIONS));
         if (log || m_err.Fail())
-            m_err.PutToLog(log, "::mach_vm_protect ( task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, set_max = %i, prot = %u )", m_task, (uint64_t)m_protection_addr, (uint64_t)m_protection_size, 0, m_data.protection);
+            m_err.PutToLog(log.get(), "::mach_vm_protect ( task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, set_max = %i, prot = %u )", m_task, (uint64_t)m_protection_addr, (uint64_t)m_protection_size, 0, m_data.protection);
         if (m_err.Success())
         {
             m_protection_size = 0;
@@ -137,9 +138,9 @@
     mach_msg_type_number_t info_size = kRegionInfoSize;
     assert(sizeof(info_size) == 4);
     m_err = ::mach_vm_region_recurse (m_task, &m_start, &m_size, &m_depth, (vm_region_recurse_info_t)&m_data, &info_size);
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY_PROTECTIONS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY_PROTECTIONS));
     if (log || m_err.Fail())
-        m_err.PutToLog(log, "::mach_vm_region_recurse ( task = 0x%4.4x, address => 0x%8.8llx, size => %llu, nesting_depth => %d, info => %p, infoCnt => %d) addr = 0x%8.8llx ", m_task, (uint64_t)m_start, (uint64_t)m_size, m_depth, &m_data, info_size, (uint64_t)addr);
+        m_err.PutToLog(log.get(), "::mach_vm_region_recurse ( task = 0x%4.4x, address => 0x%8.8llx, size => %llu, nesting_depth => %d, info => %p, infoCnt => %d) addr = 0x%8.8llx ", m_task, (uint64_t)m_start, (uint64_t)m_size, m_depth, &m_data, info_size, (uint64_t)addr);
     if (m_err.Fail())
     {
         return false;

Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp Fri Nov  5 20:53:30 2010
@@ -108,7 +108,7 @@
 //{
 //    const lldb::pid_t pid = *((lldb::user_id_t *)pid_ptr);
 //
-//    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD);
+//    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD));
 //
 //    if (log)
 //        log->Printf ("ProcessMacOSX::%s (arg = %p) thread starting...", __FUNCTION__, pid_ptr);
@@ -357,7 +357,7 @@
     // figure out a good way to determine the arch of what we are attaching to
     m_arch_spec = m_target.GetArchitecture();
 
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS));
     if (attach_pid != LLDB_INVALID_PROCESS_ID)
     {
         SetID(attach_pid);
@@ -583,7 +583,7 @@
 ProcessMacOSX::UpdateThreadListIfNeeded ()
 {
     // locker will keep a mutex locked until it goes out of scope
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD));
     if (log && log->GetMask().Test(PD_LOG_VERBOSE))
         log->Printf ("ProcessMacOSX::%s (pid = %4.4x)", __FUNCTION__, GetID());
 
@@ -597,7 +597,7 @@
         Error err(::task_threads (task, &thread_list, &thread_list_count), eErrorTypeMachKernel);
 
         if (log || err.Fail())
-            err.PutToLog(log, "::task_threads ( task = 0x%4.4x, thread_list => %p, thread_list_count => %u )", task, thread_list, thread_list_count);
+            err.PutToLog(log.get(), "::task_threads ( task = 0x%4.4x, thread_list => %p, thread_list_count => %u )", task, thread_list, thread_list_count);
 
         if (err.GetError() == KERN_SUCCESS && thread_list_count > 0)
         {
@@ -651,7 +651,7 @@
     m_thread_list.RefreshStateAfterStop();
 
    // Let each thread know of any exceptions
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS));
     task_t task = Task().GetTaskPort();
     size_t i;
     for (i=0; i<m_exception_messages.size(); ++i)
@@ -668,7 +668,7 @@
             }
         }
         if (log)
-            m_exception_messages[i].PutToLog(log);
+            m_exception_messages[i].PutToLog(log.get());
     }
 
 }
@@ -697,7 +697,7 @@
 ProcessMacOSX::DoSIGSTOP (bool clear_all_breakpoints)
 {
     Error error;
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS));
 
     if (log)
         log->Printf ("ProcessMacOSX::DoSIGSTOP()");
@@ -730,7 +730,7 @@
             error.SetErrorToErrno();
 
         if (error.Fail())
-            error.PutToLog(log, "::kill (pid = %i, SIGSTOP)", pid);
+            error.PutToLog(log.get(), "::kill (pid = %i, SIGSTOP)", pid);
 
         timeout_time = TimeValue::Now();
         timeout_time.OffsetWithSeconds(2);
@@ -781,7 +781,7 @@
 
         log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS);
         if (log || error.Fail())
-            error.PutToLog(log, "ProcessMacOSX::DoSIGSTOP() ::kill (pid = %i, SIGSTOP)", pid);
+            error.PutToLog(log.get(), "ProcessMacOSX::DoSIGSTOP() ::kill (pid = %i, SIGSTOP)", pid);
 
         error = PrivateResume(LLDB_INVALID_THREAD_ID);
 
@@ -823,7 +823,7 @@
 ProcessMacOSX::DoDestroy ()
 {
     Error error;
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS));
     if (log)
         log->Printf ("ProcessMacOSX::DoDestroy()");
 
@@ -863,7 +863,7 @@
             error.SetErrorToErrno();
 
             if (log || error.Fail())
-                error.PutToLog (log, "::ptrace (PT_KILL, %u, 0, 0)", pid);
+                error.PutToLog (log.get(), "::ptrace (PT_KILL, %u, 0, 0)", pid);
 
             // Resume our task and let the SIGKILL do its thing. The thread named
             // "ProcessMacOSX::WaitForChildProcessToExit(void*)" will catch the
@@ -1003,7 +1003,7 @@
     const lldb::addr_t addr = bp_site->GetLoadAddress();
     const lldb::user_id_t site_id = bp_site->GetID();
 
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_BREAKPOINTS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_BREAKPOINTS));
     if (log)
         log->Printf ("ProcessMacOSX::EnableBreakpoint (site_id = %d) addr = 0x%8.8llx", site_id, (uint64_t)addr);
 
@@ -1044,7 +1044,7 @@
     const lldb::addr_t addr = bp_site->GetLoadAddress();
     const lldb::user_id_t site_id = bp_site->GetID();
 
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_BREAKPOINTS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_BREAKPOINTS));
     if (log)
         log->Printf ("ProcessMacOSX::DisableBreakpoint (site_id = %d) addr = 0x%8.8llx", site_id, (uint64_t)addr);
 
@@ -1066,7 +1066,7 @@
     {
         lldb::user_id_t watchID = wp->GetID();
         lldb::addr_t addr = wp->GetLoadAddress();
-        Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_WATCHPOINTS);
+        LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_WATCHPOINTS));
         if (log)
             log->Printf ("ProcessMacOSX::EnableWatchpoint(watchID = %d)", watchID);
         if (wp->IsEnabled())
@@ -1092,7 +1092,7 @@
     {
         lldb::user_id_t watchID = wp->GetID();
 
-        Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_WATCHPOINTS);
+        LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_WATCHPOINTS));
 
         lldb::addr_t addr = wp->GetLoadAddress();
         if (log)
@@ -1222,7 +1222,7 @@
 {
     ProcessMacOSX *proc = (ProcessMacOSX*) arg;
 
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS));
     if (log)
         log->Printf ("ProcessMacOSX::%s (arg = %p) thread starting...", __FUNCTION__, arg);
 
@@ -1270,7 +1270,7 @@
             if (log)
             {
                 err.SetError (select_errno, eErrorTypePOSIX);
-                err.LogIfError(log, "select (nfds, &read_fds, NULL, NULL, NULL) => %d", num_set_fds);
+                err.LogIfError(log.get(), "select (nfds, &read_fds, NULL, NULL, NULL) => %d", num_set_fds);
             }
 
             switch (select_errno)
@@ -1359,13 +1359,13 @@
 ProcessMacOSX::DoSignal (int signal)
 {
     Error error;
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS));
     if (log)
         log->Printf ("ProcessMacOSX::DoSignal (signal = %d)", signal);
     if (::kill (GetID(), signal) != 0)
     {
         error.SetErrorToErrno();
-        error.LogIfError(log, "ProcessMacOSX::DoSignal (%d)", signal);
+        error.LogIfError(log.get(), "ProcessMacOSX::DoSignal (%d)", signal);
     }
     return error;
 }
@@ -1374,7 +1374,7 @@
 Error
 ProcessMacOSX::DoDetach()
 {
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS));
     if (log)
         log->Printf ("ProcessMacOSX::DoDetach()");
 
@@ -1404,7 +1404,7 @@
         error.SetErrorToErrno();
 
         if (log || error.Fail())
-            error.PutToLog(log, "::ptrace (PT_DETACH, %u, (caddr_t)1, 0)", pid);
+            error.PutToLog(log.get(), "::ptrace (PT_DETACH, %u, (caddr_t)1, 0)", pid);
 
         // Resume our task
         Task().Resume();
@@ -1429,7 +1429,7 @@
     Mutex::Locker locker(m_exception_messages_mutex);
     if (m_exception_messages.empty() == false)
     {
-        Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS);
+        LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS));
 
         MachException::Message::iterator pos;
         MachException::Message::iterator begin = m_exception_messages.begin();
@@ -1448,7 +1448,7 @@
             if (curr_error.Fail() && error.Success())
                 error = curr_error;
 
-            error.LogIfError(log, "Error replying to exception");
+            error.LogIfError(log.get(), "Error replying to exception");
         }
 
         // Erase all exception message as we should have used and replied
@@ -1577,7 +1577,7 @@
     if (launch_type == eLaunchDefault)
         launch_type = eLaunchPosixSpawn;
 
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS));
     if (log)
         log->Printf ("%s( path = '%s', argv = %p, envp = %p, launch_type = %u, flags = %x )", __FUNCTION__, path, argv, envp, launch_type, flags);
 
@@ -1655,7 +1655,7 @@
 
                 log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS);
                 if (launch_err.Fail() || log)
-                    launch_err.PutToLog(log, "::ptrace (PT_ATTACHEXC, pid = %i, 0, 0 )", pid);
+                    launch_err.PutToLog(log.get(), "::ptrace (PT_ATTACHEXC, pid = %i, 0, 0 )", pid);
 
                 if (launch_err.Success())
                     m_flags.Set (eFlagsAttached);
@@ -1698,14 +1698,14 @@
 {
     posix_spawnattr_t attr;
     short flags;
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS));
 
     Error local_err;    // Errors that don't affect the spawning.
     if (log)
         log->Printf ("%s ( path='%s', argv=%p, envp=%p, process )", __FUNCTION__, path, argv, envp);
     err.SetError( ::posix_spawnattr_init (&attr), eErrorTypePOSIX);
     if (err.Fail() || log)
-        err.PutToLog(log, "::posix_spawnattr_init ( &attr )");
+        err.PutToLog(log.get(), "::posix_spawnattr_init ( &attr )");
     if (err.Fail())
         return LLDB_INVALID_PROCESS_ID;
 
@@ -1715,7 +1715,7 @@
     
     err.SetError( ::posix_spawnattr_setflags (&attr, flags), eErrorTypePOSIX);
     if (err.Fail() || log)
-        err.PutToLog(log, "::posix_spawnattr_setflags ( &attr, POSIX_SPAWN_START_SUSPENDED%s )", disable_aslr ? " | _POSIX_SPAWN_DISABLE_ASLR" : "");
+        err.PutToLog(log.get(), "::posix_spawnattr_setflags ( &attr, POSIX_SPAWN_START_SUSPENDED%s )", disable_aslr ? " | _POSIX_SPAWN_DISABLE_ASLR" : "");
     if (err.Fail())
         return LLDB_INVALID_PROCESS_ID;
 
@@ -1732,7 +1732,7 @@
             size_t ocount = 0;
             err.SetError( ::posix_spawnattr_setbinpref_np (&attr, 1, &cpu, &ocount), eErrorTypePOSIX);
             if (err.Fail() || log)
-                err.PutToLog(log, "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu, ocount);
+                err.PutToLog(log.get(), "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu, ocount);
 
             if (err.Fail() != 0 || ocount != 1)
                 return LLDB_INVALID_PROCESS_ID;
@@ -1747,7 +1747,7 @@
     err.SetError( ::posix_spawn_file_actions_init (&file_actions), eErrorTypePOSIX);
     int file_actions_valid = err.Success();
     if (!file_actions_valid || log)
-        err.PutToLog(log, "::posix_spawn_file_actions_init ( &file_actions )");
+        err.PutToLog(log.get(), "::posix_spawn_file_actions_init ( &file_actions )");
     Error stdio_err;
     lldb::pid_t pid = LLDB_INVALID_PROCESS_ID;
     if (file_actions_valid)
@@ -1760,21 +1760,21 @@
             {
                 stdio_err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDERR_FILENO,    stderr_path, O_RDWR, 0), eErrorTypePOSIX);
                 if (stdio_err.Fail() || log)
-                    stdio_err.PutToLog(log, "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDERR_FILENO, path = '%s', oflag = O_RDWR, mode = 0 )", stderr_path);
+                    stdio_err.PutToLog(log.get(), "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDERR_FILENO, path = '%s', oflag = O_RDWR, mode = 0 )", stderr_path);
             }
 
             if (stdin_path != NULL && stdin_path[0])
             {
                 stdio_err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDIN_FILENO, stdin_path, O_RDONLY, 0), eErrorTypePOSIX);
                 if (stdio_err.Fail() || log)
-                    stdio_err.PutToLog(log, "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDIN_FILENO, path = '%s', oflag = O_RDONLY, mode = 0 )", stdin_path);
+                    stdio_err.PutToLog(log.get(), "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDIN_FILENO, path = '%s', oflag = O_RDONLY, mode = 0 )", stdin_path);
             }
 
             if (stdout_path != NULL && stdout_path[0])
             {
                 stdio_err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDOUT_FILENO,    stdout_path, O_WRONLY, 0), eErrorTypePOSIX);
                 if (stdio_err.Fail() || log)
-                    stdio_err.PutToLog(log, "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDOUT_FILENO, path = '%s', oflag = O_WRONLY, mode = 0 )", stdout_path);
+                    stdio_err.PutToLog(log.get(), "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDOUT_FILENO, path = '%s', oflag = O_WRONLY, mode = 0 )", stdout_path);
             }
         }
         else
@@ -1792,15 +1792,15 @@
                     slave_name = "/dev/null";
                 stdio_err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDERR_FILENO,    slave_name, O_RDWR|O_NOCTTY, 0), eErrorTypePOSIX);
                 if (stdio_err.Fail() || log)
-                    stdio_err.PutToLog(log, "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDERR_FILENO, path = '%s', oflag = O_RDWR|O_NOCTTY, mode = 0 )", slave_name);
+                    stdio_err.PutToLog(log.get(), "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDERR_FILENO, path = '%s', oflag = O_RDWR|O_NOCTTY, mode = 0 )", slave_name);
 
                 stdio_err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDIN_FILENO, slave_name, O_RDONLY|O_NOCTTY, 0), eErrorTypePOSIX);
                 if (stdio_err.Fail() || log)
-                    stdio_err.PutToLog(log, "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDIN_FILENO, path = '%s', oflag = O_RDONLY|O_NOCTTY, mode = 0 )", slave_name);
+                    stdio_err.PutToLog(log.get(), "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDIN_FILENO, path = '%s', oflag = O_RDONLY|O_NOCTTY, mode = 0 )", slave_name);
 
                 stdio_err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDOUT_FILENO,    slave_name, O_WRONLY|O_NOCTTY, 0), eErrorTypePOSIX);
                 if (stdio_err.Fail() || log)
-                    stdio_err.PutToLog(log, "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDOUT_FILENO, path = '%s', oflag = O_WRONLY|O_NOCTTY, mode = 0 )", slave_name);
+                    stdio_err.PutToLog(log.get(), "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDOUT_FILENO, path = '%s', oflag = O_WRONLY|O_NOCTTY, mode = 0 )", slave_name);
             }
             else
             {
@@ -1813,7 +1813,7 @@
         }
         err.SetError( ::posix_spawnp (&pid, path, &file_actions, &attr, (char * const*)argv, (char * const*)envp), eErrorTypePOSIX);
         if (err.Fail() || log)
-            err.PutToLog(log, "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", pid, path, &file_actions, &attr, argv, envp);
+            err.PutToLog(log.get(), "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", pid, path, &file_actions, &attr, argv, envp);
 
         if (stdio_err.Success())
         {
@@ -1831,7 +1831,7 @@
     {
         err.SetError( ::posix_spawnp (&pid, path, NULL, &attr, (char * const*)argv, (char * const*)envp), eErrorTypePOSIX);
         if (err.Fail() || log)
-            err.PutToLog(log, "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", pid, path, NULL, &attr, argv, envp);
+            err.PutToLog(log.get(), "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", pid, path, NULL, &attr, argv, envp);
     }
     
     ::posix_spawnattr_destroy (&attr);
@@ -1845,7 +1845,7 @@
     {
         local_err.SetError( ::posix_spawn_file_actions_destroy (&file_actions), eErrorTypePOSIX);
         if (local_err.Fail() || log)
-            local_err.PutToLog(log, "::posix_spawn_file_actions_destroy ( &file_actions )");
+            local_err.PutToLog(log.get(), "::posix_spawn_file_actions_destroy ( &file_actions )");
     }
 
     return pid;

Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp Fri Nov  5 20:53:30 2010
@@ -17,29 +17,38 @@
 using namespace lldb;
 using namespace lldb_private;
 
+// We want to avoid global constructors where code needs to be run so here we
+// control access to our static g_log_sp by hiding it in a singleton function
+// that will construct the static g_lob_sp the first time this function is 
+// called.
+static LogSP &
+GetLog ()
+{
+    static LogSP g_log_sp;
+    return g_log_sp;
+}
 
-static Log* g_log = NULL; // Leak for now as auto_ptr was being cleaned up
-                          // by global constructors before other threads
-                          // were done with it.
-Log *
+LogSP
 ProcessMacOSXLog::GetLogIfAllCategoriesSet (uint32_t mask)
 {
-    Log *log = g_log;
+    LogSP log(GetLog ());
     if (log && mask)
     {
         uint32_t log_mask = log->GetMask().Get();
         if ((log_mask & mask) != mask)
-            return NULL;
+            return LogSP();
     }
     return log;
 }
 
+
 void
 ProcessMacOSXLog::DisableLog (Args &args, Stream *feedback_strm)
 {
-    if (g_log)
+    LogSP log (GetLog ());
+    if (log)
     {
-        uint32_t flag_bits = g_log->GetMask().Get();
+        uint32_t flag_bits = log->GetMask().Get();
         const size_t argc = args.GetArgumentCount ();
         for (size_t i = 0; i < argc; ++i)
         {
@@ -65,28 +74,32 @@
             }
         }
         if (flag_bits == 0)
-            DeleteLog ();
+            GetLog().reset();
         else
-            g_log->GetMask().Reset (flag_bits);
+            log->GetMask().Reset (flag_bits);
     }
 }
 
-void
-ProcessMacOSXLog::DeleteLog ()
+LogSP
+ProcessMacOSXLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm)
 {
-    if (g_log)
+    // Try see if there already is a log - that way we can reuse its settings.
+    // We could reuse the log in toto, but we don't know that the stream is the same.
+    uint32_t flag_bits;
+    LogSP log(GetLog ());
+    if (log)
+        flag_bits = log->GetMask().Get();
+    else
+        flag_bits = 0;
+
+    // Now make a new log with this stream if one was provided
+    if (log_stream_sp)
     {
-        delete g_log;
-        g_log = NULL;
+        log = make_shared<Log>(log_stream_sp);
+        GetLog () = log;
     }
-}
 
-Log *
-ProcessMacOSXLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm)
-{
-    DeleteLog ();
-    g_log = new Log (log_stream_sp);
-    if (g_log)
+    if (log)
     {
         uint32_t flag_bits = 0;
         bool got_unknown_category = false;
@@ -121,10 +134,10 @@
         }
         if (flag_bits == 0)
             flag_bits = PD_LOG_DEFAULT;
-        g_log->GetMask().Reset(flag_bits);
-        g_log->GetOptions().Reset(log_options);
+        log->GetMask().Reset(flag_bits);
+        log->GetOptions().Reset(log_options);
     }
-    return g_log;
+    return log;
 }
 
 void
@@ -150,7 +163,7 @@
 void
 ProcessMacOSXLog::LogIf (uint32_t mask, const char *format, ...)
 {
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (mask);
+    LogSP log(ProcessMacOSXLog::GetLogIfAllCategoriesSet (mask));
     if (log)
     {
         va_list args;

Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.h Fri Nov  5 20:53:30 2010
@@ -43,7 +43,7 @@
 class ProcessMacOSXLog
 {
 public:
-    static lldb_private::Log *
+    static lldb::LogSP
     GetLogIfAllCategoriesSet(uint32_t mask = 0);
 
     static void
@@ -52,7 +52,7 @@
     static void
     DeleteLog ();
 
-    static lldb_private::Log *
+    static lldb::LogSP
     EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, lldb_private::Args &args, lldb_private::Stream *feedback_strm);
 
     static void

Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_i386.cpp Fri Nov  5 20:53:30 2010
@@ -450,7 +450,7 @@
     {
         mach_msg_type_number_t count = GPRWordCount;
         SetError(set, Read, ::thread_get_state(GetThreadID(), set, (thread_state_t)&gpr, &count));
-        LogGPR (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD), "RegisterContextMach_i386::ReadGPR()");
+        LogGPR (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD).get(), "RegisterContextMach_i386::ReadGPR()");
     }
     return GetError(set, Read);
 }

Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/RegisterContextMach_x86_64.cpp Fri Nov  5 20:53:30 2010
@@ -494,9 +494,9 @@
     {
         mach_msg_type_number_t count = GPRWordCount;
         SetError(GPRRegSet, Read, ::thread_get_state(GetThreadID(), set, (thread_state_t)&gpr, &count));
-        Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD);
+        LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD));
         if (log)
-            LogGPR (log, "RegisterContextMach_x86_64::ReadGPR(thread = 0x%4.4x)", GetThreadID());
+            LogGPR (log.get(), "RegisterContextMach_x86_64::ReadGPR(thread = 0x%4.4x)", GetThreadID());
     }
     return GetError(GPRRegSet, Read);
 }
@@ -534,9 +534,9 @@
         SetError (set, Write, -1);
         return KERN_INVALID_ARGUMENT;
     }
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD));
     if (log)
-        LogGPR (log, "RegisterContextMach_x86_64::WriteGPR (thread = 0x%4.4x)", GetThreadID());
+        LogGPR (log.get(), "RegisterContextMach_x86_64::WriteGPR (thread = 0x%4.4x)", GetThreadID());
     SetError (set, Write, ::thread_set_state(GetThreadID(), set, (thread_state_t)&gpr, GPRWordCount));
     SetError (set, Read, -1);
     return GetError (set, Write);

Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp Fri Nov  5 20:53:30 2010
@@ -248,7 +248,7 @@
 int32_t
 ThreadMacOSX::Suspend()
 {
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD));
     if (log && log->GetMask().Test(PD_LOG_VERBOSE))
         log->Printf ("ThreadMacOSX::%s ( )", __FUNCTION__);
     lldb::tid_t tid = GetID ();
@@ -259,7 +259,7 @@
             m_suspend_count++;
         log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD);
         if (log || err.Fail())
-            err.PutToLog(log, "::thread_suspend (%4.4x)", tid);
+            err.PutToLog(log.get(), "::thread_suspend (%4.4x)", tid);
     }
     return GetSuspendCount();
 }
@@ -267,7 +267,7 @@
 int32_t
 ThreadMacOSX::Resume()
 {
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD));
     if (log && log->GetMask().Test(PD_LOG_VERBOSE))
         log->Printf ("ThreadMacOSX::%s ()", __FUNCTION__);
     lldb::tid_t tid = GetID ();
@@ -280,7 +280,7 @@
                 m_suspend_count--;
             log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD);
             if (log || err.Fail())
-                err.PutToLog(log, "::thread_resume (%4.4x)", tid);
+                err.PutToLog(log.get(), "::thread_resume (%4.4x)", tid);
         }
     }
     return GetSuspendCount();
@@ -289,7 +289,7 @@
 bool
 ThreadMacOSX::RestoreSuspendCount()
 {
-    Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD);
+    LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD));
     if (log && log->GetMask().Test(PD_LOG_VERBOSE))
         log->Printf ("ThreadMacOSX::%s ( )", __FUNCTION__);
     Error err;
@@ -305,7 +305,7 @@
                 --m_suspend_count;
             log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD);
             if (log || err.Fail())
-                err.PutToLog(log, "::thread_resume (%4.4x)", tid);
+                err.PutToLog(log.get(), "::thread_resume (%4.4x)", tid);
         }
     }
     else if (m_suspend_count < m_basic_info.suspend_count)
@@ -317,7 +317,7 @@
                 --m_suspend_count;
             log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD);
             if (log || err.Fail())
-                err.PutToLog(log, "::thread_suspend (%4.4x)", tid);
+                err.PutToLog(log.get(), "::thread_suspend (%4.4x)", tid);
         }
     }
     return  m_suspend_count == m_basic_info.suspend_count;

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Fri Nov  5 20:53:30 2010
@@ -147,7 +147,7 @@
 
     m_cfa = cfa_regval + cfa_offset;
 
-    Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND);
+    LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
 
     // A couple of sanity checks..
     if (cfa_regval == LLDB_INVALID_ADDRESS || cfa_regval == 0 || cfa_regval == 1)
@@ -176,7 +176,7 @@
 void
 RegisterContextLLDB::InitializeNonZerothFrame()
 {
-    Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND);
+    LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
     if (IsFrameZero ())
     {
         m_frame_type = eNotAValidFrame;
@@ -416,7 +416,7 @@
     if (fu->GetUnwindPlanFastUnwind (m_thread) 
         && fu->GetUnwindPlanFastUnwind (m_thread)->PlanValidAtAddress (m_current_pc))
     {
-        Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND);
+        LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
         if (log && IsLogVerbose())
         {
             const char *has_fast = "";
@@ -441,7 +441,7 @@
 UnwindPlan *
 RegisterContextLLDB::GetFullUnwindPlanForFrame ()
 {
-    Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND);
+    LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
     UnwindPlan *up;
     UnwindPlan *arch_default_up = NULL;
     ArchSpec arch = m_thread.GetProcess().GetTarget().GetArchitecture ();
@@ -687,7 +687,7 @@
 bool
 RegisterContextLLDB::SavedLocationForRegister (uint32_t lldb_regnum, RegisterLocation &regloc)
 {
-    Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND);
+    LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
 
     // Have we already found this register location?
     std::map<uint32_t, RegisterLocation>::const_iterator iterator;
@@ -976,7 +976,7 @@
 bool
 RegisterContextLLDB::ReadRegisterBytes (uint32_t lldb_reg, DataExtractor& data)
 {
-    Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND);
+    LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
     if (!IsValid())
         return false;
 

Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Fri Nov  5 20:53:30 2010
@@ -31,7 +31,7 @@
 uint32_t
 UnwindLLDB::GetFrameCount()
 {
-    Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND);
+    LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
     if (m_frames.empty())
     {
         // First, set up the 0th (initial) frame

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Fri Nov  5 20:53:30 2010
@@ -193,8 +193,8 @@
     StringExtractorGDBRemote &response
 )
 {
-    Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
-    Log *async_log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_ASYNC);
+    LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
+    LogSP async_log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_ASYNC));
     if (log)
         log->Printf ("GDBRemoteCommunication::%s ()", __FUNCTION__);
 

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Nov  5 20:53:30 2010
@@ -633,7 +633,7 @@
     Clear();
     ArchSpec arch_spec = GetTarget().GetArchitecture();
     
-    //Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
+    //LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
     
     
     if (attach_pid != LLDB_INVALID_PROCESS_ID)
@@ -735,7 +735,7 @@
     // HACK: require arch be set correctly at the target level until we can
     // figure out a good way to determine the arch of what we are attaching to
 
-    //Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
+    //LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
     if (process_name && process_name[0])
     {
         char host_port[128];
@@ -948,7 +948,7 @@
 ProcessGDBRemote::UpdateThreadListIfNeeded ()
 {
     // locker will keep a mutex locked until it goes out of scope
-    Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_THREAD);
+    LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_THREAD));
     if (log && log->GetMask().Test(GDBR_LOG_VERBOSE))
         log->Printf ("ProcessGDBRemote::%s (pid = %i)", __FUNCTION__, GetID());
 
@@ -1166,7 +1166,7 @@
 ProcessGDBRemote::DoDetach()
 {
     Error error;
-    Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS);
+    LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
     if (log)
         log->Printf ("ProcessGDBRemote::DoDetach()");
 
@@ -1199,7 +1199,7 @@
 ProcessGDBRemote::DoDestroy ()
 {
     Error error;
-    Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS);
+    LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
     if (log)
         log->Printf ("ProcessGDBRemote::DoDestroy()");
 
@@ -1407,7 +1407,7 @@
     Error error;
     assert (bp_site != NULL);
 
-    Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_BREAKPOINTS);
+    LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_BREAKPOINTS));
     user_id_t site_id = bp_site->GetID();
     const addr_t addr = bp_site->GetLoadAddress();
     if (log)
@@ -1483,7 +1483,7 @@
     assert (bp_site != NULL);
     addr_t addr = bp_site->GetLoadAddress();
     user_id_t site_id = bp_site->GetID();
-    Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_BREAKPOINTS);
+    LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_BREAKPOINTS));
     if (log)
         log->Printf ("ProcessGDBRemote::DisableBreakpoint (site_id = %d) addr = 0x%8.8llx", site_id, (uint64_t)addr);
 
@@ -1550,7 +1550,7 @@
     {
         user_id_t watchID = wp->GetID();
         addr_t addr = wp->GetLoadAddress();
-        Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_WATCHPOINTS);
+        LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_WATCHPOINTS));
         if (log)
             log->Printf ("ProcessGDBRemote::EnableWatchpoint(watchID = %d)", watchID);
         if (wp->IsEnabled())
@@ -1582,7 +1582,7 @@
     {
         user_id_t watchID = wp->GetID();
 
-        Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_WATCHPOINTS);
+        LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_WATCHPOINTS));
 
         addr_t addr = wp->GetLoadAddress();
         if (log)
@@ -1620,7 +1620,7 @@
 ProcessGDBRemote::DoSignal (int signo)
 {
     Error error;
-    Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS);
+    LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
     if (log)
         log->Printf ("ProcessGDBRemote::DoSignal (signal = %d)", signo);
 
@@ -1706,14 +1706,14 @@
             m_stdio_communication.Clear();
             posix_spawnattr_t attr;
 
-            Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
+            LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
 
             Error local_err;    // Errors that don't affect the spawning.
             if (log)
                 log->Printf ("%s ( path='%s', argv=%p, envp=%p, arch=%s )", __FUNCTION__, debugserver_path, inferior_argv, inferior_envp, inferior_arch.AsCString());
             error.SetError( ::posix_spawnattr_init (&attr), eErrorTypePOSIX);
             if (error.Fail() || log)
-                error.PutToLog(log, "::posix_spawnattr_init ( &attr )");
+                error.PutToLog(log.get(), "::posix_spawnattr_init ( &attr )");
             if (error.Fail())
                 return error;;
 
@@ -1730,7 +1730,7 @@
                     size_t ocount = 0;
                     error.SetError( ::posix_spawnattr_setbinpref_np (&attr, 1, &cpu, &ocount), eErrorTypePOSIX);
                     if (error.Fail() || log)
-                        error.PutToLog(log, "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu, ocount);
+                        error.PutToLog(log.get(), "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu, ocount);
 
                     if (error.Fail() != 0 || ocount != 1)
                         return error;
@@ -1879,7 +1879,7 @@
                 m_debugserver_pid = LLDB_INVALID_PROCESS_ID;
 
             if (error.Fail() || log)
-                error.PutToLog(log, "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", m_debugserver_pid, debugserver_path, NULL, &attr, inferior_argv, inferior_envp);
+                error.PutToLog(log.get(), "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", m_debugserver_pid, debugserver_path, NULL, &attr, inferior_argv, inferior_envp);
 
             if (m_debugserver_pid != LLDB_INVALID_PROCESS_ID)
             {
@@ -2055,7 +2055,7 @@
 {
     ResetGDBRemoteState ();
 
-    Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS);
+    LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
 
     if (log)
         log->Printf ("ProcessGDBRemote::%s ()", __FUNCTION__);
@@ -2069,7 +2069,7 @@
 void
 ProcessGDBRemote::StopAsyncThread ()
 {
-    Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS);
+    LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
 
     if (log)
         log->Printf ("ProcessGDBRemote::%s ()", __FUNCTION__);
@@ -2089,7 +2089,7 @@
 {
     ProcessGDBRemote *process = (ProcessGDBRemote*) arg;
 
-    Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
+    LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
     if (log)
         log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) thread starting...", __FUNCTION__, arg, process->GetID());
 

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp Fri Nov  5 20:53:30 2010
@@ -18,38 +18,37 @@
 using namespace lldb_private;
 
 
-static Log* g_log = NULL; // Leak for now as auto_ptr was being cleaned up
-                          // by global constructors before other threads
-                          // were done with it.
-Log *
+// We want to avoid global constructors where code needs to be run so here we
+// control access to our static g_log_sp by hiding it in a singleton function
+// that will construct the static g_lob_sp the first time this function is 
+// called.
+static LogSP &
+GetLog ()
+{
+    static LogSP g_log_sp;
+    return g_log_sp;
+}
+
+LogSP
 ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (uint32_t mask)
 {
-    Log *log = g_log;
+    LogSP log(GetLog ());
     if (log && mask)
     {
         uint32_t log_mask = log->GetMask().Get();
         if ((log_mask & mask) != mask)
-            return NULL;
+            return LogSP();
     }
     return log;
 }
 
 void
-ProcessGDBRemoteLog::DeleteLog ()
-{
-    if (g_log)
-    {
-        delete g_log;
-        g_log = NULL;
-    }
-}
-
-void
 ProcessGDBRemoteLog::DisableLog (Args &args, Stream *feedback_strm)
 {
-    if (g_log)
+    LogSP log (GetLog ());
+    if (log)
     {
-        uint32_t flag_bits = g_log->GetMask().Get();
+        uint32_t flag_bits = log->GetMask().Get();
         const size_t argc = args.GetArgumentCount ();
         for (size_t i = 0; i < argc; ++i)
         {
@@ -79,20 +78,34 @@
         }
         
         if (flag_bits == 0)
-            DeleteLog();
+            GetLog ().reset();
         else
-            g_log->GetMask().Reset (flag_bits);
+            log->GetMask().Reset (flag_bits);
     }
     
     return;
 }
 
-Log *
+LogSP
 ProcessGDBRemoteLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm)
 {
-    DeleteLog ();
-    g_log = new Log (log_stream_sp);
-    if (g_log)
+    // Try see if there already is a log - that way we can reuse its settings.
+    // We could reuse the log in toto, but we don't know that the stream is the same.
+    uint32_t flag_bits;
+    LogSP log(GetLog ());
+    if (log)
+        flag_bits = log->GetMask().Get();
+    else
+        flag_bits = 0;
+
+    // Now make a new log with this stream if one was provided
+    if (log_stream_sp)
+    {
+        log = make_shared<Log>(log_stream_sp);
+        GetLog () = log;
+    }
+
+    if (log)
     {
         uint32_t flag_bits = 0;
         bool got_unknown_category = false;
@@ -127,10 +140,10 @@
         }
         if (flag_bits == 0)
             flag_bits = GDBR_LOG_DEFAULT;
-        g_log->GetMask().Reset(flag_bits);
-        g_log->GetOptions().Reset(log_options);
+        log->GetMask().Reset(flag_bits);
+        log->GetOptions().Reset(log_options);
     }
-    return g_log;
+    return log;
 }
 
 void
@@ -157,7 +170,7 @@
 void
 ProcessGDBRemoteLog::LogIf (uint32_t mask, const char *format, ...)
 {
-    Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (mask);
+    LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (mask));
     if (log)
     {
         va_list args;

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h Fri Nov  5 20:53:30 2010
@@ -35,16 +35,13 @@
 class ProcessGDBRemoteLog
 {
 public:
-    static lldb_private::Log *
+    static lldb::LogSP
     GetLogIfAllCategoriesSet(uint32_t mask = 0);
 
     static void
     DisableLog (lldb_private::Args &args, lldb_private::Stream *feedback_strm);
 
-    static void
-    DeleteLog ();
-    
-    static lldb_private::Log *
+    static lldb::LogSP
     EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, lldb_private::Args &args, lldb_private::Stream *feedback_strm);
 
     static void

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Nov  5 20:53:30 2010
@@ -718,7 +718,7 @@
         }
     }
 private:
-    Log    *m_log;
+    LogSP m_log;
 };
 
 clang_type_t

Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp (original)
+++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Fri Nov  5 20:53:30 2010
@@ -290,7 +290,7 @@
     dw_offset_t offset = 0;
     if (m_cfi_data_initialized == false)
     {
-        Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND);
+        LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
         if (log)
         { 
             log->Printf ("Reading eh_frame information for %s", m_objfile.GetFileSpec().GetFilename().GetCString());

Modified: lldb/trunk/source/Target/ObjCLanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ObjCLanguageRuntime.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Target/ObjCLanguageRuntime.cpp (original)
+++ lldb/trunk/source/Target/ObjCLanguageRuntime.cpp Fri Nov  5 20:53:30 2010
@@ -33,7 +33,7 @@
 void
 ObjCLanguageRuntime::AddToMethodCache (lldb::addr_t class_addr, lldb::addr_t selector, lldb::addr_t impl_addr)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     if (log)
     {
         log->Printf ("Caching: class 0x%llx selector 0x%llx implementation 0x%llx.", class_addr, selector, impl_addr);

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Fri Nov  5 20:53:30 2010
@@ -89,7 +89,7 @@
 {
     UpdateInstanceName();
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
         log->Printf ("%p Process::Process()", this);
 
@@ -118,7 +118,7 @@
 //----------------------------------------------------------------------
 Process::~Process()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
         log->Printf ("%p Process::~Process()", this);
     StopPrivateStateThread();
@@ -243,7 +243,7 @@
 StateType
 Process::WaitForStateChangedEvents (const TimeValue *timeout, EventSP &event_sp)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
 
     if (log)
         log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, timeout);
@@ -267,7 +267,7 @@
 Event *
 Process::PeekAtStateChangedEvents ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
 
     if (log)
         log->Printf ("Process::%s...", __FUNCTION__);
@@ -296,7 +296,7 @@
 StateType
 Process::WaitForStateChangedEventsPrivate (const TimeValue *timeout, EventSP &event_sp)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
 
     if (log)
         log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, timeout);
@@ -320,7 +320,7 @@
 bool
 Process::WaitForEventsPrivate (const TimeValue *timeout, EventSP &event_sp, bool control_only)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
 
     if (log)
         log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, timeout);
@@ -415,7 +415,7 @@
 void
 Process::SetPublicState (StateType new_state)
 {
-    Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE);
+    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE));
     if (log)
         log->Printf("Process::SetPublicState (%s)", StateAsCString(new_state));
     m_public_state.SetValue (new_state);
@@ -430,7 +430,7 @@
 void
 Process::SetPrivateState (StateType new_state)
 {
-    Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE);
+    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE));
     bool state_changed = false;
 
     if (log)
@@ -811,7 +811,7 @@
 {
     Error error;
     assert (bp_site != NULL);
-    Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
     const addr_t bp_addr = bp_site->GetLoadAddress();
     if (log)
         log->Printf ("Process::EnableSoftwareBreakpoint (site_id = %d) addr = 0x%llx", bp_site->GetID(), (uint64_t)bp_addr);
@@ -888,7 +888,7 @@
 {
     Error error;
     assert (bp_site != NULL);
-    Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
     addr_t bp_addr = bp_site->GetLoadAddress();
     lldb::user_id_t breakID = bp_site->GetID();
     if (log)
@@ -1389,7 +1389,7 @@
 Error
 Process::Resume ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
     if (log)
         log->Printf("Process::Resume() m_stop_id = %u", m_stop_id);
 
@@ -1513,7 +1513,7 @@
 {
     const StateType state = Process::ProcessEventData::GetStateFromEvent (event_ptr);
     bool return_value = true;
-    Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS));
 
     switch (state)
     {
@@ -1632,7 +1632,7 @@
 bool
 Process::StartPrivateStateThread ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS));
 
     if (log)
         log->Printf ("Process::%s ( )", __FUNCTION__);
@@ -1664,7 +1664,7 @@
 void
 Process::ControlPrivateStateThread (uint32_t signal)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS));
 
     assert (signal == eBroadcastInternalStateControlStop ||
             signal == eBroadcastInternalStateControlPause ||
@@ -1701,7 +1701,7 @@
 void
 Process::HandlePrivateEvent (EventSP &event_sp)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
     const StateType internal_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get());
     // See if we should broadcast this state to external clients?
     const bool should_broadcast = ShouldBroadcastEvent (event_sp.get());
@@ -1740,7 +1740,7 @@
     bool control_only = false;
     m_private_state_control_wait.SetValue (false, eBroadcastNever);
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
     if (log)
         log->Printf ("Process::%s (arg = %p, pid = %i) thread starting...", __FUNCTION__, this, GetID());
 

Modified: lldb/trunk/source/Target/SectionLoadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/SectionLoadList.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Target/SectionLoadList.cpp (original)
+++ lldb/trunk/source/Target/SectionLoadList.cpp Fri Nov  5 20:53:30 2010
@@ -50,7 +50,7 @@
 bool
 SectionLoadList::SetSectionLoadAddress (const Section *section, addr_t load_addr)
 {
-    Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE);
+    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE));
 
     if (log)
         log->Printf ("SectionLoadList::%s (section = %p (%s.%s), load_addr = 0x%16.16llx)",
@@ -76,7 +76,7 @@
 size_t
 SectionLoadList::SetSectionUnloaded (const Section *section)
 {
-    Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE);
+    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE));
 
     if (log)
         log->Printf ("SectionLoadList::%s (section = %p (%s.%s))",
@@ -99,7 +99,7 @@
 bool
 SectionLoadList::SetSectionUnloaded (const Section *section, addr_t load_addr)
 {
-    Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE);
+    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE));
 
     if (log)
         log->Printf ("SectionLoadList::%s (section = %p (%s.%s), load_addr = 0x%16.16llx)",

Modified: lldb/trunk/source/Target/StopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Target/StopInfo.cpp (original)
+++ lldb/trunk/source/Target/StopInfo.cpp Fri Nov  5 20:53:30 2010
@@ -93,7 +93,7 @@
             }
             else
             {
-                Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
+                LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
 
                 if (log)
                     log->Printf ("Process::%s could not find breakpoint site id: %lld...", __FUNCTION__, m_value);
@@ -127,7 +127,7 @@
         }
         else
         {
-            Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
+            LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
 
             if (log)
                 log->Printf ("Process::%s could not find breakpoint site id: %lld...", __FUNCTION__, m_value);

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Fri Nov  5 20:53:30 2010
@@ -52,7 +52,7 @@
     SetEventName (eBroadcastBitModulesLoaded, "modules-loaded");
     SetEventName (eBroadcastBitModulesUnloaded, "modules-unloaded");
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
         log->Printf ("%p Target::Target()", this);
 }
@@ -62,7 +62,7 @@
 //----------------------------------------------------------------------
 Target::~Target()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
         log->Printf ("%p Target::~Target()", this);
     DeleteCurrentProcess ();
@@ -252,7 +252,7 @@
         else
             m_breakpoint_list.Add (bp_sp, true);
 
-        Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
         if (log)
         {
             StreamString s;
@@ -274,7 +274,7 @@
 void
 Target::RemoveAllBreakpoints (bool internal_also)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
     if (log)
         log->Printf ("Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no");
 
@@ -288,7 +288,7 @@
 void
 Target::DisableAllBreakpoints (bool internal_also)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
     if (log)
         log->Printf ("Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no");
 
@@ -300,7 +300,7 @@
 void
 Target::EnableAllBreakpoints (bool internal_also)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
     if (log)
         log->Printf ("Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no");
 
@@ -312,7 +312,7 @@
 bool
 Target::RemoveBreakpointByID (break_id_t break_id)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
     if (log)
         log->Printf ("Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__, break_id, LLDB_BREAK_ID_IS_INTERNAL (break_id) ? "yes" : "no");
 
@@ -334,7 +334,7 @@
 bool
 Target::DisableBreakpointByID (break_id_t break_id)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
     if (log)
         log->Printf ("Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__, break_id, LLDB_BREAK_ID_IS_INTERNAL (break_id) ? "yes" : "no");
 
@@ -355,7 +355,7 @@
 bool
 Target::EnableBreakpointByID (break_id_t break_id)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
     if (log)
         log->Printf ("Target::%s (break_id = %i, internal = %s)\n",
                      __FUNCTION__,

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Fri Nov  5 20:53:30 2010
@@ -57,7 +57,7 @@
     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()
 {
-    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 @@
     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 @@
 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_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 @@
 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 @@
 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 @@
 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);

Modified: lldb/trunk/source/Target/ThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadList.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadList.cpp (original)
+++ lldb/trunk/source/Target/ThreadList.cpp Fri Nov  5 20:53:30 2010
@@ -179,7 +179,7 @@
 
     // Running events should never stop, obviously...
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
     bool should_stop = false;    
     m_process->UpdateThreadListIfNeeded();
@@ -251,7 +251,7 @@
     m_process->UpdateThreadListIfNeeded();
     collection::iterator pos, end = m_threads.end();
 
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
     if (log)
         log->Printf ("%s %zu threads", __FUNCTION__, m_threads.size());

Modified: lldb/trunk/source/Target/ThreadPlan.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlan.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlan.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlan.cpp Fri Nov  5 20:53:30 2010
@@ -89,7 +89,7 @@
 Vote
 ThreadPlan::ShouldReportStop (Event *event_ptr)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
     if (m_stop_vote == eVoteNoOpinion)
     {
@@ -135,7 +135,7 @@
 {
     if (current_plan)
     {
-        Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
         if (log)
         {

Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Fri Nov  5 20:53:30 2010
@@ -245,7 +245,7 @@
 {
     if (PlanExplainsStop())
     {
-        Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
         
         if (log)
         {
@@ -320,7 +320,7 @@
 {
     if (IsPlanComplete())
     {
-        Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
         if (log)
             log->Printf("Completed call function plan.");

Modified: lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp Fri Nov  5 20:53:30 2010
@@ -215,7 +215,7 @@
 bool
 ThreadPlanRunToAddress::MischiefManaged ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
     if (AtOurAddress())
     {

Modified: lldb/trunk/source/Target/ThreadPlanStepInRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInRange.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepInRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepInRange.cpp Fri Nov  5 20:53:30 2010
@@ -69,7 +69,7 @@
 bool
 ThreadPlanStepInRange::ShouldStop (Event *event_ptr)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     m_no_more_plans = false;
     
     if (log)
@@ -245,7 +245,7 @@
 {
     bool should_step_out = false;
     StackFrame *frame = current_plan->GetThread().GetStackFrameAtIndex(0).get();
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
     if (flags.Test(eAvoidNoDebug))
     {

Modified: lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp Fri Nov  5 20:53:30 2010
@@ -101,7 +101,7 @@
 {
     if (m_step_over)
     {
-        Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
         if (m_thread.GetStackFrameCount() <= m_stack_depth)
         {
             if (m_thread.GetRegisterContext()->GetPC(0) != m_instruction_addr)
@@ -178,7 +178,7 @@
 {
     if (IsPlanComplete())
     {
-        Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
         if (log)
             log->Printf("Completed single instruction step plan.");
         ThreadPlan::MischiefManaged ();

Modified: lldb/trunk/source/Target/ThreadPlanStepOut.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOut.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepOut.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepOut.cpp Fri Nov  5 20:53:30 2010
@@ -207,7 +207,7 @@
         // reason and we're now stopping for some other reason altogether, then we're done
         // with this step out operation.
 
-        Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
         if (log)
             log->Printf("Completed step out plan.");
         m_thread.GetProcess().GetTarget().RemoveBreakpointByID (m_return_bp_id);

Modified: lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp Fri Nov  5 20:53:30 2010
@@ -118,7 +118,7 @@
     }
     else
     {
-        Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
         if (log)
             log->Printf("Completed step over breakpoint plan.");
         // Otherwise, re-enable the breakpoint we were stepping over, and we're done.

Modified: lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp Fri Nov  5 20:53:30 2010
@@ -24,6 +24,7 @@
 #include "lldb/Target/ThreadPlanStepThrough.h"
 
 using namespace lldb_private;
+using namespace lldb;
 
 
 //----------------------------------------------------------------------
@@ -63,7 +64,7 @@
 bool
 ThreadPlanStepOverRange::ShouldStop (Event *event_ptr)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
     if (log)
     {

Modified: lldb/trunk/source/Target/ThreadPlanStepRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepRange.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepRange.cpp Fri Nov  5 20:53:30 2010
@@ -84,7 +84,7 @@
 Vote
 ThreadPlanStepRange::ShouldReportStop (Event *event_ptr)
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
     const Vote vote = IsPlanComplete() ? eVoteYes : eVoteNo;
     if (log)
@@ -95,7 +95,7 @@
 bool
 ThreadPlanStepRange::InRange ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     bool ret_value = false;
 
     lldb::addr_t pc_load_addr = m_thread.GetRegisterContext()->GetPC();
@@ -158,7 +158,7 @@
 bool
 ThreadPlanStepRange::FrameIsYounger ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     
     // FIXME: Might be better to do this by storing the FrameID we started in and seeing if that is still above
     // us on the stack.  Counting the whole stack could be expensive.
@@ -187,7 +187,7 @@
 bool
 ThreadPlanStepRange::FrameIsOlder ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     uint32_t current_depth = m_thread.GetStackFrameCount();
     if (current_depth == m_stack_depth)
     {
@@ -254,7 +254,7 @@
 
     if (done)
     {
-        Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
         if (log)
             log->Printf("Completed step through range plan.");
         ThreadPlan::MischiefManaged ();

Modified: lldb/trunk/source/Target/ThreadPlanStepThrough.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepThrough.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepThrough.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepThrough.cpp Fri Nov  5 20:53:30 2010
@@ -117,7 +117,7 @@
 bool
 ThreadPlanStepThrough::MischiefManaged ()
 {
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
     // Stop if we're happy with the place we've landed...
 

Modified: lldb/trunk/source/Target/ThreadPlanStepUntil.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepUntil.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepUntil.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepUntil.cpp Fri Nov  5 20:53:30 2010
@@ -347,7 +347,7 @@
     bool done = false;
     if (IsPlanComplete())
     {
-        Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
         if (log)
             log->Printf("Completed step until plan.");
 

Modified: lldb/trunk/source/Target/ThreadPlanTestCondition.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanTestCondition.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanTestCondition.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanTestCondition.cpp Fri Nov  5 20:53:30 2010
@@ -70,7 +70,7 @@
 bool 
 ThreadPlanTestCondition::ShouldStop (Event *event_ptr)
 {    
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
+    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     if (m_thread.IsThreadPlanDone(m_expression_plan_sp.get()))
     {
         ClangExpressionVariable *expr_result = NULL;
@@ -89,13 +89,11 @@
                 else
                     m_did_stop = true;
             }
-            log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
             if (log)
                 log->Printf("Condition successfully evaluated, result is %s.\n", m_did_stop ? "true" : "false");
         }
         else
         {
-            log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
             if (log)
                 log->Printf("Failed to get a result from the expression, error: \"%s\"\n", error_stream.GetData());
             m_did_stop = true;
@@ -103,7 +101,6 @@
     }
     else if (m_exe_ctx.thread->WasThreadPlanDiscarded (m_expression_plan_sp.get()))
     {
-        log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
         if (log)
             log->Printf("ExecuteExpression thread plan was discarded.\n");
         m_did_stop = true; 

Modified: lldb/trunk/source/lldb-log.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb-log.cpp?rev=118319&r1=118318&r2=118319&view=diff
==============================================================================
--- lldb/trunk/source/lldb-log.cpp (original)
+++ lldb/trunk/source/lldb-log.cpp Fri Nov  5 20:53:30 2010
@@ -22,30 +22,21 @@
 using namespace lldb_private;
 
 
-static Log *
-LogAccessor (bool get, StreamSP *stream_sp_ptr)
+// We want to avoid global constructors where code needs to be run so here we
+// control access to our static g_log_sp by hiding it in a singleton function
+// that will construct the static g_lob_sp the first time this function is 
+// called.
+static LogSP &
+GetLog ()
 {
-    static Log* g_log = NULL; // Leak for now as auto_ptr was being cleaned up
-                                // by global constructors before other threads
-                                // were done with it.
-    if (!get)
-    {
-        if (g_log)
-            delete g_log;
-        if (stream_sp_ptr)
-            g_log = new Log (*stream_sp_ptr);
-        else
-            g_log = NULL;
-    }
-
-    return g_log;
-
+    static LogSP g_log_sp;
+    return g_log_sp;
 }
 
 uint32_t
 lldb_private::GetLogMask ()
 {
-    Log *log = LogAccessor (true, NULL);
+    LogSP log(GetLog ());
     if (log)
         return log->GetMask().Get();
     return 0;
@@ -58,15 +49,15 @@
     return (mask & LIBLLDB_LOG_VERBOSE);
 }
 
-Log *
+LogSP
 lldb_private::GetLogIfAllCategoriesSet (uint32_t mask)
 {
-    Log *log = LogAccessor (true, NULL);
+    LogSP log(GetLog ());
     if (log && mask)
     {
         uint32_t log_mask = log->GetMask().Get();
         if ((log_mask & mask) != mask)
-            return NULL;
+            return LogSP();
     }
     return log;
 }
@@ -74,7 +65,7 @@
 void
 lldb_private::LogIfAllCategoriesSet (uint32_t mask, const char *format, ...)
 {
-    Log *log = GetLogIfAllCategoriesSet (mask);
+    LogSP log(GetLogIfAllCategoriesSet (mask));
     if (log)
     {
         va_list args;
@@ -87,7 +78,7 @@
 void
 lldb_private::LogIfAnyCategoriesSet (uint32_t mask, const char *format, ...)
 {
-    Log *log = GetLogIfAnyCategoriesSet (mask);
+    LogSP log(GetLogIfAnyCategoriesSet (mask));
     if (log)
     {
         va_list args;
@@ -97,19 +88,19 @@
     }
 }
 
-Log *
+LogSP
 lldb_private::GetLogIfAnyCategoriesSet (uint32_t mask)
 {
-    Log *log = LogAccessor (true, NULL);
+    LogSP log(GetLog ());
     if (log && mask && (mask & log->GetMask().Get()))
         return log;
-    return NULL;
+    return LogSP();
 }
 
 void
 lldb_private::DisableLog (Args &args, Stream *feedback_strm)
 {
-    Log *log = LogAccessor (true, NULL);
+    LogSP log(GetLog ());
     uint32_t flag_bits;
 
     if (log)
@@ -148,7 +139,7 @@
             
         }
         if (flag_bits == 0)
-            LogAccessor (false, NULL);
+            GetLog ().reset();
         else
             log->GetMask().Reset (flag_bits);
     }
@@ -156,20 +147,25 @@
     return;
 }
 
-Log *
+LogSP
 lldb_private::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm)
 {
     // Try see if there already is a log - that way we can reuse its settings.
     // We could reuse the log in toto, but we don't know that the stream is the same.
     uint32_t flag_bits;
-    Log* log = LogAccessor (true, NULL);
+    LogSP log(GetLog ());
     if (log)
         flag_bits = log->GetMask().Get();
     else
         flag_bits = 0;
 
-    // Now make a new log with this stream.
-    log = LogAccessor (false, &log_stream_sp);
+    // Now make a new log with this stream if one was provided
+    if (log_stream_sp)
+    {
+        log = make_shared<Log>(log_stream_sp);
+        GetLog () = log;
+    }
+
     if (log)
     {
         bool got_unknown_category = false;





More information about the lldb-commits mailing list