[Lldb-commits] [lldb] r366936 - [Logging] Replace Log::Printf with LLDB_LOG macro (NFC)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 24 10:56:11 PDT 2019


Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Wed Jul 24 10:56:10 2019
@@ -256,9 +256,8 @@ Thread::Thread(Process &process, lldb::t
       m_override_should_notify(eLazyBoolCalculate),
       m_extended_info_fetched(false), m_extended_info() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
-  if (log)
-    log->Printf("%p Thread::Thread(tid = 0x%4.4" PRIx64 ")",
-                static_cast<void *>(this), GetID());
+  LLDB_LOGF(log, "%p Thread::Thread(tid = 0x%4.4" PRIx64 ")",
+            static_cast<void *>(this), GetID());
 
   CheckInWithManager();
 
@@ -267,9 +266,8 @@ Thread::Thread(Process &process, lldb::t
 
 Thread::~Thread() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
-  if (log)
-    log->Printf("%p Thread::~Thread(tid = 0x%4.4" PRIx64 ")",
-                static_cast<void *>(this), GetID());
+  LLDB_LOGF(log, "%p Thread::~Thread(tid = 0x%4.4" PRIx64 ")",
+            static_cast<void *>(this), GetID());
   /// If you hit this assert, it means your derived class forgot to call
   /// DoDestroy in its destructor.
   assert(m_destroy_called);
@@ -490,11 +488,10 @@ void Thread::SetStopInfo(const lldb::Sto
   else
     m_stop_info_stop_id = UINT32_MAX;
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
-  if (log)
-    log->Printf("%p: tid = 0x%" PRIx64 ": stop info = %s (stop_id = %u)",
-                static_cast<void *>(this), GetID(),
-                stop_info_sp ? stop_info_sp->GetDescription() : "<NULL>",
-                m_stop_info_stop_id);
+  LLDB_LOGF(log, "%p: tid = 0x%" PRIx64 ": stop info = %s (stop_id = %u)",
+            static_cast<void *>(this), GetID(),
+            stop_info_sp ? stop_info_sp->GetDescription() : "<NULL>",
+            m_stop_info_stop_id);
 }
 
 void Thread::SetShouldReportStop(Vote vote) {
@@ -721,18 +718,18 @@ bool Thread::ShouldStop(Event *event_ptr
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
 
   if (GetResumeState() == eStateSuspended) {
-    if (log)
-      log->Printf("Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
-                  ", should_stop = 0 (ignore since thread was suspended)",
-                  __FUNCTION__, GetID(), GetProtocolID());
+    LLDB_LOGF(log,
+              "Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
+              ", should_stop = 0 (ignore since thread was suspended)",
+              __FUNCTION__, GetID(), GetProtocolID());
     return false;
   }
 
   if (GetTemporaryResumeState() == eStateSuspended) {
-    if (log)
-      log->Printf("Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
-                  ", should_stop = 0 (ignore since thread was suspended)",
-                  __FUNCTION__, GetID(), GetProtocolID());
+    LLDB_LOGF(log,
+              "Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
+              ", should_stop = 0 (ignore since thread was suspended)",
+              __FUNCTION__, GetID(), GetProtocolID());
     return false;
   }
 
@@ -740,28 +737,28 @@ bool Thread::ShouldStop(Event *event_ptr
   // thread caused the process to stop. NOTE: this must take place before the
   // plan is moved from the current plan stack to the completed plan stack.
   if (!ThreadStoppedForAReason()) {
-    if (log)
-      log->Printf("Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
-                  ", pc = 0x%16.16" PRIx64
-                  ", should_stop = 0 (ignore since no stop reason)",
-                  __FUNCTION__, GetID(), GetProtocolID(),
-                  GetRegisterContext() ? GetRegisterContext()->GetPC()
-                                       : LLDB_INVALID_ADDRESS);
+    LLDB_LOGF(log,
+              "Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
+              ", pc = 0x%16.16" PRIx64
+              ", should_stop = 0 (ignore since no stop reason)",
+              __FUNCTION__, GetID(), GetProtocolID(),
+              GetRegisterContext() ? GetRegisterContext()->GetPC()
+                                   : LLDB_INVALID_ADDRESS);
     return false;
   }
 
   if (log) {
-    log->Printf("Thread::%s(%p) for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
-                ", pc = 0x%16.16" PRIx64,
-                __FUNCTION__, static_cast<void *>(this), GetID(),
-                GetProtocolID(),
-                GetRegisterContext() ? GetRegisterContext()->GetPC()
-                                     : LLDB_INVALID_ADDRESS);
-    log->Printf("^^^^^^^^ Thread::ShouldStop Begin ^^^^^^^^");
+    LLDB_LOGF(log,
+              "Thread::%s(%p) for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64
+              ", pc = 0x%16.16" PRIx64,
+              __FUNCTION__, static_cast<void *>(this), GetID(), GetProtocolID(),
+              GetRegisterContext() ? GetRegisterContext()->GetPC()
+                                   : LLDB_INVALID_ADDRESS);
+    LLDB_LOGF(log, "^^^^^^^^ Thread::ShouldStop Begin ^^^^^^^^");
     StreamString s;
     s.IndentMore();
     DumpThreadPlans(&s);
-    log->Printf("Plan stack initial state:\n%s", s.GetData());
+    LLDB_LOGF(log, "Plan stack initial state:\n%s", s.GetData());
   }
 
   // The top most plan always gets to do the trace log...
@@ -774,9 +771,8 @@ bool Thread::ShouldStop(Event *event_ptr
   StopInfoSP private_stop_info(GetPrivateStopInfo());
   if (private_stop_info &&
       !private_stop_info->ShouldStopSynchronous(event_ptr)) {
-    if (log)
-      log->Printf("StopInfo::ShouldStop async callback says we should not "
-                  "stop, returning ShouldStop of false.");
+    LLDB_LOGF(log, "StopInfo::ShouldStop async callback says we should not "
+                   "stop, returning ShouldStop of false.");
     return false;
   }
 
@@ -840,15 +836,13 @@ bool Thread::ShouldStop(Event *event_ptr
   if (!done_processing_current_plan) {
     bool over_ride_stop = current_plan->ShouldAutoContinue(event_ptr);
 
-    if (log)
-      log->Printf("Plan %s explains stop, auto-continue %i.",
-                  current_plan->GetName(), over_ride_stop);
+    LLDB_LOGF(log, "Plan %s explains stop, auto-continue %i.",
+              current_plan->GetName(), over_ride_stop);
 
     // We're starting from the base plan, so just let it decide;
     if (PlanIsBasePlan(current_plan)) {
       should_stop = current_plan->ShouldStop(event_ptr);
-      if (log)
-        log->Printf("Base plan says should stop: %i.", should_stop);
+      LLDB_LOGF(log, "Base plan says should stop: %i.", should_stop);
     } else {
       // Otherwise, don't let the base plan override what the other plans say
       // to do, since presumably if there were other plans they would know what
@@ -858,9 +852,8 @@ bool Thread::ShouldStop(Event *event_ptr
           break;
 
         should_stop = current_plan->ShouldStop(event_ptr);
-        if (log)
-          log->Printf("Plan %s should stop: %d.", current_plan->GetName(),
-                      should_stop);
+        LLDB_LOGF(log, "Plan %s should stop: %d.", current_plan->GetName(),
+                  should_stop);
         if (current_plan->MischiefManaged()) {
           if (should_stop)
             current_plan->WillStop();
@@ -907,10 +900,10 @@ bool Thread::ShouldStop(Event *event_ptr
       plan_ptr = GetPreviousPlan(examined_plan);
 
       if (stale) {
-        if (log)
-          log->Printf(
-              "Plan %s being discarded in cleanup, it says it is already done.",
-              examined_plan->GetName());
+        LLDB_LOGF(
+            log,
+            "Plan %s being discarded in cleanup, it says it is already done.",
+            examined_plan->GetName());
         while (GetCurrentPlan() != examined_plan) {
           DiscardPlan();
         }
@@ -929,9 +922,9 @@ bool Thread::ShouldStop(Event *event_ptr
     StreamString s;
     s.IndentMore();
     DumpThreadPlans(&s);
-    log->Printf("Plan stack final state:\n%s", s.GetData());
-    log->Printf("vvvvvvvv Thread::ShouldStop End (returning %i) vvvvvvvv",
-                should_stop);
+    LLDB_LOGF(log, "Plan stack final state:\n%s", s.GetData());
+    LLDB_LOGF(log, "vvvvvvvv Thread::ShouldStop End (returning %i) vvvvvvvv",
+              should_stop);
   }
   return should_stop;
 }
@@ -943,37 +936,36 @@ Vote Thread::ShouldReportStop(Event *eve
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
 
   if (thread_state == eStateSuspended || thread_state == eStateInvalid) {
-    if (log)
-      log->Printf("Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
-                  ": returning vote %i (state was suspended or invalid)",
-                  GetID(), eVoteNoOpinion);
+    LLDB_LOGF(log,
+              "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
+              ": returning vote %i (state was suspended or invalid)",
+              GetID(), eVoteNoOpinion);
     return eVoteNoOpinion;
   }
 
   if (temp_thread_state == eStateSuspended ||
       temp_thread_state == eStateInvalid) {
-    if (log)
-      log->Printf(
-          "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
-          ": returning vote %i (temporary state was suspended or invalid)",
-          GetID(), eVoteNoOpinion);
+    LLDB_LOGF(log,
+              "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
+              ": returning vote %i (temporary state was suspended or invalid)",
+              GetID(), eVoteNoOpinion);
     return eVoteNoOpinion;
   }
 
   if (!ThreadStoppedForAReason()) {
-    if (log)
-      log->Printf("Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
-                  ": returning vote %i (thread didn't stop for a reason.)",
-                  GetID(), eVoteNoOpinion);
+    LLDB_LOGF(log,
+              "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
+              ": returning vote %i (thread didn't stop for a reason.)",
+              GetID(), eVoteNoOpinion);
     return eVoteNoOpinion;
   }
 
   if (m_completed_plan_stack.size() > 0) {
     // Don't use GetCompletedPlan here, since that suppresses private plans.
-    if (log)
-      log->Printf("Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
-                  ": returning vote  for complete stack's back plan",
-                  GetID());
+    LLDB_LOGF(log,
+              "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
+              ": returning vote  for complete stack's back plan",
+              GetID());
     return m_completed_plan_stack.back()->ShouldReportStop(event_ptr);
   } else {
     Vote thread_vote = eVoteNoOpinion;
@@ -988,10 +980,10 @@ Vote Thread::ShouldReportStop(Event *eve
       else
         plan_ptr = GetPreviousPlan(plan_ptr);
     }
-    if (log)
-      log->Printf("Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
-                  ": returning vote %i for current plan",
-                  GetID(), thread_vote);
+    LLDB_LOGF(log,
+              "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64
+              ": returning vote %i for current plan",
+              GetID(), thread_vote);
 
     return thread_vote;
   }
@@ -1007,21 +999,21 @@ Vote Thread::ShouldReportRun(Event *even
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
   if (m_completed_plan_stack.size() > 0) {
     // Don't use GetCompletedPlan here, since that suppresses private plans.
-    if (log)
-      log->Printf("Current Plan for thread %d(%p) (0x%4.4" PRIx64
-                  ", %s): %s being asked whether we should report run.",
-                  GetIndexID(), static_cast<void *>(this), GetID(),
-                  StateAsCString(GetTemporaryResumeState()),
-                  m_completed_plan_stack.back()->GetName());
+    LLDB_LOGF(log,
+              "Current Plan for thread %d(%p) (0x%4.4" PRIx64
+              ", %s): %s being asked whether we should report run.",
+              GetIndexID(), static_cast<void *>(this), GetID(),
+              StateAsCString(GetTemporaryResumeState()),
+              m_completed_plan_stack.back()->GetName());
 
     return m_completed_plan_stack.back()->ShouldReportRun(event_ptr);
   } else {
-    if (log)
-      log->Printf("Current Plan for thread %d(%p) (0x%4.4" PRIx64
-                  ", %s): %s being asked whether we should report run.",
-                  GetIndexID(), static_cast<void *>(this), GetID(),
-                  StateAsCString(GetTemporaryResumeState()),
-                  GetCurrentPlan()->GetName());
+    LLDB_LOGF(log,
+              "Current Plan for thread %d(%p) (0x%4.4" PRIx64
+              ", %s): %s being asked whether we should report run.",
+              GetIndexID(), static_cast<void *>(this), GetID(),
+              StateAsCString(GetTemporaryResumeState()),
+              GetCurrentPlan()->GetName());
 
     return GetCurrentPlan()->ShouldReportRun(event_ptr);
   }
@@ -1048,9 +1040,9 @@ void Thread::PushPlan(ThreadPlanSP &thre
     if (log) {
       StreamString s;
       thread_plan_sp->GetDescription(&s, lldb::eDescriptionLevelFull);
-      log->Printf("Thread::PushPlan(0x%p): \"%s\", tid = 0x%4.4" PRIx64 ".",
-                  static_cast<void *>(this), s.GetData(),
-                  thread_plan_sp->GetThread().GetID());
+      LLDB_LOGF(log, "Thread::PushPlan(0x%p): \"%s\", tid = 0x%4.4" PRIx64 ".",
+                static_cast<void *>(this), s.GetData(),
+                thread_plan_sp->GetThread().GetID());
     }
   }
 }
@@ -1063,8 +1055,8 @@ void Thread::PopPlan() {
   else {
     ThreadPlanSP &plan = m_plan_stack.back();
     if (log) {
-      log->Printf("Popping plan: \"%s\", tid = 0x%4.4" PRIx64 ".",
-                  plan->GetName(), plan->GetThread().GetID());
+      LLDB_LOGF(log, "Popping plan: \"%s\", tid = 0x%4.4" PRIx64 ".",
+                plan->GetName(), plan->GetThread().GetID());
     }
     m_completed_plan_stack.push_back(plan);
     plan->WillPop();
@@ -1076,9 +1068,8 @@ void Thread::DiscardPlan() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
   if (m_plan_stack.size() > 1) {
     ThreadPlanSP &plan = m_plan_stack.back();
-    if (log)
-      log->Printf("Discarding plan: \"%s\", tid = 0x%4.4" PRIx64 ".",
-                  plan->GetName(), plan->GetThread().GetID());
+    LLDB_LOGF(log, "Discarding plan: \"%s\", tid = 0x%4.4" PRIx64 ".",
+              plan->GetName(), plan->GetThread().GetID());
 
     m_discarded_plan_stack.push_back(plan);
     plan->WillPop();
@@ -1252,10 +1243,10 @@ void Thread::DiscardThreadPlansUpToPlan(
 
 void Thread::DiscardThreadPlansUpToPlan(ThreadPlan *up_to_plan_ptr) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
-  if (log)
-    log->Printf("Discarding thread plans for thread tid = 0x%4.4" PRIx64
-                ", up to %p",
-                GetID(), static_cast<void *>(up_to_plan_ptr));
+  LLDB_LOGF(log,
+            "Discarding thread plans for thread tid = 0x%4.4" PRIx64
+            ", up to %p",
+            GetID(), static_cast<void *>(up_to_plan_ptr));
 
   int stack_size = m_plan_stack.size();
 
@@ -1285,9 +1276,10 @@ void Thread::DiscardThreadPlansUpToPlan(
 void Thread::DiscardThreadPlans(bool force) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
   if (log) {
-    log->Printf("Discarding thread plans for thread (tid = 0x%4.4" PRIx64
-                ", force %d)",
-                GetID(), force);
+    LLDB_LOGF(log,
+              "Discarding thread plans for thread (tid = 0x%4.4" PRIx64
+              ", force %d)",
+              GetID(), force);
   }
 
   if (force) {

Modified: lldb/trunk/source/Target/ThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadList.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadList.cpp (original)
+++ lldb/trunk/source/Target/ThreadList.cpp Wed Jul 24 10:56:10 2019
@@ -267,10 +267,11 @@ bool ThreadList::ShouldStop(Event *event
 
   if (log) {
     log->PutCString("");
-    log->Printf("ThreadList::%s: %" PRIu64 " threads, %" PRIu64
-                " unsuspended threads",
-                __FUNCTION__, (uint64_t)m_threads.size(),
-                (uint64_t)threads_copy.size());
+    LLDB_LOGF(log,
+              "ThreadList::%s: %" PRIu64 " threads, %" PRIu64
+              " unsuspended threads",
+              __FUNCTION__, (uint64_t)m_threads.size(),
+              (uint64_t)threads_copy.size());
   }
 
   bool did_anybody_stop_for_a_reason = false;
@@ -279,10 +280,9 @@ bool ThreadList::ShouldStop(Event *event
   // what.  Otherwise, presume we won't stop.
   bool should_stop = false;
   if (Process::ProcessEventData::GetInterruptedFromEvent(event_ptr)) {
-    if (log)
-      log->Printf(
-          "ThreadList::%s handling interrupt event, should stop set to true",
-          __FUNCTION__);
+    LLDB_LOGF(
+        log, "ThreadList::%s handling interrupt event, should stop set to true",
+        __FUNCTION__);
 
     should_stop = true;
   }
@@ -334,15 +334,14 @@ bool ThreadList::ShouldStop(Event *event
 
   if (!should_stop && !did_anybody_stop_for_a_reason) {
     should_stop = true;
-    if (log)
-      log->Printf("ThreadList::%s we stopped but no threads had a stop reason, "
-                  "overriding should_stop and stopping.",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "ThreadList::%s we stopped but no threads had a stop reason, "
+              "overriding should_stop and stopping.",
+              __FUNCTION__);
   }
 
-  if (log)
-    log->Printf("ThreadList::%s overall should_stop = %i", __FUNCTION__,
-                should_stop);
+  LLDB_LOGF(log, "ThreadList::%s overall should_stop = %i", __FUNCTION__,
+            should_stop);
 
   if (should_stop) {
     for (pos = threads_copy.begin(); pos != end; ++pos) {
@@ -363,9 +362,8 @@ Vote ThreadList::ShouldReportStop(Event
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
 
-  if (log)
-    log->Printf("ThreadList::%s %" PRIu64 " threads", __FUNCTION__,
-                (uint64_t)m_threads.size());
+  LLDB_LOGF(log, "ThreadList::%s %" PRIu64 " threads", __FUNCTION__,
+            (uint64_t)m_threads.size());
 
   // Run through the threads and ask whether we should report this event. For
   // stopping, a YES vote wins over everything.  A NO vote wins over NO
@@ -430,10 +428,10 @@ Vote ThreadList::ShouldReportRun(Event *
           result = eVoteYes;
         break;
       case eVoteNo:
-        if (log)
-          log->Printf("ThreadList::ShouldReportRun() thread %d (0x%4.4" PRIx64
-                      ") says don't report.",
-                      (*pos)->GetIndexID(), (*pos)->GetID());
+        LLDB_LOGF(log,
+                  "ThreadList::ShouldReportRun() thread %d (0x%4.4" PRIx64
+                  ") says don't report.",
+                  (*pos)->GetIndexID(), (*pos)->GetID());
         result = eVoteNo;
         break;
       }
@@ -464,8 +462,9 @@ void ThreadList::RefreshStateAfterStop()
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
   if (log && log->GetVerbose())
-    log->Printf("Turning off notification of new threads while single stepping "
-                "a thread.");
+    LLDB_LOGF(log,
+              "Turning off notification of new threads while single stepping "
+              "a thread.");
 
   collection::iterator pos, end = m_threads.end();
   for (pos = m_threads.begin(); pos != end; ++pos)
@@ -517,14 +516,14 @@ bool ThreadList::WillResume() {
   if (wants_solo_run) {
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
     if (log && log->GetVerbose())
-      log->Printf("Turning on notification of new threads while single "
-                  "stepping a thread.");
+      LLDB_LOGF(log, "Turning on notification of new threads while single "
+                     "stepping a thread.");
     m_process->StartNoticingNewThreads();
   } else {
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
     if (log && log->GetVerbose())
-      log->Printf("Turning off notification of new threads while single "
-                  "stepping a thread.");
+      LLDB_LOGF(log, "Turning off notification of new threads while single "
+                     "stepping a thread.");
     m_process->StopNoticingNewThreads();
   }
 

Modified: lldb/trunk/source/Target/ThreadPlan.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlan.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlan.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlan.cpp Wed Jul 24 10:56:10 2019
@@ -108,7 +108,8 @@ bool ThreadPlan::WillResume(StateType re
       addr_t pc = reg_ctx->GetPC();
       addr_t sp = reg_ctx->GetSP();
       addr_t fp = reg_ctx->GetFP();
-      log->Printf(
+      LLDB_LOGF(
+          log,
           "%s Thread #%u (0x%p): tid = 0x%4.4" PRIx64 ", pc = 0x%8.8" PRIx64
           ", sp = 0x%8.8" PRIx64 ", fp = 0x%8.8" PRIx64 ", "
           "plan = '%s', state = %s, stop others = %d",

Modified: lldb/trunk/source/Target/ThreadPlanBase.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanBase.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanBase.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanBase.cpp Wed Jul 24 10:56:10 2019
@@ -92,11 +92,11 @@ bool ThreadPlanBase::ShouldStop(Event *e
         // If we are going to stop for a breakpoint, then unship the other
         // plans at this point.  Don't force the discard, however, so Master
         // plans can stay in place if they want to.
-        if (log)
-          log->Printf(
-              "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64
-              " (breakpoint hit.)",
-              m_thread.GetID());
+        LLDB_LOGF(
+            log,
+            "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64
+            " (breakpoint hit.)",
+            m_thread.GetID());
         m_thread.DiscardThreadPlans(false);
         return true;
       }
@@ -122,11 +122,11 @@ bool ThreadPlanBase::ShouldStop(Event *e
       // If we crashed, discard thread plans and stop.  Don't force the
       // discard, however, since on rerun the target may clean up this
       // exception and continue normally from there.
-      if (log)
-        log->Printf(
-            "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64
-            " (exception: %s)",
-            m_thread.GetID(), stop_info_sp->GetDescription());
+      LLDB_LOGF(
+          log,
+          "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64
+          " (exception: %s)",
+          m_thread.GetID(), stop_info_sp->GetDescription());
       m_thread.DiscardThreadPlans(false);
       return true;
 
@@ -134,22 +134,22 @@ bool ThreadPlanBase::ShouldStop(Event *e
       // If we crashed, discard thread plans and stop.  Don't force the
       // discard, however, since on rerun the target may clean up this
       // exception and continue normally from there.
-      if (log)
-        log->Printf(
-            "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64
-            " (exec.)",
-            m_thread.GetID());
+      LLDB_LOGF(
+          log,
+          "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64
+          " (exec.)",
+          m_thread.GetID());
       m_thread.DiscardThreadPlans(false);
       return true;
 
     case eStopReasonThreadExiting:
     case eStopReasonSignal:
       if (stop_info_sp->ShouldStop(event_ptr)) {
-        if (log)
-          log->Printf(
-              "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64
-              " (signal: %s)",
-              m_thread.GetID(), stop_info_sp->GetDescription());
+        LLDB_LOGF(
+            log,
+            "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64
+            " (signal: %s)",
+            m_thread.GetID(), stop_info_sp->GetDescription());
         m_thread.DiscardThreadPlans(false);
         return true;
       } else {

Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Wed Jul 24 10:56:10 2019
@@ -59,9 +59,8 @@ bool ThreadPlanCallFunction::Constructor
     m_constructor_errors.Printf(
         "Trying to put the stack in unreadable memory at: 0x%" PRIx64 ".",
         m_function_sp);
-    if (log)
-      log->Printf("ThreadPlanCallFunction(%p): %s.", static_cast<void *>(this),
-                  m_constructor_errors.GetData());
+    LLDB_LOGF(log, "ThreadPlanCallFunction(%p): %s.", static_cast<void *>(this),
+              m_constructor_errors.GetData());
     return false;
   }
 
@@ -69,9 +68,8 @@ bool ThreadPlanCallFunction::Constructor
   if (!start_address) {
     m_constructor_errors.Printf(
         "%s", llvm::toString(start_address.takeError()).c_str());
-    if (log)
-      log->Printf("ThreadPlanCallFunction(%p): %s.", static_cast<void *>(this),
-                  m_constructor_errors.GetData());
+    LLDB_LOGF(log, "ThreadPlanCallFunction(%p): %s.", static_cast<void *>(this),
+              m_constructor_errors.GetData());
     return false;
   }
 
@@ -86,9 +84,8 @@ bool ThreadPlanCallFunction::Constructor
   if (!thread.CheckpointThreadState(m_stored_thread_state)) {
     m_constructor_errors.Printf("Setting up ThreadPlanCallFunction, failed to "
                                 "checkpoint thread state.");
-    if (log)
-      log->Printf("ThreadPlanCallFunction(%p): %s.", static_cast<void *>(this),
-                  m_constructor_errors.GetData());
+    LLDB_LOGF(log, "ThreadPlanCallFunction(%p): %s.", static_cast<void *>(this),
+              m_constructor_errors.GetData());
     return false;
   }
   function_load_addr = m_function_addr.GetLoadAddress(&GetTarget());
@@ -173,10 +170,10 @@ void ThreadPlanCallFunction::DoTakedown(
 
   if (!m_valid) {
     // Don't call DoTakedown if we were never valid to begin with.
-    if (log)
-      log->Printf("ThreadPlanCallFunction(%p): Log called on "
-                  "ThreadPlanCallFunction that was never valid.",
-                  static_cast<void *>(this));
+    LLDB_LOGF(log,
+              "ThreadPlanCallFunction(%p): Log called on "
+              "ThreadPlanCallFunction that was never valid.",
+              static_cast<void *>(this));
     return;
   }
 
@@ -184,20 +181,20 @@ void ThreadPlanCallFunction::DoTakedown(
     if (success) {
       SetReturnValue();
     }
-    if (log)
-      log->Printf("ThreadPlanCallFunction(%p): DoTakedown called for thread "
-                  "0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n",
-                  static_cast<void *>(this), m_thread.GetID(), m_valid,
-                  IsPlanComplete());
+    LLDB_LOGF(log,
+              "ThreadPlanCallFunction(%p): DoTakedown called for thread "
+              "0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n",
+              static_cast<void *>(this), m_thread.GetID(), m_valid,
+              IsPlanComplete());
     m_takedown_done = true;
     m_stop_address =
         m_thread.GetStackFrameAtIndex(0)->GetRegisterContext()->GetPC();
     m_real_stop_info_sp = GetPrivateStopInfo();
     if (!m_thread.RestoreRegisterStateFromCheckpoint(m_stored_thread_state)) {
-      if (log)
-        log->Printf("ThreadPlanCallFunction(%p): DoTakedown failed to restore "
-                    "register state",
-                    static_cast<void *>(this));
+      LLDB_LOGF(log,
+                "ThreadPlanCallFunction(%p): DoTakedown failed to restore "
+                "register state",
+                static_cast<void *>(this));
     }
     SetPlanComplete(success);
     ClearBreakpoints();
@@ -205,11 +202,11 @@ void ThreadPlanCallFunction::DoTakedown(
       ReportRegisterState("Restoring thread state after function call.  "
                           "Restored register state:");
   } else {
-    if (log)
-      log->Printf("ThreadPlanCallFunction(%p): DoTakedown called as no-op for "
-                  "thread 0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n",
-                  static_cast<void *>(this), m_thread.GetID(), m_valid,
-                  IsPlanComplete());
+    LLDB_LOGF(log,
+              "ThreadPlanCallFunction(%p): DoTakedown called as no-op for "
+              "thread 0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n",
+              static_cast<void *>(this), m_thread.GetID(), m_valid,
+              IsPlanComplete());
   }
 }
 
@@ -265,10 +262,9 @@ bool ThreadPlanCallFunction::DoPlanExpla
     stop_reason = eStopReasonNone;
   else
     stop_reason = m_real_stop_info_sp->GetStopReason();
-  if (log)
-    log->Printf(
-        "ThreadPlanCallFunction::PlanExplainsStop: Got stop reason - %s.",
-        Thread::StopReasonAsCString(stop_reason));
+  LLDB_LOGF(log,
+            "ThreadPlanCallFunction::PlanExplainsStop: Got stop reason - %s.",
+            Thread::StopReasonAsCString(stop_reason));
 
   if (stop_reason == eStopReasonBreakpoint && BreakpointsExplainStop())
     return true;
@@ -277,9 +273,8 @@ bool ThreadPlanCallFunction::DoPlanExpla
   // then we should not consider ourselves complete.  Return true to
   // acknowledge the stop.
   if (Process::ProcessEventData::GetInterruptedFromEvent(event_ptr)) {
-    if (log)
-      log->Printf("ThreadPlanCallFunction::PlanExplainsStop: The event is an "
-                  "Interrupt, returning true.");
+    LLDB_LOGF(log, "ThreadPlanCallFunction::PlanExplainsStop: The event is an "
+                   "Interrupt, returning true.");
     return true;
   }
   // We control breakpoints separately from other "stop reasons."  So first,
@@ -298,10 +293,10 @@ bool ThreadPlanCallFunction::DoPlanExpla
       bool is_internal = true;
       for (uint32_t i = 0; i < num_owners; i++) {
         Breakpoint &bp = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint();
-        if (log)
-          log->Printf("ThreadPlanCallFunction::PlanExplainsStop: hit "
-                      "breakpoint %d while calling function",
-                      bp.GetID());
+        LLDB_LOGF(log,
+                  "ThreadPlanCallFunction::PlanExplainsStop: hit "
+                  "breakpoint %d while calling function",
+                  bp.GetID());
 
         if (!bp.IsInternal()) {
           is_internal = false;
@@ -309,25 +304,23 @@ bool ThreadPlanCallFunction::DoPlanExpla
         }
       }
       if (is_internal) {
-        if (log)
-          log->Printf("ThreadPlanCallFunction::PlanExplainsStop hit an "
-                      "internal breakpoint, not stopping.");
+        LLDB_LOGF(log, "ThreadPlanCallFunction::PlanExplainsStop hit an "
+                       "internal breakpoint, not stopping.");
         return false;
       }
     }
 
     if (m_ignore_breakpoints) {
-      if (log)
-        log->Printf("ThreadPlanCallFunction::PlanExplainsStop: we are ignoring "
-                    "breakpoints, overriding breakpoint stop info ShouldStop, "
-                    "returning true");
+      LLDB_LOGF(log,
+                "ThreadPlanCallFunction::PlanExplainsStop: we are ignoring "
+                "breakpoints, overriding breakpoint stop info ShouldStop, "
+                "returning true");
       m_real_stop_info_sp->OverrideShouldStop(false);
       return true;
     } else {
-      if (log)
-        log->Printf("ThreadPlanCallFunction::PlanExplainsStop: we are not "
-                    "ignoring breakpoints, overriding breakpoint stop info "
-                    "ShouldStop, returning true");
+      LLDB_LOGF(log, "ThreadPlanCallFunction::PlanExplainsStop: we are not "
+                     "ignoring breakpoints, overriding breakpoint stop info "
+                     "ShouldStop, returning true");
       m_real_stop_info_sp->OverrideShouldStop(true);
       return false;
     }
@@ -395,9 +388,8 @@ bool ThreadPlanCallFunction::MischiefMan
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
 
   if (IsPlanComplete()) {
-    if (log)
-      log->Printf("ThreadPlanCallFunction(%p): Completed call function plan.",
-                  static_cast<void *>(this));
+    LLDB_LOGF(log, "ThreadPlanCallFunction(%p): Completed call function plan.",
+              static_cast<void *>(this));
 
     ThreadPlan::MischiefManaged();
     return true;
@@ -446,9 +438,8 @@ bool ThreadPlanCallFunction::Breakpoints
          m_objc_language_runtime->ExceptionBreakpointsExplainStop(
              stop_info_sp))) {
       Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP));
-      if (log)
-        log->Printf("ThreadPlanCallFunction::BreakpointsExplainStop - Hit an "
-                    "exception breakpoint, setting plan complete.");
+      LLDB_LOGF(log, "ThreadPlanCallFunction::BreakpointsExplainStop - Hit an "
+                     "exception breakpoint, setting plan complete.");
 
       SetPlanComplete(false);
 

Modified: lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp Wed Jul 24 10:56:10 2019
@@ -69,9 +69,8 @@ bool ThreadPlanCallUserExpression::Misch
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
 
   if (IsPlanComplete()) {
-    if (log)
-      log->Printf("ThreadPlanCallFunction(%p): Completed call function plan.",
-                  static_cast<void *>(this));
+    LLDB_LOGF(log, "ThreadPlanCallFunction(%p): Completed call function plan.",
+              static_cast<void *>(this));
 
     if (m_manage_materialization && PlanSucceeded() && m_user_expression_sp) {
       lldb::addr_t function_stack_top;

Modified: lldb/trunk/source/Target/ThreadPlanPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanPython.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanPython.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanPython.cpp Wed Jul 24 10:56:10 2019
@@ -70,9 +70,8 @@ void ThreadPlanPython::DidPush() {
 
 bool ThreadPlanPython::ShouldStop(Event *event_ptr) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
-  if (log)
-    log->Printf("%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
-                m_class_name.c_str());
+  LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
+            m_class_name.c_str());
 
   bool should_stop = true;
   if (m_implementation_sp) {
@@ -93,9 +92,8 @@ bool ThreadPlanPython::ShouldStop(Event
 
 bool ThreadPlanPython::IsPlanStale() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
-  if (log)
-    log->Printf("%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
-                m_class_name.c_str());
+  LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
+            m_class_name.c_str());
 
   bool is_stale = true;
   if (m_implementation_sp) {
@@ -116,9 +114,8 @@ bool ThreadPlanPython::IsPlanStale() {
 
 bool ThreadPlanPython::DoPlanExplainsStop(Event *event_ptr) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
-  if (log)
-    log->Printf("%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
-                m_class_name.c_str());
+  LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
+            m_class_name.c_str());
 
   bool explains_stop = true;
   if (m_implementation_sp) {
@@ -139,9 +136,8 @@ bool ThreadPlanPython::DoPlanExplainsSto
 
 bool ThreadPlanPython::MischiefManaged() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
-  if (log)
-    log->Printf("%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
-                m_class_name.c_str());
+  LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
+            m_class_name.c_str());
   bool mischief_managed = true;
   if (m_implementation_sp) {
     // I don't really need mischief_managed, since it's simpler to just call
@@ -155,9 +151,8 @@ bool ThreadPlanPython::MischiefManaged()
 
 lldb::StateType ThreadPlanPython::GetPlanRunState() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
-  if (log)
-    log->Printf("%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
-                m_class_name.c_str());
+  LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
+            m_class_name.c_str());
   lldb::StateType run_state = eStateRunning;
   if (m_implementation_sp) {
     ScriptInterpreter *script_interp = m_thread.GetProcess()
@@ -188,8 +183,7 @@ void ThreadPlanPython::GetDescription(St
 
 bool ThreadPlanPython::WillStop() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
-  if (log)
-    log->Printf("%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
-                m_class_name.c_str());
+  LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
+            m_class_name.c_str());
   return true;
 }

Modified: lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp Wed Jul 24 10:56:10 2019
@@ -182,8 +182,7 @@ bool ThreadPlanRunToAddress::MischiefMan
         m_break_ids[i] = LLDB_INVALID_BREAK_ID;
       }
     }
-    if (log)
-      log->Printf("Completed run to address plan.");
+    LLDB_LOGF(log, "Completed run to address plan.");
     ThreadPlan::MischiefManaged();
     return true;
   } else

Modified: lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp Wed Jul 24 10:56:10 2019
@@ -46,8 +46,8 @@ bool ThreadPlanShouldStopHere::InvokeSho
       lldb::addr_t current_addr =
           m_owner->GetThread().GetRegisterContext()->GetPC(0);
 
-      log->Printf("ShouldStopHere callback returned %u from 0x%" PRIx64 ".",
-                  should_stop_here, current_addr);
+      LLDB_LOGF(log, "ShouldStopHere callback returned %u from 0x%" PRIx64 ".",
+                should_stop_here, current_addr);
     }
   }
 
@@ -69,8 +69,7 @@ bool ThreadPlanShouldStopHere::DefaultSh
       (operation == eFrameCompareSameParent &&
        flags.Test(eStepInAvoidNoDebug))) {
     if (!frame->HasDebugInformation()) {
-      if (log)
-        log->Printf("Stepping out of frame with no debug info");
+      LLDB_LOGF(log, "Stepping out of frame with no debug info");
 
       should_stop_here = false;
     }
@@ -118,16 +117,14 @@ ThreadPlanSP ThreadPlanShouldStopHere::D
       symbol_end.Slide(sc.symbol->GetByteSize() - 1);
       if (range.ContainsFileAddress(sc.symbol->GetAddress()) &&
           range.ContainsFileAddress(symbol_end)) {
-        if (log)
-          log->Printf("Stopped in a function with only line 0 lines, just "
-                      "stepping out.");
+        LLDB_LOGF(log, "Stopped in a function with only line 0 lines, just "
+                       "stepping out.");
         just_step_out = true;
       }
     }
     if (!just_step_out) {
-      if (log)
-        log->Printf("ThreadPlanShouldStopHere::DefaultStepFromHereCallback "
-                    "Queueing StepInRange plan to step through line 0 code.");
+      LLDB_LOGF(log, "ThreadPlanShouldStopHere::DefaultStepFromHereCallback "
+                     "Queueing StepInRange plan to step through line 0 code.");
 
       return_plan_sp = current_plan->GetThread().QueueThreadPlanForStepInRange(
           false, range, sc, nullptr, eOnlyDuringStepping, status,

Modified: lldb/trunk/source/Target/ThreadPlanStepInRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInRange.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepInRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepInRange.cpp Wed Jul 24 10:56:10 2019
@@ -148,7 +148,7 @@ bool ThreadPlanStepInRange::ShouldStop(E
     s.Address(
         m_thread.GetRegisterContext()->GetPC(),
         m_thread.CalculateTarget()->GetArchitecture().GetAddressByteSize());
-    log->Printf("ThreadPlanStepInRange reached %s.", s.GetData());
+    LLDB_LOGF(log, "ThreadPlanStepInRange reached %s.", s.GetData());
   }
 
   if (IsPlanComplete())
@@ -197,13 +197,14 @@ bool ThreadPlanStepInRange::ShouldStop(E
             CheckShouldStopHereAndQueueStepOut(frame_order, m_status);
         if (log) {
           if (m_sub_plan_sp)
-            log->Printf("ShouldStopHere found plan to step out of this frame.");
+            LLDB_LOGF(log,
+                      "ShouldStopHere found plan to step out of this frame.");
           else
-            log->Printf("ShouldStopHere no plan to step out of this frame.");
+            LLDB_LOGF(log, "ShouldStopHere no plan to step out of this frame.");
         }
       } else if (log) {
-        log->Printf(
-            "Thought I stepped out, but in fact arrived at a trampoline.");
+        LLDB_LOGF(
+            log, "Thought I stepped out, but in fact arrived at a trampoline.");
       }
     } else if (frame_order == eFrameCompareEqual && InSymbol()) {
       // If we are not in a place we should step through, we're done. One
@@ -237,9 +238,10 @@ bool ThreadPlanStepInRange::ShouldStop(E
 
     if (log) {
       if (m_sub_plan_sp)
-        log->Printf("Found a step through plan: %s", m_sub_plan_sp->GetName());
+        LLDB_LOGF(log, "Found a step through plan: %s",
+                  m_sub_plan_sp->GetName());
       else
-        log->Printf("No step through plan found.");
+        LLDB_LOGF(log, "No step through plan found.");
     }
 
     // If not, give the "should_stop" callback a chance to push a plan to get
@@ -289,8 +291,7 @@ bool ThreadPlanStepInRange::ShouldStop(E
         if (bytes_to_skip != 0) {
           func_start_address.Slide(bytes_to_skip);
           log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP);
-          if (log)
-            log->Printf("Pushing past prologue ");
+          LLDB_LOGF(log, "Pushing past prologue ");
 
           m_sub_plan_sp = m_thread.QueueThreadPlanForRunToAddress(
               false, func_start_address, true, m_status);
@@ -373,11 +374,12 @@ bool ThreadPlanStepInRange::FrameMatches
           if (log) {
             std::string match;
             regex_match.GetMatchAtIndex(frame_function_name, 0, match);
-            log->Printf("Stepping out of function \"%s\" because it matches "
-                        "the avoid regexp \"%s\" - match substring: \"%s\".",
-                        frame_function_name,
-                        avoid_regexp_to_use->GetText().str().c_str(),
-                        match.c_str());
+            LLDB_LOGF(log,
+                      "Stepping out of function \"%s\" because it matches "
+                      "the avoid regexp \"%s\" - match substring: \"%s\".",
+                      frame_function_name,
+                      avoid_regexp_to_use->GetText().str().c_str(),
+                      match.c_str());
           }
         }
         return return_value;
@@ -424,10 +426,11 @@ bool ThreadPlanStepInRange::DefaultShoul
             should_stop_here = false;
         }
         if (log && !should_stop_here)
-          log->Printf("Stepping out of frame %s which did not match step into "
-                      "target %s.",
-                      sc.GetFunctionName().AsCString(),
-                      step_in_range_plan->m_step_into_target.AsCString());
+          LLDB_LOGF(log,
+                    "Stepping out of frame %s which did not match step into "
+                    "target %s.",
+                    sc.GetFunctionName().AsCString(),
+                    step_in_range_plan->m_step_into_target.AsCString());
       }
     }
 
@@ -496,10 +499,10 @@ bool ThreadPlanStepInRange::DoWillResume
     bool step_without_resume = m_thread.DecrementCurrentInlinedDepth();
     if (step_without_resume) {
       Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
-      if (log)
-        log->Printf("ThreadPlanStepInRange::DoWillResume: returning false, "
-                    "inline_depth: %d",
-                    m_thread.GetCurrentInlinedDepth());
+      LLDB_LOGF(log,
+                "ThreadPlanStepInRange::DoWillResume: returning false, "
+                "inline_depth: %d",
+                m_thread.GetCurrentInlinedDepth());
       SetStopInfo(StopInfo::CreateStopReasonToTrace(m_thread));
 
       // FIXME: Maybe it would be better to create a InlineStep stop reason, but

Modified: lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp Wed Jul 24 10:56:10 2019
@@ -114,8 +114,9 @@ bool ThreadPlanStepInstruction::IsPlanSt
     return !m_step_over;
   } else {
     if (log) {
-      log->Printf("ThreadPlanStepInstruction::IsPlanStale - Current frame is "
-                  "older than start frame, plan is stale.");
+      LLDB_LOGF(log,
+                "ThreadPlanStepInstruction::IsPlanStale - Current frame is "
+                "older than start frame, plan is stale.");
     }
     return true;
   }
@@ -127,9 +128,9 @@ bool ThreadPlanStepInstruction::ShouldSt
 
     StackFrameSP cur_frame_sp = m_thread.GetStackFrameAtIndex(0);
     if (!cur_frame_sp) {
-      if (log)
-        log->Printf(
-            "ThreadPlanStepInstruction couldn't get the 0th frame, stopping.");
+      LLDB_LOGF(
+          log,
+          "ThreadPlanStepInstruction couldn't get the 0th frame, stopping.");
       SetPlanComplete();
       return true;
     }
@@ -168,8 +169,9 @@ bool ThreadPlanStepInstruction::ShouldSt
                     cur_frame_sp->GetConcreteFrameIndex()) {
               SetPlanComplete();
               if (log) {
-                log->Printf("Frame we stepped into is inlined into the frame "
-                            "we were stepping from, stopping.");
+                LLDB_LOGF(log,
+                          "Frame we stepped into is inlined into the frame "
+                          "we were stepping from, stopping.");
               }
               return true;
             }
@@ -188,7 +190,7 @@ bool ThreadPlanStepInstruction::ShouldSt
             s.Address(return_addr, m_thread.CalculateTarget()
                                        ->GetArchitecture()
                                        .GetAddressByteSize());
-            log->Printf("%s.", s.GetData());
+            LLDB_LOGF(log, "%s.", s.GetData());
           }
 
           // StepInstruction should probably have the tri-state RunMode, but
@@ -209,8 +211,7 @@ bool ThreadPlanStepInstruction::ShouldSt
           return true;
         }
       } else {
-        if (log)
-          log->Printf("Could not find previous frame, stopping.");
+        LLDB_LOGF(log, "Could not find previous frame, stopping.");
         SetPlanComplete();
         return true;
       }
@@ -243,8 +244,7 @@ bool ThreadPlanStepInstruction::WillStop
 bool ThreadPlanStepInstruction::MischiefManaged() {
   if (IsPlanComplete()) {
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
-    if (log)
-      log->Printf("Completed single instruction step plan.");
+    LLDB_LOGF(log, "Completed single instruction step plan.");
     ThreadPlan::MischiefManaged();
     return true;
   } else {

Modified: lldb/trunk/source/Target/ThreadPlanStepOut.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOut.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepOut.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepOut.cpp Wed Jul 24 10:56:10 2019
@@ -408,7 +408,7 @@ bool ThreadPlanStepOut::MischiefManaged(
 
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
     if (log)
-      log->Printf("Completed step out plan.");
+      LLDB_LOGF(log, "Completed step out plan.");
     if (m_return_bp_id != LLDB_INVALID_BREAK_ID) {
       m_thread.CalculateTarget()->RemoveBreakpointByID(m_return_bp_id);
       m_return_bp_id = LLDB_INVALID_BREAK_ID;
@@ -433,7 +433,7 @@ bool ThreadPlanStepOut::QueueInlinedStep
   if (log) {
     StreamString s;
     immediate_return_from_sp->Dump(&s, true, false);
-    log->Printf("Queuing inlined frame to step past: %s.", s.GetData());
+    LLDB_LOGF(log, "Queuing inlined frame to step past: %s.", s.GetData());
   }
 
   Block *from_block = immediate_return_from_sp->GetFrameBlock();

Modified: lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp Wed Jul 24 10:56:10 2019
@@ -62,11 +62,9 @@ bool ThreadPlanStepOverBreakpoint::DoPla
     StopReason reason = stop_info_sp->GetStopReason();
 
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
+    LLDB_LOGF(log, "Step over breakpoint stopped for reason: %s.",
+              Thread::StopReasonAsCString(reason));
 
-    if (log)
-      log->Printf("Step over breakpoint stopped for reason: %s.", 
-          Thread::StopReasonAsCString(reason));
-  
     switch (reason) {
       case eStopReasonTrace:
       case eStopReasonNone:
@@ -91,9 +89,10 @@ bool ThreadPlanStepOverBreakpoint::DoPla
         lldb::addr_t pc_addr = m_thread.GetRegisterContext()->GetPC();
 
         if (pc_addr == m_breakpoint_addr) {
-          if (log)
-            log->Printf("Got breakpoint stop reason but pc: 0x%" PRIx64
-                        "hasn't changed.", pc_addr);
+          LLDB_LOGF(log,
+                    "Got breakpoint stop reason but pc: 0x%" PRIx64
+                    "hasn't changed.",
+                    pc_addr);
           return true;
         }
 
@@ -149,8 +148,7 @@ bool ThreadPlanStepOverBreakpoint::Misch
     return false;
   } else {
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
-    if (log)
-      log->Printf("Completed step over breakpoint plan.");
+    LLDB_LOGF(log, "Completed step over breakpoint plan.");
     // Otherwise, re-enable the breakpoint we were stepping over, and we're
     // done.
     ReenableBreakpointSite();

Modified: lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp Wed Jul 24 10:56:10 2019
@@ -131,7 +131,7 @@ bool ThreadPlanStepOverRange::ShouldStop
     s.Address(
         m_thread.GetRegisterContext()->GetPC(),
         m_thread.CalculateTarget()->GetArchitecture().GetAddressByteSize());
-    log->Printf("ThreadPlanStepOverRange reached %s.", s.GetData());
+    LLDB_LOGF(log, "ThreadPlanStepOverRange reached %s.", s.GetData());
   }
 
   // If we're out of the range but in the same frame or in our caller's frame
@@ -155,8 +155,8 @@ bool ThreadPlanStepOverRange::ShouldStop
                                                          stop_others, m_status);
 
     if (new_plan_sp && log)
-      log->Printf(
-          "Thought I stepped out, but in fact arrived at a trampoline.");
+      LLDB_LOGF(log,
+                "Thought I stepped out, but in fact arrived at a trampoline.");
   } else if (frame_order == eFrameCompareYounger) {
     // Make sure we really are in a new frame.  Do that by unwinding and seeing
     // if the start function really is our start function...
@@ -371,10 +371,10 @@ bool ThreadPlanStepOverRange::DoWillResu
       bool in_inlined_stack = m_thread.DecrementCurrentInlinedDepth();
       if (in_inlined_stack) {
         Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
-        if (log)
-          log->Printf("ThreadPlanStepInRange::DoWillResume: adjusting range to "
-                      "the frame at inlined depth %d.",
-                      m_thread.GetCurrentInlinedDepth());
+        LLDB_LOGF(log,
+                  "ThreadPlanStepInRange::DoWillResume: adjusting range to "
+                  "the frame at inlined depth %d.",
+                  m_thread.GetCurrentInlinedDepth());
         StackFrameSP stack_sp = m_thread.GetStackFrameAtIndex(0);
         if (stack_sp) {
           Block *frame_block = stack_sp->GetFrameBlock();

Modified: lldb/trunk/source/Target/ThreadPlanStepRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepRange.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepRange.cpp Wed Jul 24 10:56:10 2019
@@ -68,9 +68,8 @@ Vote ThreadPlanStepRange::ShouldReportSt
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
 
   const Vote vote = IsPlanComplete() ? eVoteYes : eVoteNo;
-  if (log)
-    log->Printf("ThreadPlanStepRange::ShouldReportStop() returning vote %i\n",
-                vote);
+  LLDB_LOGF(log, "ThreadPlanStepRange::ShouldReportStop() returning vote %i\n",
+            vote);
   return vote;
 }
 
@@ -137,7 +136,8 @@ bool ThreadPlanStepRange::InRange() {
                                            true, Address::DumpStyleLoadAddress,
                                            Address::DumpStyleLoadAddress, true);
 
-            log->Printf(
+            LLDB_LOGF(
+                log,
                 "Step range plan stepped to another range of same line: %s",
                 s.GetData());
           }
@@ -155,9 +155,10 @@ bool ThreadPlanStepRange::InRange() {
                                            true, Address::DumpStyleLoadAddress,
                                            Address::DumpStyleLoadAddress, true);
 
-            log->Printf("Step range plan stepped to a range at linenumber 0 "
-                        "stepping through that range: %s",
-                        s.GetData());
+            LLDB_LOGF(log,
+                      "Step range plan stepped to a range at linenumber 0 "
+                      "stepping through that range: %s",
+                      s.GetData());
           }
         } else if (new_context.line_entry.range.GetBaseAddress().GetLoadAddress(
                        m_thread.CalculateTarget().get()) != pc_load_addr) {
@@ -177,9 +178,10 @@ bool ThreadPlanStepRange::InRange() {
                                            true, Address::DumpStyleLoadAddress,
                                            Address::DumpStyleLoadAddress, true);
 
-            log->Printf("Step range plan stepped to the middle of new "
-                        "line(%d): %s, continuing to clear this line.",
-                        new_context.line_entry.line, s.GetData());
+            LLDB_LOGF(log,
+                      "Step range plan stepped to the middle of new "
+                      "line(%d): %s, continuing to clear this line.",
+                      new_context.line_entry.line, s.GetData());
           }
         }
       }
@@ -187,7 +189,7 @@ bool ThreadPlanStepRange::InRange() {
   }
 
   if (!ret_value && log)
-    log->Printf("Step range plan out of range to 0x%" PRIx64, pc_load_addr);
+    LLDB_LOGF(log, "Step range plan out of range to 0x%" PRIx64, pc_load_addr);
 
   return ret_value;
 }
@@ -285,9 +287,8 @@ InstructionList *ThreadPlanStepRange::Ge
 void ThreadPlanStepRange::ClearNextBranchBreakpoint() {
   if (m_next_branch_bp_sp) {
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
-    if (log)
-      log->Printf("Removing next branch breakpoint: %d.",
-                  m_next_branch_bp_sp->GetID());
+    LLDB_LOGF(log, "Removing next branch breakpoint: %d.",
+              m_next_branch_bp_sp->GetID());
     GetTarget().RemoveBreakpointByID(m_next_branch_bp_sp->GetID());
     m_next_branch_bp_sp.reset();
     m_could_not_resolve_hw_bp = false;
@@ -357,11 +358,12 @@ bool ThreadPlanStepRange::SetNextBranchB
               bp_site_id = bp_site->GetID();
             }
           }
-          log->Printf("ThreadPlanStepRange::SetNextBranchBreakpoint - Setting "
-                      "breakpoint %d (site %d) to run to address 0x%" PRIx64,
-                      m_next_branch_bp_sp->GetID(), bp_site_id,
-                      run_to_address.GetLoadAddress(
-                          &m_thread.GetProcess()->GetTarget()));
+          LLDB_LOGF(log,
+                    "ThreadPlanStepRange::SetNextBranchBreakpoint - Setting "
+                    "breakpoint %d (site %d) to run to address 0x%" PRIx64,
+                    m_next_branch_bp_sp->GetID(), bp_site_id,
+                    run_to_address.GetLoadAddress(
+                        &m_thread.GetProcess()->GetTarget()));
         }
 
         m_next_branch_bp_sp->SetThreadID(m_thread.GetID());
@@ -402,11 +404,11 @@ bool ThreadPlanStepRange::NextRangeBreak
         break;
       }
     }
-    if (log)
-      log->Printf("ThreadPlanStepRange::NextRangeBreakpointExplainsStop - Hit "
-                  "next range breakpoint which has %" PRIu64
-                  " owners - explains stop: %u.",
-                  (uint64_t)num_owners, explains_stop);
+    LLDB_LOGF(log,
+              "ThreadPlanStepRange::NextRangeBreakpointExplainsStop - Hit "
+              "next range breakpoint which has %" PRIu64
+              " owners - explains stop: %u.",
+              (uint64_t)num_owners, explains_stop);
     ClearNextBranchBreakpoint();
     return explains_stop;
   }
@@ -445,8 +447,7 @@ bool ThreadPlanStepRange::MischiefManage
 
   if (done) {
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
-    if (log)
-      log->Printf("Completed step through range plan.");
+    LLDB_LOGF(log, "Completed step through range plan.");
     ClearNextBranchBreakpoint();
     ThreadPlan::MischiefManaged();
     return true;
@@ -461,8 +462,8 @@ bool ThreadPlanStepRange::IsPlanStale()
 
   if (frame_order == eFrameCompareOlder) {
     if (log) {
-      log->Printf("ThreadPlanStepRange::IsPlanStale returning true, we've "
-                  "stepped out.");
+      LLDB_LOGF(log, "ThreadPlanStepRange::IsPlanStale returning true, we've "
+                     "stepped out.");
     }
     return true;
   } else if (frame_order == eFrameCompareEqual && InSymbol()) {

Modified: lldb/trunk/source/Target/ThreadPlanStepThrough.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepThrough.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepThrough.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepThrough.cpp Wed Jul 24 10:56:10 2019
@@ -64,8 +64,8 @@ ThreadPlanStepThrough::ThreadPlanStepThr
       }
       Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
       if (log) {
-        log->Printf("Setting backstop breakpoint %d at address: 0x%" PRIx64,
-                    m_backstop_bkpt_id, m_backstop_addr);
+        LLDB_LOGF(log, "Setting backstop breakpoint %d at address: 0x%" PRIx64,
+                  m_backstop_bkpt_id, m_backstop_addr);
       }
     }
   }
@@ -103,11 +103,12 @@ void ThreadPlanStepThrough::LookForPlanT
     if (m_sub_plan_sp) {
       StreamString s;
       m_sub_plan_sp->GetDescription(&s, lldb::eDescriptionLevelFull);
-      log->Printf("Found step through plan from 0x%" PRIx64 ": %s",
-                  current_address, s.GetData());
+      LLDB_LOGF(log, "Found step through plan from 0x%" PRIx64 ": %s",
+                current_address, s.GetData());
     } else {
-      log->Printf("Couldn't find step through plan from address 0x%" PRIx64 ".",
-                  current_address);
+      LLDB_LOGF(log,
+                "Couldn't find step through plan from address 0x%" PRIx64 ".",
+                current_address);
     }
   }
 }
@@ -234,8 +235,7 @@ bool ThreadPlanStepThrough::MischiefMana
   if (!IsPlanComplete()) {
     return false;
   } else {
-    if (log)
-      log->Printf("Completed step through step plan.");
+    LLDB_LOGF(log, "Completed step through step plan.");
 
     ClearBackstopBreakpoint();
     ThreadPlan::MischiefManaged();

Modified: lldb/trunk/source/Target/ThreadPlanStepUntil.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepUntil.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepUntil.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepUntil.cpp Wed Jul 24 10:56:10 2019
@@ -326,8 +326,7 @@ bool ThreadPlanStepUntil::MischiefManage
   bool done = false;
   if (IsPlanComplete()) {
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
-    if (log)
-      log->Printf("Completed step until plan.");
+    LLDB_LOGF(log, "Completed step until plan.");
 
     Clear();
     done = true;

Modified: lldb/trunk/source/Utility/ArchSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/ArchSpec.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Utility/ArchSpec.cpp (original)
+++ lldb/trunk/source/Utility/ArchSpec.cpp Wed Jul 24 10:56:10 2019
@@ -946,8 +946,10 @@ bool ArchSpec::SetArchitecture(Architect
       }
     } else {
       Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET | LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_PLATFORM));
-      if (log)
-        log->Printf("Unable to find a core definition for cpu 0x%" PRIx32 " sub %" PRId32, cpu, sub);
+      LLDB_LOGF(log,
+                "Unable to find a core definition for cpu 0x%" PRIx32
+                " sub %" PRId32,
+                cpu, sub);
     }
   }
   CoreUpdated(update_triple);

Modified: lldb/trunk/source/Utility/Broadcaster.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Broadcaster.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Utility/Broadcaster.cpp (original)
+++ lldb/trunk/source/Utility/Broadcaster.cpp Wed Jul 24 10:56:10 2019
@@ -214,11 +214,12 @@ void Broadcaster::BroadcasterImpl::Priva
   if (Log *log = lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EVENTS)) {
     StreamString event_description;
     event_sp->Dump(&event_description);
-    log->Printf("%p Broadcaster(\"%s\")::BroadcastEvent (event_sp = {%s}, "
-                "unique =%i) hijack = %p",
-                static_cast<void *>(this), GetBroadcasterName(),
-                event_description.GetData(), unique,
-                static_cast<void *>(hijacking_listener_sp.get()));
+    LLDB_LOGF(log,
+              "%p Broadcaster(\"%s\")::BroadcastEvent (event_sp = {%s}, "
+              "unique =%i) hijack = %p",
+              static_cast<void *>(this), GetBroadcasterName(),
+              event_description.GetData(), unique,
+              static_cast<void *>(hijacking_listener_sp.get()));
   }
 
   if (hijacking_listener_sp) {

Modified: lldb/trunk/source/Utility/Listener.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Listener.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Utility/Listener.cpp (original)
+++ lldb/trunk/source/Utility/Listener.cpp Wed Jul 24 10:56:10 2019
@@ -42,8 +42,8 @@ Listener::Listener(const char *name)
       m_events_mutex() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
   if (log != nullptr)
-    log->Printf("%p Listener::Listener('%s')", static_cast<void *>(this),
-                m_name.c_str());
+    LLDB_LOGF(log, "%p Listener::Listener('%s')", static_cast<void *>(this),
+              m_name.c_str());
 }
 
 Listener::~Listener() {
@@ -51,9 +51,8 @@ Listener::~Listener() {
 
   Clear();
 
-  if (log)
-    log->Printf("%p Listener::%s('%s')", static_cast<void *>(this),
-                __FUNCTION__, m_name.c_str());
+  LLDB_LOGF(log, "%p Listener::%s('%s')", static_cast<void *>(this),
+            __FUNCTION__, m_name.c_str());
 }
 
 void Listener::Clear() {
@@ -78,9 +77,8 @@ void Listener::Clear() {
       manager_sp->RemoveListener(this);
   }
 
-  if (log)
-    log->Printf("%p Listener::%s('%s')", static_cast<void *>(this),
-                __FUNCTION__, m_name.c_str());
+  LLDB_LOGF(log, "%p Listener::%s('%s')", static_cast<void *>(this),
+            __FUNCTION__, m_name.c_str());
 }
 
 uint32_t Listener::StartListeningForEvents(Broadcaster *broadcaster,
@@ -101,10 +99,11 @@ uint32_t Listener::StartListeningForEven
 
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS));
     if (log != nullptr)
-      log->Printf("%p Listener::StartListeningForEvents (broadcaster = %p, "
-                  "mask = 0x%8.8x) acquired_mask = 0x%8.8x for %s",
-                  static_cast<void *>(this), static_cast<void *>(broadcaster),
-                  event_mask, acquired_mask, m_name.c_str());
+      LLDB_LOGF(log,
+                "%p Listener::StartListeningForEvents (broadcaster = %p, "
+                "mask = 0x%8.8x) acquired_mask = 0x%8.8x for %s",
+                static_cast<void *>(this), static_cast<void *>(broadcaster),
+                event_mask, acquired_mask, m_name.c_str());
 
     return acquired_mask;
   }
@@ -132,12 +131,13 @@ uint32_t Listener::StartListeningForEven
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS));
     if (log != nullptr) {
       void **pointer = reinterpret_cast<void **>(&callback);
-      log->Printf("%p Listener::StartListeningForEvents (broadcaster = %p, "
-                  "mask = 0x%8.8x, callback = %p, user_data = %p) "
-                  "acquired_mask = 0x%8.8x for %s",
-                  static_cast<void *>(this), static_cast<void *>(broadcaster),
-                  event_mask, *pointer, static_cast<void *>(callback_user_data),
-                  acquired_mask, m_name.c_str());
+      LLDB_LOGF(log,
+                "%p Listener::StartListeningForEvents (broadcaster = %p, "
+                "mask = 0x%8.8x, callback = %p, user_data = %p) "
+                "acquired_mask = 0x%8.8x for %s",
+                static_cast<void *>(this), static_cast<void *>(broadcaster),
+                event_mask, *pointer, static_cast<void *>(callback_user_data),
+                acquired_mask, m_name.c_str());
     }
 
     return acquired_mask;
@@ -202,9 +202,9 @@ void Listener::BroadcasterManagerWillDes
 void Listener::AddEvent(EventSP &event_sp) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS));
   if (log != nullptr)
-    log->Printf("%p Listener('%s')::AddEvent (event_sp = {%p})",
-                static_cast<void *>(this), m_name.c_str(),
-                static_cast<void *>(event_sp.get()));
+    LLDB_LOGF(log, "%p Listener('%s')::AddEvent (event_sp = {%p})",
+              static_cast<void *>(this), m_name.c_str(),
+              static_cast<void *>(event_sp.get()));
 
   std::lock_guard<std::mutex> guard(m_events_mutex);
   m_events.push_back(event_sp);
@@ -290,14 +290,15 @@ bool Listener::FindNextEventInternal(
     event_sp = *pos;
 
     if (log != nullptr)
-      log->Printf("%p '%s' Listener::FindNextEventInternal(broadcaster=%p, "
-                  "broadcaster_names=%p[%u], event_type_mask=0x%8.8x, "
-                  "remove=%i) event %p",
-                  static_cast<void *>(this), GetName(),
-                  static_cast<void *>(broadcaster),
-                  static_cast<const void *>(broadcaster_names),
-                  num_broadcaster_names, event_type_mask, remove,
-                  static_cast<void *>(event_sp.get()));
+      LLDB_LOGF(log,
+                "%p '%s' Listener::FindNextEventInternal(broadcaster=%p, "
+                "broadcaster_names=%p[%u], event_type_mask=0x%8.8x, "
+                "remove=%i) event %p",
+                static_cast<void *>(this), GetName(),
+                static_cast<void *>(broadcaster),
+                static_cast<const void *>(broadcaster_names),
+                num_broadcaster_names, event_type_mask, remove,
+                static_cast<void *>(event_sp.get()));
 
     if (remove) {
       m_events.erase(pos);
@@ -366,15 +367,13 @@ bool Listener::GetEventInternal(
 
       if (result == std::cv_status::timeout) {
         log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS);
-        if (log)
-          log->Printf("%p Listener::GetEventInternal() timed out for %s",
-                      static_cast<void *>(this), m_name.c_str());
+        LLDB_LOGF(log, "%p Listener::GetEventInternal() timed out for %s",
+                  static_cast<void *>(this), m_name.c_str());
         return false;
       } else if (result != std::cv_status::no_timeout) {
         log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS);
-        if (log)
-          log->Printf("%p Listener::GetEventInternal() unknown error for %s",
-                      static_cast<void *>(this), m_name.c_str());
+        LLDB_LOGF(log, "%p Listener::GetEventInternal() unknown error for %s",
+                  static_cast<void *>(this), m_name.c_str());
         return false;
       }
     }

Modified: lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp (original)
+++ lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp Wed Jul 24 10:56:10 2019
@@ -112,9 +112,8 @@ static void sighup_handler(MainLoopBase
   ++g_sighup_received_count;
 
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("lldb-server:%s swallowing SIGHUP (receive count=%d)",
-                __FUNCTION__, g_sighup_received_count);
+  LLDB_LOGF(log, "lldb-server:%s swallowing SIGHUP (receive count=%d)",
+            __FUNCTION__, g_sighup_received_count);
 
   if (g_sighup_received_count >= 2)
     mainloop.RequestTermination();
@@ -479,9 +478,9 @@ int main_gdbserver(int argc, char *argv[
 
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(GDBR_LOG_PROCESS));
   if (log) {
-    log->Printf("lldb-server launch");
+    LLDB_LOGF(log, "lldb-server launch");
     for (int i = 0; i < argc; i++) {
-      log->Printf("argv[%i] = '%s'", i, argv[i]);
+      LLDB_LOGF(log, "argv[%i] = '%s'", i, argv[i]);
     }
   }
 

Modified: lldb/trunk/unittests/Host/ConnectionFileDescriptorTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/ConnectionFileDescriptorTest.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/unittests/Host/ConnectionFileDescriptorTest.cpp (original)
+++ lldb/trunk/unittests/Host/ConnectionFileDescriptorTest.cpp Wed Jul 24 10:56:10 2019
@@ -47,4 +47,4 @@ public:
 
 TEST_F(ConnectionFileDescriptorTest, TCPGetURIv4) { TestGetURI("127.0.0.1"); }
 
-TEST_F(ConnectionFileDescriptorTest, TCPGetURIv6) { TestGetURI("::1"); }
\ No newline at end of file
+TEST_F(ConnectionFileDescriptorTest, TCPGetURIv6) { TestGetURI("::1"); }

Modified: lldb/trunk/unittests/TestingSupport/TestUtilities.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/TestingSupport/TestUtilities.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/unittests/TestingSupport/TestUtilities.cpp (original)
+++ lldb/trunk/unittests/TestingSupport/TestUtilities.cpp Wed Jul 24 10:56:10 2019
@@ -40,4 +40,4 @@ lldb_private::ReadYAMLObjectFile(const l
         llvm::inconvertibleErrorCode(),
         "Empty object file created from yaml2obj %s.", yaml.c_str());
   return llvm::Error::success();
-}
\ No newline at end of file
+}




More information about the lldb-commits mailing list