[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


Author: jdevlieghere
Date: Wed Jul 24 10:56:10 2019
New Revision: 366936

URL: http://llvm.org/viewvc/llvm-project?rev=366936&view=rev
Log:
[Logging] Replace Log::Printf with LLDB_LOG macro (NFC)

This patch replaces explicit calls to log::Printf with the new LLDB_LOGF
macro. The macro is similar to LLDB_LOG but supports printf-style format
strings, instead of formatv-style format strings.

So instead of writing:

  if (log)
    log->Printf("%s\n", str);

You'd write:

  LLDB_LOG(log, "%s\n", str);

This change was done mechanically with the command below. I replaced the
spurious if-checks with vim, since I know how to do multi-line
replacements with it.

  find . -type f -name '*.cpp' -exec \
  sed -i '' -E 's/log->Printf\(/LLDB_LOGF\(log, /g' "{}" +

Differential revision: https://reviews.llvm.org/D65128

Modified:
    lldb/trunk/include/lldb/Utility/Log.h
    lldb/trunk/source/API/SBDebugger.cpp
    lldb/trunk/source/API/SBFrame.cpp
    lldb/trunk/source/API/SBTarget.cpp
    lldb/trunk/source/Breakpoint/Breakpoint.cpp
    lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
    lldb/trunk/source/Breakpoint/BreakpointResolver.cpp
    lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp
    lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
    lldb/trunk/source/Commands/CommandObjectTarget.cpp
    lldb/trunk/source/Core/AddressResolverFileLine.cpp
    lldb/trunk/source/Core/Communication.cpp
    lldb/trunk/source/Core/FormatEntity.cpp
    lldb/trunk/source/Core/Mangled.cpp
    lldb/trunk/source/Core/Module.cpp
    lldb/trunk/source/Core/ModuleList.cpp
    lldb/trunk/source/Core/ValueObject.cpp
    lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
    lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp
    lldb/trunk/source/DataFormatters/FormatManager.cpp
    lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp
    lldb/trunk/source/Expression/DWARFExpression.cpp
    lldb/trunk/source/Expression/ExpressionVariable.cpp
    lldb/trunk/source/Expression/FunctionCaller.cpp
    lldb/trunk/source/Expression/IRExecutionUnit.cpp
    lldb/trunk/source/Expression/IRInterpreter.cpp
    lldb/trunk/source/Expression/IRMemoryMap.cpp
    lldb/trunk/source/Expression/LLVMUserExpression.cpp
    lldb/trunk/source/Expression/Materializer.cpp
    lldb/trunk/source/Expression/UserExpression.cpp
    lldb/trunk/source/Host/common/Host.cpp
    lldb/trunk/source/Host/common/HostInfoBase.cpp
    lldb/trunk/source/Host/common/HostNativeThreadBase.cpp
    lldb/trunk/source/Host/common/NativeProcessProtocol.cpp
    lldb/trunk/source/Host/common/NativeRegisterContext.cpp
    lldb/trunk/source/Host/common/Socket.cpp
    lldb/trunk/source/Host/common/TCPSocket.cpp
    lldb/trunk/source/Host/common/UDPSocket.cpp
    lldb/trunk/source/Host/linux/HostInfoLinux.cpp
    lldb/trunk/source/Host/macosx/objcxx/Host.mm
    lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm
    lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
    lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp
    lldb/trunk/source/Interpreter/CommandInterpreter.cpp
    lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
    lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
    lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
    lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
    lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
    lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
    lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
    lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
    lldb/trunk/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp
    lldb/trunk/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
    lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
    lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
    lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp
    lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
    lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
    lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
    lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
    lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
    lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
    lldb/trunk/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
    lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
    lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
    lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
    lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
    lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
    lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
    lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
    lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
    lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
    lldb/trunk/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp
    lldb/trunk/source/Plugins/Process/Darwin/MachException.cpp
    lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
    lldb/trunk/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp
    lldb/trunk/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp
    lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
    lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
    lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
    lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
    lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
    lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
    lldb/trunk/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
    lldb/trunk/source/Plugins/Process/Utility/AuxVector.cpp
    lldb/trunk/source/Plugins/Process/Utility/HistoryThread.cpp
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
    lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
    lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
    lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
    lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp
    lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
    lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
    lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
    lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
    lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
    lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
    lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
    lldb/trunk/source/Symbol/Block.cpp
    lldb/trunk/source/Symbol/ClangASTContext.cpp
    lldb/trunk/source/Symbol/ClangASTImporter.cpp
    lldb/trunk/source/Symbol/CompactUnwindInfo.cpp
    lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
    lldb/trunk/source/Symbol/LocateSymbolFile.cpp
    lldb/trunk/source/Symbol/LocateSymbolFileMacOSX.cpp
    lldb/trunk/source/Symbol/ObjectFile.cpp
    lldb/trunk/source/Symbol/SymbolContext.cpp
    lldb/trunk/source/Symbol/UnwindPlan.cpp
    lldb/trunk/source/Target/Memory.cpp
    lldb/trunk/source/Target/ModuleCache.cpp
    lldb/trunk/source/Target/Platform.cpp
    lldb/trunk/source/Target/Process.cpp
    lldb/trunk/source/Target/SectionLoadList.cpp
    lldb/trunk/source/Target/StackFrameList.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/ThreadPlanBase.cpp
    lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
    lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp
    lldb/trunk/source/Target/ThreadPlanPython.cpp
    lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp
    lldb/trunk/source/Target/ThreadPlanShouldStopHere.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/Utility/ArchSpec.cpp
    lldb/trunk/source/Utility/Broadcaster.cpp
    lldb/trunk/source/Utility/Listener.cpp
    lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp
    lldb/trunk/unittests/Host/ConnectionFileDescriptorTest.cpp
    lldb/trunk/unittests/TestingSupport/TestUtilities.cpp

Modified: lldb/trunk/include/lldb/Utility/Log.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Log.h?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/Log.h (original)
+++ lldb/trunk/include/lldb/Utility/Log.h Wed Jul 24 10:56:10 2019
@@ -142,6 +142,7 @@ public:
                          std::forward<Args>(args)...));
   }
 
+  /// Prefer using LLDB_LOGF whenever possible.
   void Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
 
   void Error(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
@@ -212,6 +213,13 @@ private:
       log_private->Format(__FILE__, __func__, __VA_ARGS__);                    \
   } while (0)
 
+#define LLDB_LOGF(log, ...)                                                    \
+  do {                                                                         \
+    ::lldb_private::Log *log_private = (log);                                  \
+    if (log_private)                                                           \
+      log_private->Printf(__VA_ARGS__);                                        \
+  } while (0)
+
 #define LLDB_LOGV(log, ...)                                                    \
   do {                                                                         \
     ::lldb_private::Log *log_private = (log);                                  \

Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Wed Jul 24 10:56:10 2019
@@ -680,13 +680,13 @@ lldb::SBTarget SBDebugger::CreateTarget(
   }
 
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
-  if (log)
-    log->Printf("SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, "
-                "platform_name=%s, add_dependent_modules=%u, error=%s) => "
-                "SBTarget(%p)",
-                static_cast<void *>(m_opaque_sp.get()), filename, target_triple,
-                platform_name, add_dependent_modules, sb_error.GetCString(),
-                static_cast<void *>(target_sp.get()));
+  LLDB_LOGF(log,
+            "SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, "
+            "platform_name=%s, add_dependent_modules=%u, error=%s) => "
+            "SBTarget(%p)",
+            static_cast<void *>(m_opaque_sp.get()), filename, target_triple,
+            platform_name, add_dependent_modules, sb_error.GetCString(),
+            static_cast<void *>(target_sp.get()));
 
   return LLDB_RECORD_RESULT(sb_target);
 }
@@ -710,11 +710,11 @@ SBDebugger::CreateTargetWithFileAndTarge
   }
 
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
-  if (log)
-    log->Printf("SBDebugger(%p)::CreateTargetWithFileAndTargetTriple "
-                "(filename=\"%s\", triple=%s) => SBTarget(%p)",
-                static_cast<void *>(m_opaque_sp.get()), filename, target_triple,
-                static_cast<void *>(target_sp.get()));
+  LLDB_LOGF(log,
+            "SBDebugger(%p)::CreateTargetWithFileAndTargetTriple "
+            "(filename=\"%s\", triple=%s) => SBTarget(%p)",
+            static_cast<void *>(m_opaque_sp.get()), filename, target_triple,
+            static_cast<void *>(target_sp.get()));
 
   return LLDB_RECORD_RESULT(sb_target);
 }
@@ -743,11 +743,11 @@ SBTarget SBDebugger::CreateTargetWithFil
     }
   }
 
-  if (log)
-    log->Printf("SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", "
-                "arch=%s) => SBTarget(%p)",
-                static_cast<void *>(m_opaque_sp.get()), filename, arch_cstr,
-                static_cast<void *>(target_sp.get()));
+  LLDB_LOGF(log,
+            "SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", "
+            "arch=%s) => SBTarget(%p)",
+            static_cast<void *>(m_opaque_sp.get()), filename, arch_cstr,
+            static_cast<void *>(target_sp.get()));
 
   return LLDB_RECORD_RESULT(sb_target);
 }
@@ -772,11 +772,10 @@ SBTarget SBDebugger::CreateTarget(const
     }
   }
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
-  if (log)
-    log->Printf(
-        "SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)",
-        static_cast<void *>(m_opaque_sp.get()), filename,
-        static_cast<void *>(target_sp.get()));
+  LLDB_LOGF(log,
+            "SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)",
+            static_cast<void *>(m_opaque_sp.get()), filename,
+            static_cast<void *>(target_sp.get()));
   return LLDB_RECORD_RESULT(sb_target);
 }
 
@@ -788,11 +787,9 @@ SBTarget SBDebugger::GetDummyTarget() {
       sb_target.SetSP(m_opaque_sp->GetDummyTarget()->shared_from_this());
   }
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
-  if (log)
-    log->Printf(
-        "SBDebugger(%p)::GetDummyTarget() => SBTarget(%p)",
-        static_cast<void *>(m_opaque_sp.get()),
-        static_cast<void *>(sb_target.GetSP().get()));
+  LLDB_LOGF(log, "SBDebugger(%p)::GetDummyTarget() => SBTarget(%p)",
+            static_cast<void *>(m_opaque_sp.get()),
+            static_cast<void *>(sb_target.GetSP().get()));
   return LLDB_RECORD_RESULT(sb_target);
 }
 
@@ -814,10 +811,9 @@ bool SBDebugger::DeleteTarget(lldb::SBTa
   }
 
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
-  if (log)
-    log->Printf("SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i",
-                static_cast<void *>(m_opaque_sp.get()),
-                static_cast<void *>(target.m_opaque_sp.get()), result);
+  LLDB_LOGF(log, "SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i",
+            static_cast<void *>(m_opaque_sp.get()),
+            static_cast<void *>(target.m_opaque_sp.get()), result);
 
   return result;
 }
@@ -914,9 +910,9 @@ SBTarget SBDebugger::GetSelectedTarget()
   if (log) {
     SBStream sstr;
     sb_target.GetDescription(sstr, eDescriptionLevelBrief);
-    log->Printf("SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s",
-                static_cast<void *>(m_opaque_sp.get()),
-                static_cast<void *>(target_sp.get()), sstr.GetData());
+    LLDB_LOGF(log, "SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s",
+              static_cast<void *>(m_opaque_sp.get()),
+              static_cast<void *>(target_sp.get()), sstr.GetData());
   }
 
   return LLDB_RECORD_RESULT(sb_target);
@@ -935,9 +931,9 @@ void SBDebugger::SetSelectedTarget(SBTar
   if (log) {
     SBStream sstr;
     sb_target.GetDescription(sstr, eDescriptionLevelBrief);
-    log->Printf("SBDebugger(%p)::SetSelectedTarget () => SBTarget(%p): %s",
-                static_cast<void *>(m_opaque_sp.get()),
-                static_cast<void *>(target_sp.get()), sstr.GetData());
+    LLDB_LOGF(log, "SBDebugger(%p)::SetSelectedTarget () => SBTarget(%p): %s",
+              static_cast<void *>(m_opaque_sp.get()),
+              static_cast<void *>(target_sp.get()), sstr.GetData());
   }
 }
 
@@ -951,11 +947,10 @@ SBPlatform SBDebugger::GetSelectedPlatfo
   if (debugger_sp) {
     sb_platform.SetSP(debugger_sp->GetPlatformList().GetSelectedPlatform());
   }
-  if (log)
-    log->Printf("SBDebugger(%p)::GetSelectedPlatform () => SBPlatform(%p): %s",
-                static_cast<void *>(m_opaque_sp.get()),
-                static_cast<void *>(sb_platform.GetSP().get()),
-                sb_platform.GetName());
+  LLDB_LOGF(log, "SBDebugger(%p)::GetSelectedPlatform () => SBPlatform(%p): %s",
+            static_cast<void *>(m_opaque_sp.get()),
+            static_cast<void *>(sb_platform.GetSP().get()),
+            sb_platform.GetName());
   return LLDB_RECORD_RESULT(sb_platform);
 }
 
@@ -970,11 +965,10 @@ void SBDebugger::SetSelectedPlatform(SBP
     debugger_sp->GetPlatformList().SetSelectedPlatform(sb_platform.GetSP());
   }
 
-  if (log)
-    log->Printf("SBDebugger(%p)::SetSelectedPlatform (SBPlatform(%p) %s)",
-                static_cast<void *>(m_opaque_sp.get()),
-                static_cast<void *>(sb_platform.GetSP().get()),
-                sb_platform.GetName());
+  LLDB_LOGF(log, "SBDebugger(%p)::SetSelectedPlatform (SBPlatform(%p) %s)",
+            static_cast<void *>(m_opaque_sp.get()),
+            static_cast<void *>(sb_platform.GetSP().get()),
+            sb_platform.GetName());
 }
 
 uint32_t SBDebugger::GetNumPlatforms() {
@@ -1062,7 +1056,7 @@ void SBDebugger::DispatchInput(const voi
   //    Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
   //
   //    if (log)
-  //        log->Printf ("SBDebugger(%p)::DispatchInput (data=\"%.*s\",
+  //        LLDB_LOGF(log, "SBDebugger(%p)::DispatchInput (data=\"%.*s\",
   //        size_t=%" PRIu64 ")",
   //                     m_opaque_sp.get(),
   //                     (int) data_len,
@@ -1246,10 +1240,9 @@ const char *SBDebugger::GetPrompt() cons
 
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
 
-  if (log)
-    log->Printf("SBDebugger(%p)::GetPrompt () => \"%s\"",
-                static_cast<void *>(m_opaque_sp.get()),
-                (m_opaque_sp ? m_opaque_sp->GetPrompt().str().c_str() : ""));
+  LLDB_LOGF(log, "SBDebugger(%p)::GetPrompt () => \"%s\"",
+            static_cast<void *>(m_opaque_sp.get()),
+            (m_opaque_sp ? m_opaque_sp->GetPrompt().str().c_str() : ""));
 
   return (m_opaque_sp ? ConstString(m_opaque_sp->GetPrompt()).GetCString()
                       : nullptr);
@@ -1374,7 +1367,8 @@ bool SBDebugger::SetCurrentPlatformSDKRo
 
     if (platform_sp) {
       if (log && sysroot)
-        log->Printf("SBDebugger::SetCurrentPlatformSDKRoot (\"%s\")", sysroot);
+        LLDB_LOGF(log, "SBDebugger::SetCurrentPlatformSDKRoot (\"%s\")",
+                  sysroot);
       platform_sp->SetSDKRootDirectory(ConstString(sysroot));
       return true;
     }

Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Wed Jul 24 10:56:10 2019
@@ -1120,10 +1120,10 @@ lldb::SBValue SBFrame::EvaluateExpressio
     }
   }
 
-  if (expr_log)
-    expr_log->Printf("** [SBFrame::EvaluateExpression] Expression result is "
-                     "%s, summary %s **",
-                     expr_result.GetValue(), expr_result.GetSummary());
+  LLDB_LOGF(expr_log,
+            "** [SBFrame::EvaluateExpression] Expression result is "
+            "%s, summary %s **",
+            expr_result.GetValue(), expr_result.GetSummary());
 
   return LLDB_RECORD_RESULT(expr_result);
 }

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Wed Jul 24 10:56:10 2019
@@ -2355,10 +2355,10 @@ lldb::SBValue SBTarget::EvaluateExpressi
       expr_result.SetSP(expr_value_sp, options.GetFetchDynamicValue());
     }
   }
-  if (expr_log)
-    expr_log->Printf("** [SBTarget::EvaluateExpression] Expression result is "
-                     "%s, summary %s **",
-                     expr_result.GetValue(), expr_result.GetSummary());
+  LLDB_LOGF(expr_log,
+            "** [SBTarget::EvaluateExpression] Expression result is "
+            "%s, summary %s **",
+            expr_result.GetValue(), expr_result.GetSummary());
   return LLDB_RECORD_RESULT(expr_result);
 }
 

Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Wed Jul 24 10:56:10 2019
@@ -496,10 +496,10 @@ void Breakpoint::ClearAllBreakpointSites
 void Breakpoint::ModulesChanged(ModuleList &module_list, bool load,
                                 bool delete_locations) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
-  if (log)
-    log->Printf("Breakpoint::ModulesChanged: num_modules: %zu load: %i "
-                "delete_locations: %i\n",
-                module_list.GetSize(), load, delete_locations);
+  LLDB_LOGF(log,
+            "Breakpoint::ModulesChanged: num_modules: %zu load: %i "
+            "delete_locations: %i\n",
+            module_list.GetSize(), load, delete_locations);
 
   std::lock_guard<std::recursive_mutex> guard(module_list.GetMutex());
   if (load) {
@@ -550,10 +550,10 @@ void Breakpoint::ModulesChanged(ModuleLi
             seen = true;
 
           if (!break_loc_sp->ResolveBreakpointSite()) {
-            if (log)
-              log->Printf("Warning: could not set breakpoint site for "
-                          "breakpoint location %d of breakpoint %d.\n",
-                          break_loc_sp->GetID(), GetID());
+            LLDB_LOGF(log,
+                      "Warning: could not set breakpoint site for "
+                      "breakpoint location %d of breakpoint %d.\n",
+                      break_loc_sp->GetID(), GetID());
           }
         }
       }
@@ -659,9 +659,8 @@ static bool SymbolContextsMightBeEquival
 void Breakpoint::ModuleReplaced(ModuleSP old_module_sp,
                                 ModuleSP new_module_sp) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
-  if (log)
-    log->Printf("Breakpoint::ModulesReplaced for %s\n",
-                old_module_sp->GetSpecificationDescription().c_str());
+  LLDB_LOGF(log, "Breakpoint::ModulesReplaced for %s\n",
+            old_module_sp->GetSpecificationDescription().c_str());
   // First find all the locations that are in the old module
 
   BreakpointLocationCollection old_break_locs;

Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Wed Jul 24 10:56:10 2019
@@ -257,9 +257,8 @@ bool BreakpointLocation::ConditionSaysSt
         condition_text, llvm::StringRef(), language, Expression::eResultTypeAny,
         EvaluateExpressionOptions(), nullptr, error));
     if (error.Fail()) {
-      if (log)
-        log->Printf("Error getting condition expression: %s.",
-                    error.AsCString());
+      LLDB_LOGF(log, "Error getting condition expression: %s.",
+                error.AsCString());
       m_user_expression_sp.reset();
       return true;
     }
@@ -312,8 +311,8 @@ bool BreakpointLocation::ConditionSaysSt
       ret = result_value_sp->IsLogicalTrue(error);
       if (log) {
         if (error.Success()) {
-          log->Printf("Condition successfully evaluated, result is %s.\n",
-                      ret ? "true" : "false");
+          LLDB_LOGF(log, "Condition successfully evaluated, result is %s.\n",
+                    ret ? "true" : "false");
         } else {
           error.SetErrorString(
               "Failed to get an integer result from the expression");
@@ -408,8 +407,8 @@ bool BreakpointLocation::ShouldStop(Stop
   if (log) {
     StreamString s;
     GetDescription(&s, lldb::eDescriptionLevelVerbose);
-    log->Printf("Hit breakpoint location: %s, %s.\n", s.GetData(),
-                should_stop ? "stopping" : "continuing");
+    LLDB_LOGF(log, "Hit breakpoint location: %s, %s.\n", s.GetData(),
+              should_stop ? "stopping" : "continuing");
   }
 
   return should_stop;

Modified: lldb/trunk/source/Breakpoint/BreakpointResolver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolver.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointResolver.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointResolver.cpp Wed Jul 24 10:56:10 2019
@@ -294,18 +294,18 @@ void BreakpointResolver::AddLocation(Sea
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
   Address line_start = sc.line_entry.range.GetBaseAddress();
   if (!line_start.IsValid()) {
-    if (log)
-      log->Printf("error: Unable to set breakpoint %s at file address "
-                  "0x%" PRIx64 "\n",
-                  log_ident.str().c_str(), line_start.GetFileAddress());
+    LLDB_LOGF(log,
+              "error: Unable to set breakpoint %s at file address "
+              "0x%" PRIx64 "\n",
+              log_ident.str().c_str(), line_start.GetFileAddress());
     return;
   }
 
   if (!filter.AddressPasses(line_start)) {
-    if (log)
-      log->Printf("Breakpoint %s at file address 0x%" PRIx64
-                  " didn't pass the filter.\n",
-                  log_ident.str().c_str(), line_start.GetFileAddress());
+    LLDB_LOGF(log,
+              "Breakpoint %s at file address 0x%" PRIx64
+              " didn't pass the filter.\n",
+              log_ident.str().c_str(), line_start.GetFileAddress());
   }
 
   // If the line number is before the prologue end, move it there...
@@ -329,8 +329,8 @@ void BreakpointResolver::AddLocation(Sea
   if (log && bp_loc_sp && !m_breakpoint->IsInternal()) {
     StreamString s;
     bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
-    log->Printf("Added location (skipped prologue: %s): %s \n",
-                skipped_prologue ? "yes" : "no", s.GetData());
+    LLDB_LOGF(log, "Added location (skipped prologue: %s): %s \n",
+              skipped_prologue ? "yes" : "no", s.GetData());
   }
 }
 

Modified: lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp Wed Jul 24 10:56:10 2019
@@ -149,8 +149,7 @@ BreakpointResolverAddress::SearchCallbac
         bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
         Log *log(
             lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
-        if (log)
-          log->Printf("Added location: %s\n", s.GetData());
+        LLDB_LOGF(log, "Added location: %s\n", s.GetData());
       }
     } else {
       BreakpointLocationSP loc_sp = m_breakpoint->GetLocationAtIndex(0);

Modified: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp Wed Jul 24 10:56:10 2019
@@ -388,7 +388,7 @@ BreakpointResolverName::SearchCallback(S
               if (log) {
                 StreamString s;
                 bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
-                log->Printf("Added location: %s\n", s.GetData());
+                LLDB_LOGF(log, "Added location: %s\n", s.GetData());
               }
             }
           }

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Wed Jul 24 10:56:10 2019
@@ -1064,9 +1064,10 @@ protected:
           if (from[0] && to[0]) {
             Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
             if (log) {
-              log->Printf("target modules search path adding ImageSearchPath "
-                          "pair: '%s' -> '%s'",
-                          from, to);
+              LLDB_LOGF(log,
+                        "target modules search path adding ImageSearchPath "
+                        "pair: '%s' -> '%s'",
+                        from, to);
             }
             bool last_pair = ((argc - i) == 2);
             target->GetImageSearchPathList().Append(

Modified: lldb/trunk/source/Core/AddressResolverFileLine.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/AddressResolverFileLine.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Core/AddressResolverFileLine.cpp (original)
+++ lldb/trunk/source/Core/AddressResolverFileLine.cpp Wed Jul 24 10:56:10 2019
@@ -60,15 +60,15 @@ AddressResolverFileLine::SearchCallback(
         if (log) {
           StreamString s;
           // new_bp_loc->GetDescription (&s, lldb::eDescriptionLevelVerbose);
-          // log->Printf ("Added address: %s\n", s.GetData());
+          // LLDB_LOGF(log, "Added address: %s\n", s.GetData());
         }
       } else {
-        if (log)
-          log->Printf(
-              "error: Unable to resolve address at file address 0x%" PRIx64
-              " for %s:%d\n",
-              line_start.GetFileAddress(),
-              m_file_spec.GetFilename().AsCString("<Unknown>"), m_line_number);
+        LLDB_LOGF(log,
+                  "error: Unable to resolve address at file address 0x%" PRIx64
+                  " for %s:%d\n",
+                  line_start.GetFileAddress(),
+                  m_file_spec.GetFilename().AsCString("<Unknown>"),
+                  m_line_number);
       }
     }
   }

Modified: lldb/trunk/source/Core/Communication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Core/Communication.cpp (original)
+++ lldb/trunk/source/Core/Communication.cpp Wed Jul 24 10:56:10 2019
@@ -308,8 +308,7 @@ lldb::thread_result_t Communication::Rea
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION));
 
-  if (log)
-    log->Printf("%p Communication::ReadThread () thread starting...", p);
+  LLDB_LOGF(log, "%p Communication::ReadThread () thread starting...", p);
 
   uint8_t buf[1024];
 
@@ -364,7 +363,7 @@ lldb::thread_result_t Communication::Rea
   }
   log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION);
   if (log)
-    log->Printf("%p Communication::ReadThread () thread exiting...", p);
+    LLDB_LOGF(log, "%p Communication::ReadThread () thread exiting...", p);
 
   comm->m_read_thread_did_exit = true;
   // Let clients know that this thread is exiting

Modified: lldb/trunk/source/Core/FormatEntity.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatEntity.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatEntity.cpp (original)
+++ lldb/trunk/source/Core/FormatEntity.cpp Wed Jul 24 10:56:10 2019
@@ -514,24 +514,24 @@ static bool ScanBracketedRange(llvm::Str
   close_bracket_index = llvm::StringRef::npos;
   const size_t open_bracket_index = subpath.find('[');
   if (open_bracket_index == llvm::StringRef::npos) {
-    if (log)
-      log->Printf("[ScanBracketedRange] no bracketed range, skipping entirely");
+    LLDB_LOGF(log,
+              "[ScanBracketedRange] no bracketed range, skipping entirely");
     return false;
   }
 
   close_bracket_index = subpath.find(']', open_bracket_index + 1);
 
   if (close_bracket_index == llvm::StringRef::npos) {
-    if (log)
-      log->Printf("[ScanBracketedRange] no bracketed range, skipping entirely");
+    LLDB_LOGF(log,
+              "[ScanBracketedRange] no bracketed range, skipping entirely");
     return false;
   } else {
     var_name_final_if_array_range = subpath.data() + open_bracket_index;
 
     if (close_bracket_index - open_bracket_index == 1) {
-      if (log)
-        log->Printf(
-            "[ScanBracketedRange] '[]' detected.. going from 0 to end of data");
+      LLDB_LOGF(
+          log,
+          "[ScanBracketedRange] '[]' detected.. going from 0 to end of data");
       index_lower = 0;
     } else {
       const size_t separator_index = subpath.find('-', open_bracket_index + 1);
@@ -540,22 +540,21 @@ static bool ScanBracketedRange(llvm::Str
         const char *index_lower_cstr = subpath.data() + open_bracket_index + 1;
         index_lower = ::strtoul(index_lower_cstr, nullptr, 0);
         index_higher = index_lower;
-        if (log)
-          log->Printf("[ScanBracketedRange] [%" PRId64
-                      "] detected, high index is same",
-                      index_lower);
+        LLDB_LOGF(log,
+                  "[ScanBracketedRange] [%" PRId64
+                  "] detected, high index is same",
+                  index_lower);
       } else {
         const char *index_lower_cstr = subpath.data() + open_bracket_index + 1;
         const char *index_higher_cstr = subpath.data() + separator_index + 1;
         index_lower = ::strtoul(index_lower_cstr, nullptr, 0);
         index_higher = ::strtoul(index_higher_cstr, nullptr, 0);
-        if (log)
-          log->Printf("[ScanBracketedRange] [%" PRId64 "-%" PRId64 "] detected",
-                      index_lower, index_higher);
+        LLDB_LOGF(log,
+                  "[ScanBracketedRange] [%" PRId64 "-%" PRId64 "] detected",
+                  index_lower, index_higher);
       }
       if (index_lower > index_higher && index_higher > 0) {
-        if (log)
-          log->Printf("[ScanBracketedRange] swapping indices");
+        LLDB_LOGF(log, "[ScanBracketedRange] swapping indices");
         const int64_t temp = index_lower;
         index_lower = index_higher;
         index_higher = temp;
@@ -627,9 +626,8 @@ static ValueObjectSP ExpandIndexedExpres
   const char *ptr_deref_format = "[%d]";
   std::string ptr_deref_buffer(10, 0);
   ::sprintf(&ptr_deref_buffer[0], ptr_deref_format, index);
-  if (log)
-    log->Printf("[ExpandIndexedExpression] name to deref: %s",
-                ptr_deref_buffer.c_str());
+  LLDB_LOGF(log, "[ExpandIndexedExpression] name to deref: %s",
+            ptr_deref_buffer.c_str());
   ValueObject::GetValueForExpressionPathOptions options;
   ValueObject::ExpressionPathEndResultType final_value_type;
   ValueObject::ExpressionPathScanEndReason reason_to_stop;
@@ -640,15 +638,15 @@ static ValueObjectSP ExpandIndexedExpres
       ptr_deref_buffer.c_str(), &reason_to_stop, &final_value_type, options,
       &what_next);
   if (!item) {
-    if (log)
-      log->Printf("[ExpandIndexedExpression] ERROR: why stopping = %d,"
-                  " final_value_type %d",
-                  reason_to_stop, final_value_type);
+    LLDB_LOGF(log,
+              "[ExpandIndexedExpression] ERROR: why stopping = %d,"
+              " final_value_type %d",
+              reason_to_stop, final_value_type);
   } else {
-    if (log)
-      log->Printf("[ExpandIndexedExpression] ALL RIGHT: why stopping = %d,"
-                  " final_value_type %d",
-                  reason_to_stop, final_value_type);
+    LLDB_LOGF(log,
+              "[ExpandIndexedExpression] ALL RIGHT: why stopping = %d,"
+              " final_value_type %d",
+              reason_to_stop, final_value_type);
   }
   return item;
 }
@@ -770,9 +768,8 @@ static bool DumpValue(Stream &s, const S
 
     const std::string &expr_path = entry.string;
 
-    if (log)
-      log->Printf("[Debugger::FormatPrompt] symbol to expand: %s",
-                  expr_path.c_str());
+    LLDB_LOGF(log, "[Debugger::FormatPrompt] symbol to expand: %s",
+              expr_path.c_str());
 
     target =
         valobj
@@ -781,16 +778,16 @@ static bool DumpValue(Stream &s, const S
             .get();
 
     if (!target) {
-      if (log)
-        log->Printf("[Debugger::FormatPrompt] ERROR: why stopping = %d,"
-                    " final_value_type %d",
-                    reason_to_stop, final_value_type);
+      LLDB_LOGF(log,
+                "[Debugger::FormatPrompt] ERROR: why stopping = %d,"
+                " final_value_type %d",
+                reason_to_stop, final_value_type);
       return false;
     } else {
-      if (log)
-        log->Printf("[Debugger::FormatPrompt] ALL RIGHT: why stopping = %d,"
-                    " final_value_type %d",
-                    reason_to_stop, final_value_type);
+      LLDB_LOGF(log,
+                "[Debugger::FormatPrompt] ALL RIGHT: why stopping = %d,"
+                " final_value_type %d",
+                reason_to_stop, final_value_type);
       target = target
                    ->GetQualifiedRepresentationIfAvailable(
                        target->GetDynamicValueType(), true)
@@ -814,18 +811,16 @@ static bool DumpValue(Stream &s, const S
     Status error;
     target = target->Dereference(error).get();
     if (error.Fail()) {
-      if (log)
-        log->Printf("[Debugger::FormatPrompt] ERROR: %s\n",
-                    error.AsCString("unknown"));
+      LLDB_LOGF(log, "[Debugger::FormatPrompt] ERROR: %s\n",
+                error.AsCString("unknown"));
       return false;
     }
     do_deref_pointer = false;
   }
 
   if (!target) {
-    if (log)
-      log->Printf("[Debugger::FormatPrompt] could not calculate target for "
-                  "prompt expression");
+    LLDB_LOGF(log, "[Debugger::FormatPrompt] could not calculate target for "
+                   "prompt expression");
     return false;
   }
 
@@ -860,18 +855,16 @@ static bool DumpValue(Stream &s, const S
                                                              // exceptions
   {
     StreamString str_temp;
-    if (log)
-      log->Printf(
-          "[Debugger::FormatPrompt] I am into array || pointer && !range");
+    LLDB_LOGF(log,
+              "[Debugger::FormatPrompt] I am into array || pointer && !range");
 
     if (target->HasSpecialPrintableRepresentation(val_obj_display,
                                                   custom_format)) {
       // try to use the special cases
       bool success = target->DumpPrintableRepresentation(
           str_temp, val_obj_display, custom_format);
-      if (log)
-        log->Printf("[Debugger::FormatPrompt] special cases did%s match",
-                    success ? "" : "n't");
+      LLDB_LOGF(log, "[Debugger::FormatPrompt] special cases did%s match",
+                success ? "" : "n't");
 
       // should not happen
       if (success)
@@ -909,17 +902,16 @@ static bool DumpValue(Stream &s, const S
   }
 
   if (!is_array_range) {
-    if (log)
-      log->Printf("[Debugger::FormatPrompt] dumping ordinary printable output");
+    LLDB_LOGF(log,
+              "[Debugger::FormatPrompt] dumping ordinary printable output");
     return target->DumpPrintableRepresentation(s, val_obj_display,
                                                custom_format);
   } else {
-    if (log)
-      log->Printf("[Debugger::FormatPrompt] checking if I can handle as array");
+    LLDB_LOGF(log,
+              "[Debugger::FormatPrompt] checking if I can handle as array");
     if (!is_array && !is_pointer)
       return false;
-    if (log)
-      log->Printf("[Debugger::FormatPrompt] handle as array");
+    LLDB_LOGF(log, "[Debugger::FormatPrompt] handle as array");
     StreamString special_directions_stream;
     llvm::StringRef special_directions;
     if (close_bracket_index != llvm::StringRef::npos &&
@@ -965,15 +957,15 @@ static bool DumpValue(Stream &s, const S
               .get();
 
       if (!item) {
-        if (log)
-          log->Printf("[Debugger::FormatPrompt] ERROR in getting child item at "
-                      "index %" PRId64,
-                      index);
+        LLDB_LOGF(log,
+                  "[Debugger::FormatPrompt] ERROR in getting child item at "
+                  "index %" PRId64,
+                  index);
       } else {
-        if (log)
-          log->Printf(
-              "[Debugger::FormatPrompt] special_directions for child item: %s",
-              special_directions.data() ? special_directions.data() : "");
+        LLDB_LOGF(
+            log,
+            "[Debugger::FormatPrompt] special_directions for child item: %s",
+            special_directions.data() ? special_directions.data() : "");
       }
 
       if (special_directions.empty()) {

Modified: lldb/trunk/source/Core/Mangled.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Mangled.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Core/Mangled.cpp (original)
+++ lldb/trunk/source/Core/Mangled.cpp Wed Jul 24 10:56:10 2019
@@ -226,9 +226,9 @@ static char *GetMSVCDemangledStr(const c
 
   if (Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) {
     if (demangled_cstr && demangled_cstr[0])
-      log->Printf("demangled msvc: %s -> \"%s\"", M, demangled_cstr);
+      LLDB_LOGF(log, "demangled msvc: %s -> \"%s\"", M, demangled_cstr);
     else
-      log->Printf("demangled msvc: %s -> error: 0x%lu", M, result);
+      LLDB_LOGF(log, "demangled msvc: %s -> error: 0x%lu", M, result);
   }
 
   if (result != 0) {
@@ -261,9 +261,9 @@ static char *GetItaniumDemangledStr(cons
 
   if (Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) {
     if (demangled_cstr)
-      log->Printf("demangled itanium: %s -> \"%s\"", M, demangled_cstr);
+      LLDB_LOGF(log, "demangled itanium: %s -> \"%s\"", M, demangled_cstr);
     else
-      log->Printf("demangled itanium: %s -> error: failed to demangle", M);
+      LLDB_LOGF(log, "demangled itanium: %s -> error: failed to demangle", M);
   }
 
   return demangled_cstr;

Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Wed Jul 24 10:56:10 2019
@@ -137,14 +137,15 @@ Module::Module(const ModuleSpec &module_
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT |
                                                   LIBLLDB_LOG_MODULES));
   if (log != nullptr)
-    log->Printf("%p Module::Module((%s) '%s%s%s%s')", static_cast<void *>(this),
-                module_spec.GetArchitecture().GetArchitectureName(),
-                module_spec.GetFileSpec().GetPath().c_str(),
-                module_spec.GetObjectName().IsEmpty() ? "" : "(",
-                module_spec.GetObjectName().IsEmpty()
-                    ? ""
-                    : module_spec.GetObjectName().AsCString(""),
-                module_spec.GetObjectName().IsEmpty() ? "" : ")");
+    LLDB_LOGF(log, "%p Module::Module((%s) '%s%s%s%s')",
+              static_cast<void *>(this),
+              module_spec.GetArchitecture().GetArchitectureName(),
+              module_spec.GetFileSpec().GetPath().c_str(),
+              module_spec.GetObjectName().IsEmpty() ? "" : "(",
+              module_spec.GetObjectName().IsEmpty()
+                  ? ""
+                  : module_spec.GetObjectName().AsCString(""),
+              module_spec.GetObjectName().IsEmpty() ? "" : ")");
 
   // First extract all module specifications from the file using the local file
   // path. If there are no specifications, then don't fill anything in
@@ -164,7 +165,7 @@ Module::Module(const ModuleSpec &module_
   if (!modules_specs.FindMatchingModuleSpec(module_spec,
                                             matching_module_spec)) {
     if (log) {
-      log->Printf("Found local object file but the specs didn't match");
+      LLDB_LOGF(log, "Found local object file but the specs didn't match");
     }
     return;
   }
@@ -235,11 +236,11 @@ Module::Module(const FileSpec &file_spec
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT |
                                                   LIBLLDB_LOG_MODULES));
   if (log != nullptr)
-    log->Printf("%p Module::Module((%s) '%s%s%s%s')", static_cast<void *>(this),
-                m_arch.GetArchitectureName(), m_file.GetPath().c_str(),
-                m_object_name.IsEmpty() ? "" : "(",
-                m_object_name.IsEmpty() ? "" : m_object_name.AsCString(""),
-                m_object_name.IsEmpty() ? "" : ")");
+    LLDB_LOGF(log, "%p Module::Module((%s) '%s%s%s%s')",
+              static_cast<void *>(this), m_arch.GetArchitectureName(),
+              m_file.GetPath().c_str(), m_object_name.IsEmpty() ? "" : "(",
+              m_object_name.IsEmpty() ? "" : m_object_name.AsCString(""),
+              m_object_name.IsEmpty() ? "" : ")");
 }
 
 Module::Module()
@@ -267,11 +268,11 @@ Module::~Module() {
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT |
                                                   LIBLLDB_LOG_MODULES));
   if (log != nullptr)
-    log->Printf("%p Module::~Module((%s) '%s%s%s%s')",
-                static_cast<void *>(this), m_arch.GetArchitectureName(),
-                m_file.GetPath().c_str(), m_object_name.IsEmpty() ? "" : "(",
-                m_object_name.IsEmpty() ? "" : m_object_name.AsCString(""),
-                m_object_name.IsEmpty() ? "" : ")");
+    LLDB_LOGF(log, "%p Module::~Module((%s) '%s%s%s%s')",
+              static_cast<void *>(this), m_arch.GetArchitectureName(),
+              m_file.GetPath().c_str(), m_object_name.IsEmpty() ? "" : "(",
+              m_object_name.IsEmpty() ? "" : m_object_name.AsCString(""),
+              m_object_name.IsEmpty() ? "" : ")");
   // Release any auto pointers before we start tearing down our member
   // variables since the object file and symbol files might need to make
   // function calls back into this module object. The ordering is important

Modified: lldb/trunk/source/Core/ModuleList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Core/ModuleList.cpp (original)
+++ lldb/trunk/source/Core/ModuleList.cpp Wed Jul 24 10:56:10 2019
@@ -641,11 +641,11 @@ void ModuleList::LogUUIDAndPaths(Log *lo
     for (pos = begin; pos != end; ++pos) {
       Module *module = pos->get();
       const FileSpec &module_file_spec = module->GetFileSpec();
-      log->Printf("%s[%u] %s (%s) \"%s\"", prefix_cstr ? prefix_cstr : "",
-                  (uint32_t)std::distance(begin, pos),
-                  module->GetUUID().GetAsString().c_str(),
-                  module->GetArchitecture().GetArchitectureName(),
-                  module_file_spec.GetPath().c_str());
+      LLDB_LOGF(log, "%s[%u] %s (%s) \"%s\"", prefix_cstr ? prefix_cstr : "",
+                (uint32_t)std::distance(begin, pos),
+                module->GetUUID().GetAsString().c_str(),
+                module->GetArchitecture().GetArchitectureName(),
+                module_file_spec.GetPath().c_str());
     }
   }
 }
@@ -808,8 +808,9 @@ Status ModuleList::GetSharedModule(const
 
           Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES));
           if (log != nullptr)
-            log->Printf("module changed: %p, removing from global module list",
-                        static_cast<void *>(module_sp.get()));
+            LLDB_LOGF(log,
+                      "module changed: %p, removing from global module list",
+                      static_cast<void *>(module_sp.get()));
 
           shared_module_list.Remove(module_sp);
           module_sp.reset();

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Wed Jul 24 10:56:10 2019
@@ -226,12 +226,12 @@ bool ValueObject::UpdateValueIfNeeded(bo
 
 bool ValueObject::UpdateFormatsIfNeeded() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
-  if (log)
-    log->Printf("[%s %p] checking for FormatManager revisions. ValueObject "
-                "rev: %d - Global rev: %d",
-                GetName().GetCString(), static_cast<void *>(this),
-                m_last_format_mgr_revision,
-                DataVisualization::GetCurrentRevision());
+  LLDB_LOGF(log,
+            "[%s %p] checking for FormatManager revisions. ValueObject "
+            "rev: %d - Global rev: %d",
+            GetName().GetCString(), static_cast<void *>(this),
+            m_last_format_mgr_revision,
+            DataVisualization::GetCurrentRevision());
 
   bool any_change = false;
 

Modified: lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectDynamicValue.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectDynamicValue.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectDynamicValue.cpp Wed Jul 24 10:56:10 2019
@@ -243,8 +243,8 @@ bool ValueObjectDynamicValue::UpdateValu
   m_value.SetValueType(value_type);
 
   if (has_changed_type && log)
-    log->Printf("[%s %p] has a new dynamic type %s", GetName().GetCString(),
-                static_cast<void *>(this), GetTypeName().GetCString());
+    LLDB_LOGF(log, "[%s %p] has a new dynamic type %s", GetName().GetCString(),
+              static_cast<void *>(this), GetTypeName().GetCString());
 
   if (m_address.IsValid() && m_dynamic_type_info) {
     // The variable value is in the Scalar value inside the m_value. We can

Modified: lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp Wed Jul 24 10:56:10 2019
@@ -87,20 +87,18 @@ size_t ValueObjectSynthetic::CalculateNu
 
   if (max < UINT32_MAX) {
     size_t num_children = m_synth_filter_up->CalculateNumChildren(max);
-    if (log)
-      log->Printf("[ValueObjectSynthetic::CalculateNumChildren] for VO of name "
-                  "%s and type %s, the filter returned %zu child values",
-                  GetName().AsCString(), GetTypeName().AsCString(),
-                  num_children);
+    LLDB_LOGF(log,
+              "[ValueObjectSynthetic::CalculateNumChildren] for VO of name "
+              "%s and type %s, the filter returned %zu child values",
+              GetName().AsCString(), GetTypeName().AsCString(), num_children);
     return num_children;
   } else {
     size_t num_children = (m_synthetic_children_count =
                                m_synth_filter_up->CalculateNumChildren(max));
-    if (log)
-      log->Printf("[ValueObjectSynthetic::CalculateNumChildren] for VO of name "
-                  "%s and type %s, the filter returned %zu child values",
-                  GetName().AsCString(), GetTypeName().AsCString(),
-                  num_children);
+    LLDB_LOGF(log,
+              "[ValueObjectSynthetic::CalculateNumChildren] for VO of name "
+              "%s and type %s, the filter returned %zu child values",
+              GetName().AsCString(), GetTypeName().AsCString(), num_children);
     return num_children;
   }
 }
@@ -163,21 +161,21 @@ bool ValueObjectSynthetic::UpdateValue()
   // <rdar://problem/12424824>
   ConstString new_parent_type_name = m_parent->GetTypeName();
   if (new_parent_type_name != m_parent_type_name) {
-    if (log)
-      log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, type changed "
-                  "from %s to %s, recomputing synthetic filter",
-                  GetName().AsCString(), m_parent_type_name.AsCString(),
-                  new_parent_type_name.AsCString());
+    LLDB_LOGF(log,
+              "[ValueObjectSynthetic::UpdateValue] name=%s, type changed "
+              "from %s to %s, recomputing synthetic filter",
+              GetName().AsCString(), m_parent_type_name.AsCString(),
+              new_parent_type_name.AsCString());
     m_parent_type_name = new_parent_type_name;
     CreateSynthFilter();
   }
 
   // let our backend do its update
   if (!m_synth_filter_up->Update()) {
-    if (log)
-      log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
-                  "filter said caches are stale - clearing",
-                  GetName().AsCString());
+    LLDB_LOGF(log,
+              "[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
+              "filter said caches are stale - clearing",
+              GetName().AsCString());
     // filter said that cached values are stale
     m_children_byindex.Clear();
     m_name_toindex.Clear();
@@ -190,10 +188,10 @@ bool ValueObjectSynthetic::UpdateValue()
     m_synthetic_children_count = UINT32_MAX;
     m_might_have_children = eLazyBoolCalculate;
   } else {
-    if (log)
-      log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
-                  "filter said caches are still valid",
-                  GetName().AsCString());
+    LLDB_LOGF(log,
+              "[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
+              "filter said caches are still valid",
+              GetName().AsCString());
   }
 
   m_provides_value = eLazyBoolCalculate;
@@ -201,18 +199,18 @@ bool ValueObjectSynthetic::UpdateValue()
   lldb::ValueObjectSP synth_val(m_synth_filter_up->GetSyntheticValue());
 
   if (synth_val && synth_val->CanProvideValue()) {
-    if (log)
-      log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
-                  "filter said it can provide a value",
-                  GetName().AsCString());
+    LLDB_LOGF(log,
+              "[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
+              "filter said it can provide a value",
+              GetName().AsCString());
 
     m_provides_value = eLazyBoolYes;
     CopyValueData(synth_val.get());
   } else {
-    if (log)
-      log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
-                  "filter said it will not provide a value",
-                  GetName().AsCString());
+    LLDB_LOGF(log,
+              "[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
+              "filter said it will not provide a value",
+              GetName().AsCString());
 
     m_provides_value = eLazyBoolNo;
     CopyValueData(m_parent);
@@ -226,32 +224,32 @@ lldb::ValueObjectSP ValueObjectSynthetic
                                                           bool can_create) {
   Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS);
 
-  if (log)
-    log->Printf("[ValueObjectSynthetic::GetChildAtIndex] name=%s, retrieving "
-                "child at index %zu",
-                GetName().AsCString(), idx);
+  LLDB_LOGF(log,
+            "[ValueObjectSynthetic::GetChildAtIndex] name=%s, retrieving "
+            "child at index %zu",
+            GetName().AsCString(), idx);
 
   UpdateValueIfNeeded();
 
   ValueObject *valobj;
   if (!m_children_byindex.GetValueForKey(idx, valobj)) {
     if (can_create && m_synth_filter_up != nullptr) {
-      if (log)
-        log->Printf("[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at "
-                    "index %zu not cached and will be created",
-                    GetName().AsCString(), idx);
+      LLDB_LOGF(log,
+                "[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at "
+                "index %zu not cached and will be created",
+                GetName().AsCString(), idx);
 
       lldb::ValueObjectSP synth_guy = m_synth_filter_up->GetChildAtIndex(idx);
 
-      if (log)
-        log->Printf(
-            "[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at index "
-            "%zu created as %p (is "
-            "synthetic: %s)",
-            GetName().AsCString(), idx, static_cast<void *>(synth_guy.get()),
-            synth_guy.get()
-                ? (synth_guy->IsSyntheticChildrenGenerated() ? "yes" : "no")
-                : "no");
+      LLDB_LOGF(
+          log,
+          "[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at index "
+          "%zu created as %p (is "
+          "synthetic: %s)",
+          GetName().AsCString(), idx, static_cast<void *>(synth_guy.get()),
+          synth_guy.get()
+              ? (synth_guy->IsSyntheticChildrenGenerated() ? "yes" : "no")
+              : "no");
 
       if (!synth_guy)
         return synth_guy;
@@ -263,20 +261,20 @@ lldb::ValueObjectSP ValueObjectSynthetic
           GetPreferredDisplayLanguage());
       return synth_guy;
     } else {
-      if (log)
-        log->Printf("[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at "
-                    "index %zu not cached and cannot "
-                    "be created (can_create = %s, synth_filter = %p)",
-                    GetName().AsCString(), idx, can_create ? "yes" : "no",
-                    static_cast<void *>(m_synth_filter_up.get()));
+      LLDB_LOGF(log,
+                "[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at "
+                "index %zu not cached and cannot "
+                "be created (can_create = %s, synth_filter = %p)",
+                GetName().AsCString(), idx, can_create ? "yes" : "no",
+                static_cast<void *>(m_synth_filter_up.get()));
 
       return lldb::ValueObjectSP();
     }
   } else {
-    if (log)
-      log->Printf("[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at "
-                  "index %zu cached as %p",
-                  GetName().AsCString(), idx, static_cast<void *>(valobj));
+    LLDB_LOGF(log,
+              "[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at "
+              "index %zu cached as %p",
+              GetName().AsCString(), idx, static_cast<void *>(valobj));
 
     return valobj->GetSP();
   }

Modified: lldb/trunk/source/DataFormatters/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormatManager.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatManager.cpp Wed Jul 24 10:56:10 2019
@@ -630,30 +630,29 @@ FormatManager::GetFormat(ValueObject &va
   TypeFormatImplSP retval;
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
   if (match_data.GetTypeForCache()) {
-    if (log)
-      log->Printf(
-          "\n\n[FormatManager::GetFormat] Looking into cache for type %s",
-          match_data.GetTypeForCache().AsCString("<invalid>"));
+    LLDB_LOGF(log,
+              "\n\n[FormatManager::GetFormat] Looking into cache for type %s",
+              match_data.GetTypeForCache().AsCString("<invalid>"));
     if (m_format_cache.GetFormat(match_data.GetTypeForCache(), retval)) {
       if (log) {
-        log->Printf(
-            "[FormatManager::GetFormat] Cache search success. Returning.");
+        LLDB_LOGF(
+            log, "[FormatManager::GetFormat] Cache search success. Returning.");
         LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
                   m_format_cache.GetCacheHits(),
                   m_format_cache.GetCacheMisses());
       }
       return retval;
     }
-    if (log)
-      log->Printf(
-          "[FormatManager::GetFormat] Cache search failed. Going normal route");
+    LLDB_LOGF(
+        log,
+        "[FormatManager::GetFormat] Cache search failed. Going normal route");
   }
 
   retval = m_categories_map.GetFormat(match_data);
   if (!retval) {
-    if (log)
-      log->Printf("[FormatManager::GetFormat] Search failed. Giving language a "
-                  "chance.");
+    LLDB_LOGF(log,
+              "[FormatManager::GetFormat] Search failed. Giving language a "
+              "chance.");
     for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
       if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
         if (lang_category->Get(match_data, retval))
@@ -661,24 +660,22 @@ FormatManager::GetFormat(ValueObject &va
       }
     }
     if (retval) {
-      if (log)
-        log->Printf(
-            "[FormatManager::GetFormat] Language search success. Returning.");
+      LLDB_LOGF(
+          log,
+          "[FormatManager::GetFormat] Language search success. Returning.");
       return retval;
     }
   }
   if (!retval) {
-    if (log)
-      log->Printf("[FormatManager::GetFormat] Search failed. Giving hardcoded "
-                  "a chance.");
+    LLDB_LOGF(log, "[FormatManager::GetFormat] Search failed. Giving hardcoded "
+                   "a chance.");
     retval = GetHardcodedFormat(match_data);
   }
 
   if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable())) {
-    if (log)
-      log->Printf("[FormatManager::GetFormat] Caching %p for type %s",
-                  static_cast<void *>(retval.get()),
-                  match_data.GetTypeForCache().AsCString("<invalid>"));
+    LLDB_LOGF(log, "[FormatManager::GetFormat] Caching %p for type %s",
+              static_cast<void *>(retval.get()),
+              match_data.GetTypeForCache().AsCString("<invalid>"));
     m_format_cache.SetFormat(match_data.GetTypeForCache(), retval);
   }
   LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
@@ -708,30 +705,29 @@ FormatManager::GetSummaryFormat(ValueObj
   TypeSummaryImplSP retval;
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
   if (match_data.GetTypeForCache()) {
-    if (log)
-      log->Printf("\n\n[FormatManager::GetSummaryFormat] Looking into cache "
-                  "for type %s",
-                  match_data.GetTypeForCache().AsCString("<invalid>"));
+    LLDB_LOGF(log,
+              "\n\n[FormatManager::GetSummaryFormat] Looking into cache "
+              "for type %s",
+              match_data.GetTypeForCache().AsCString("<invalid>"));
     if (m_format_cache.GetSummary(match_data.GetTypeForCache(), retval)) {
       if (log) {
-        log->Printf("[FormatManager::GetSummaryFormat] Cache search success. "
-                    "Returning.");
+        LLDB_LOGF(log,
+                  "[FormatManager::GetSummaryFormat] Cache search success. "
+                  "Returning.");
         LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
                   m_format_cache.GetCacheHits(),
                   m_format_cache.GetCacheMisses());
       }
       return retval;
     }
-    if (log)
-      log->Printf("[FormatManager::GetSummaryFormat] Cache search failed. "
-                  "Going normal route");
+    LLDB_LOGF(log, "[FormatManager::GetSummaryFormat] Cache search failed. "
+                   "Going normal route");
   }
 
   retval = m_categories_map.GetSummaryFormat(match_data);
   if (!retval) {
-    if (log)
-      log->Printf("[FormatManager::GetSummaryFormat] Search failed. Giving "
-                  "language a chance.");
+    LLDB_LOGF(log, "[FormatManager::GetSummaryFormat] Search failed. Giving "
+                   "language a chance.");
     for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
       if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
         if (lang_category->Get(match_data, retval))
@@ -739,24 +735,21 @@ FormatManager::GetSummaryFormat(ValueObj
       }
     }
     if (retval) {
-      if (log)
-        log->Printf("[FormatManager::GetSummaryFormat] Language search "
-                    "success. Returning.");
+      LLDB_LOGF(log, "[FormatManager::GetSummaryFormat] Language search "
+                     "success. Returning.");
       return retval;
     }
   }
   if (!retval) {
-    if (log)
-      log->Printf("[FormatManager::GetSummaryFormat] Search failed. Giving "
-                  "hardcoded a chance.");
+    LLDB_LOGF(log, "[FormatManager::GetSummaryFormat] Search failed. Giving "
+                   "hardcoded a chance.");
     retval = GetHardcodedSummaryFormat(match_data);
   }
 
   if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable())) {
-    if (log)
-      log->Printf("[FormatManager::GetSummaryFormat] Caching %p for type %s",
-                  static_cast<void *>(retval.get()),
-                  match_data.GetTypeForCache().AsCString("<invalid>"));
+    LLDB_LOGF(log, "[FormatManager::GetSummaryFormat] Caching %p for type %s",
+              static_cast<void *>(retval.get()),
+              match_data.GetTypeForCache().AsCString("<invalid>"));
     m_format_cache.SetSummary(match_data.GetTypeForCache(), retval);
   }
   LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
@@ -786,30 +779,29 @@ FormatManager::GetSyntheticChildren(Valu
   SyntheticChildrenSP retval;
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
   if (match_data.GetTypeForCache()) {
-    if (log)
-      log->Printf("\n\n[FormatManager::GetSyntheticChildren] Looking into "
-                  "cache for type %s",
-                  match_data.GetTypeForCache().AsCString("<invalid>"));
+    LLDB_LOGF(log,
+              "\n\n[FormatManager::GetSyntheticChildren] Looking into "
+              "cache for type %s",
+              match_data.GetTypeForCache().AsCString("<invalid>"));
     if (m_format_cache.GetSynthetic(match_data.GetTypeForCache(), retval)) {
       if (log) {
-        log->Printf("[FormatManager::GetSyntheticChildren] Cache search "
-                    "success. Returning.");
+        LLDB_LOGF(log, "[FormatManager::GetSyntheticChildren] Cache search "
+                       "success. Returning.");
         LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
                   m_format_cache.GetCacheHits(),
                   m_format_cache.GetCacheMisses());
       }
       return retval;
     }
-    if (log)
-      log->Printf("[FormatManager::GetSyntheticChildren] Cache search failed. "
-                  "Going normal route");
+    LLDB_LOGF(log, "[FormatManager::GetSyntheticChildren] Cache search failed. "
+                   "Going normal route");
   }
 
   retval = m_categories_map.GetSyntheticChildren(match_data);
   if (!retval) {
-    if (log)
-      log->Printf("[FormatManager::GetSyntheticChildren] Search failed. Giving "
-                  "language a chance.");
+    LLDB_LOGF(log,
+              "[FormatManager::GetSyntheticChildren] Search failed. Giving "
+              "language a chance.");
     for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
       if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
         if (lang_category->Get(match_data, retval))
@@ -817,25 +809,23 @@ FormatManager::GetSyntheticChildren(Valu
       }
     }
     if (retval) {
-      if (log)
-        log->Printf("[FormatManager::GetSyntheticChildren] Language search "
-                    "success. Returning.");
+      LLDB_LOGF(log, "[FormatManager::GetSyntheticChildren] Language search "
+                     "success. Returning.");
       return retval;
     }
   }
   if (!retval) {
-    if (log)
-      log->Printf("[FormatManager::GetSyntheticChildren] Search failed. Giving "
-                  "hardcoded a chance.");
+    LLDB_LOGF(log,
+              "[FormatManager::GetSyntheticChildren] Search failed. Giving "
+              "hardcoded a chance.");
     retval = GetHardcodedSyntheticChildren(match_data);
   }
 
   if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable())) {
-    if (log)
-      log->Printf(
-          "[FormatManager::GetSyntheticChildren] Caching %p for type %s",
-          static_cast<void *>(retval.get()),
-          match_data.GetTypeForCache().AsCString("<invalid>"));
+    LLDB_LOGF(log,
+              "[FormatManager::GetSyntheticChildren] Caching %p for type %s",
+              static_cast<void *>(retval.get()),
+              match_data.GetTypeForCache().AsCString("<invalid>"));
     m_format_cache.SetSynthetic(match_data.GetTypeForCache(), retval);
   }
   LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
@@ -851,13 +841,13 @@ FormatManager::GetValidator(ValueObject
   TypeValidatorImplSP retval;
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
   if (match_data.GetTypeForCache()) {
-    if (log)
-      log->Printf(
-          "\n\n[FormatManager::GetValidator] Looking into cache for type %s",
-          match_data.GetTypeForCache().AsCString("<invalid>"));
+    LLDB_LOGF(
+        log, "\n\n[FormatManager::GetValidator] Looking into cache for type %s",
+        match_data.GetTypeForCache().AsCString("<invalid>"));
     if (m_format_cache.GetValidator(match_data.GetTypeForCache(), retval)) {
       if (log) {
-        log->Printf(
+        LLDB_LOGF(
+            log,
             "[FormatManager::GetValidator] Cache search success. Returning.");
         LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
                   m_format_cache.GetCacheHits(),
@@ -865,16 +855,14 @@ FormatManager::GetValidator(ValueObject
       }
       return retval;
     }
-    if (log)
-      log->Printf("[FormatManager::GetValidator] Cache search failed. Going "
-                  "normal route");
+    LLDB_LOGF(log, "[FormatManager::GetValidator] Cache search failed. Going "
+                   "normal route");
   }
 
   retval = m_categories_map.GetValidator(match_data);
   if (!retval) {
-    if (log)
-      log->Printf("[FormatManager::GetValidator] Search failed. Giving "
-                  "language a chance.");
+    LLDB_LOGF(log, "[FormatManager::GetValidator] Search failed. Giving "
+                   "language a chance.");
     for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
       if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
         if (lang_category->Get(match_data, retval))
@@ -882,24 +870,21 @@ FormatManager::GetValidator(ValueObject
       }
     }
     if (retval) {
-      if (log)
-        log->Printf("[FormatManager::GetValidator] Language search success. "
-                    "Returning.");
+      LLDB_LOGF(log, "[FormatManager::GetValidator] Language search success. "
+                     "Returning.");
       return retval;
     }
   }
   if (!retval) {
-    if (log)
-      log->Printf("[FormatManager::GetValidator] Search failed. Giving "
-                  "hardcoded a chance.");
+    LLDB_LOGF(log, "[FormatManager::GetValidator] Search failed. Giving "
+                   "hardcoded a chance.");
     retval = GetHardcodedValidator(match_data);
   }
 
   if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable())) {
-    if (log)
-      log->Printf("[FormatManager::GetValidator] Caching %p for type %s",
-                  static_cast<void *>(retval.get()),
-                  match_data.GetTypeForCache().AsCString("<invalid>"));
+    LLDB_LOGF(log, "[FormatManager::GetValidator] Caching %p for type %s",
+              static_cast<void *>(retval.get()),
+              match_data.GetTypeForCache().AsCString("<invalid>"));
     m_format_cache.SetValidator(match_data.GetTypeForCache(), retval);
   }
   LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",

Modified: lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp (original)
+++ lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp Wed Jul 24 10:56:10 2019
@@ -180,7 +180,8 @@ TypeCategoryMap::GetFormat(FormattersMat
 
   if (log) {
     for (auto match : match_data.GetMatchesVector()) {
-      log->Printf(
+      LLDB_LOGF(
+          log,
           "[CategoryMap::GetFormat] candidate match = %s %s %s %s reason = "
           "%" PRIu32,
           match.GetTypeName().GetCString(),
@@ -194,18 +195,16 @@ TypeCategoryMap::GetFormat(FormattersMat
   for (begin = m_active_categories.begin(); begin != end; begin++) {
     lldb::TypeCategoryImplSP category_sp = *begin;
     lldb::TypeFormatImplSP current_format;
-    if (log)
-      log->Printf("[TypeCategoryMap::GetFormat] Trying to use category %s",
-                  category_sp->GetName());
+    LLDB_LOGF(log, "[TypeCategoryMap::GetFormat] Trying to use category %s",
+              category_sp->GetName());
     if (!category_sp->Get(match_data.GetValueObject(),
                           match_data.GetMatchesVector(), current_format,
                           &reason_why))
       continue;
     return current_format;
   }
-  if (log)
-    log->Printf(
-        "[TypeCategoryMap::GetFormat] nothing found - returning empty SP");
+  LLDB_LOGF(log,
+            "[TypeCategoryMap::GetFormat] nothing found - returning empty SP");
   return lldb::TypeFormatImplSP();
 }
 
@@ -220,7 +219,8 @@ TypeCategoryMap::GetSummaryFormat(Format
 
   if (log) {
     for (auto match : match_data.GetMatchesVector()) {
-      log->Printf(
+      LLDB_LOGF(
+          log,
           "[CategoryMap::GetSummaryFormat] candidate match = %s %s %s %s "
           "reason = %" PRIu32,
           match.GetTypeName().GetCString(),
@@ -234,18 +234,17 @@ TypeCategoryMap::GetSummaryFormat(Format
   for (begin = m_active_categories.begin(); begin != end; begin++) {
     lldb::TypeCategoryImplSP category_sp = *begin;
     lldb::TypeSummaryImplSP current_format;
-    if (log)
-      log->Printf("[CategoryMap::GetSummaryFormat] Trying to use category %s",
-                  category_sp->GetName());
+    LLDB_LOGF(log, "[CategoryMap::GetSummaryFormat] Trying to use category %s",
+              category_sp->GetName());
     if (!category_sp->Get(match_data.GetValueObject(),
                           match_data.GetMatchesVector(), current_format,
                           &reason_why))
       continue;
     return current_format;
   }
-  if (log)
-    log->Printf(
-        "[CategoryMap::GetSummaryFormat] nothing found - returning empty SP");
+  LLDB_LOGF(
+      log,
+      "[CategoryMap::GetSummaryFormat] nothing found - returning empty SP");
   return lldb::TypeSummaryImplSP();
 }
 
@@ -261,7 +260,8 @@ TypeCategoryMap::GetSyntheticChildren(Fo
 
   if (log) {
     for (auto match : match_data.GetMatchesVector()) {
-      log->Printf(
+      LLDB_LOGF(
+          log,
           "[CategoryMap::GetSyntheticChildren] candidate match = %s %s %s %s "
           "reason = %" PRIu32,
           match.GetTypeName().GetCString(),
@@ -275,19 +275,18 @@ TypeCategoryMap::GetSyntheticChildren(Fo
   for (begin = m_active_categories.begin(); begin != end; begin++) {
     lldb::TypeCategoryImplSP category_sp = *begin;
     lldb::SyntheticChildrenSP current_format;
-    if (log)
-      log->Printf(
-          "[CategoryMap::GetSyntheticChildren] Trying to use category %s",
-          category_sp->GetName());
+    LLDB_LOGF(log,
+              "[CategoryMap::GetSyntheticChildren] Trying to use category %s",
+              category_sp->GetName());
     if (!category_sp->Get(match_data.GetValueObject(),
                           match_data.GetMatchesVector(), current_format,
                           &reason_why))
       continue;
     return current_format;
   }
-  if (log)
-    log->Printf("[CategoryMap::GetSyntheticChildren] nothing found - returning "
-                "empty SP");
+  LLDB_LOGF(log,
+            "[CategoryMap::GetSyntheticChildren] nothing found - returning "
+            "empty SP");
   return lldb::SyntheticChildrenSP();
 }
 
@@ -302,7 +301,8 @@ TypeCategoryMap::GetValidator(Formatters
 
   if (log) {
     for (auto match : match_data.GetMatchesVector()) {
-      log->Printf(
+      LLDB_LOGF(
+          log,
           "[CategoryMap::GetValidator] candidate match = %s %s %s %s reason = "
           "%" PRIu32,
           match.GetTypeName().GetCString(),
@@ -316,18 +316,16 @@ TypeCategoryMap::GetValidator(Formatters
   for (begin = m_active_categories.begin(); begin != end; begin++) {
     lldb::TypeCategoryImplSP category_sp = *begin;
     lldb::TypeValidatorImplSP current_format;
-    if (log)
-      log->Printf("[CategoryMap::GetValidator] Trying to use category %s",
-                  category_sp->GetName());
+    LLDB_LOGF(log, "[CategoryMap::GetValidator] Trying to use category %s",
+              category_sp->GetName());
     if (!category_sp->Get(match_data.GetValueObject(),
                           match_data.GetMatchesVector(), current_format,
                           &reason_why))
       continue;
     return current_format;
   }
-  if (log)
-    log->Printf(
-        "[CategoryMap::GetValidator] nothing found - returning empty SP");
+  LLDB_LOGF(log,
+            "[CategoryMap::GetValidator] nothing found - returning empty SP");
   return lldb::TypeValidatorImplSP();
 }
 

Modified: lldb/trunk/source/Expression/DWARFExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/DWARFExpression.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Expression/DWARFExpression.cpp (original)
+++ lldb/trunk/source/Expression/DWARFExpression.cpp Wed Jul 24 10:56:10 2019
@@ -1206,15 +1206,16 @@ bool DWARFExpression::Evaluate(
 
     if (log && log->GetVerbose()) {
       size_t count = stack.size();
-      log->Printf("Stack before operation has %" PRIu64 " values:",
-                  (uint64_t)count);
+      LLDB_LOGF(log, "Stack before operation has %" PRIu64 " values:",
+                (uint64_t)count);
       for (size_t i = 0; i < count; ++i) {
         StreamString new_value;
         new_value.Printf("[%" PRIu64 "]", (uint64_t)i);
         stack[i].Dump(&new_value);
-        log->Printf("  %s", new_value.GetData());
+        LLDB_LOGF(log, "  %s", new_value.GetData());
       }
-      log->Printf("0x%8.8" PRIx64 ": %s", op_offset, DW_OP_value_to_name(op));
+      LLDB_LOGF(log, "0x%8.8" PRIx64 ": %s", op_offset,
+                DW_OP_value_to_name(op));
     }
 
     switch (op) {
@@ -2686,9 +2687,8 @@ bool DWARFExpression::Evaluate(
     } break;
 
     default:
-      if (log)
-        log->Printf("Unhandled opcode %s in DWARFExpression.",
-                    DW_OP_value_to_name(op));
+      LLDB_LOGF(log, "Unhandled opcode %s in DWARFExpression.",
+                DW_OP_value_to_name(op));
       break;
     }
   }
@@ -2706,13 +2706,13 @@ bool DWARFExpression::Evaluate(
   } else {
     if (log && log->GetVerbose()) {
       size_t count = stack.size();
-      log->Printf("Stack after operation has %" PRIu64 " values:",
-                  (uint64_t)count);
+      LLDB_LOGF(log, "Stack after operation has %" PRIu64 " values:",
+                (uint64_t)count);
       for (size_t i = 0; i < count; ++i) {
         StreamString new_value;
         new_value.Printf("[%" PRIu64 "]", (uint64_t)i);
         stack[i].Dump(&new_value);
-        log->Printf("  %s", new_value.GetData());
+        LLDB_LOGF(log, "  %s", new_value.GetData());
       }
     }
     result = stack.back();

Modified: lldb/trunk/source/Expression/ExpressionVariable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ExpressionVariable.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ExpressionVariable.cpp (original)
+++ lldb/trunk/source/Expression/ExpressionVariable.cpp Wed Jul 24 10:56:10 2019
@@ -45,8 +45,7 @@ void PersistentExpressionState::Register
 
   m_execution_units.insert(execution_unit_sp);
 
-  if (log)
-    log->Printf("Registering JITted Functions:\n");
+  LLDB_LOGF(log, "Registering JITted Functions:\n");
 
   for (const IRExecutionUnit::JittedFunction &jitted_function :
        execution_unit_sp->GetJittedFunctions()) {
@@ -55,15 +54,13 @@ void PersistentExpressionState::Register
         jitted_function.m_remote_addr != LLDB_INVALID_ADDRESS) {
       m_symbol_map[jitted_function.m_name.GetCString()] =
           jitted_function.m_remote_addr;
-      if (log)
-        log->Printf("  Function: %s at 0x%" PRIx64 ".",
-                    jitted_function.m_name.GetCString(),
-                    jitted_function.m_remote_addr);
+      LLDB_LOGF(log, "  Function: %s at 0x%" PRIx64 ".",
+                jitted_function.m_name.GetCString(),
+                jitted_function.m_remote_addr);
     }
   }
 
-  if (log)
-    log->Printf("Registering JIIted Symbols:\n");
+  LLDB_LOGF(log, "Registering JIIted Symbols:\n");
 
   for (const IRExecutionUnit::JittedGlobalVariable &global_var :
        execution_unit_sp->GetJittedGlobalVariables()) {
@@ -74,9 +71,8 @@ void PersistentExpressionState::Register
       Mangled mangler(global_var.m_name);
       mangler.GetDemangledName(lldb::eLanguageTypeUnknown);
       m_symbol_map[global_var.m_name.GetCString()] = global_var.m_remote_addr;
-      if (log)
-        log->Printf("  Symbol: %s at 0x%" PRIx64 ".",
-                    global_var.m_name.GetCString(), global_var.m_remote_addr);
+      LLDB_LOGF(log, "  Symbol: %s at 0x%" PRIx64 ".",
+                global_var.m_name.GetCString(), global_var.m_remote_addr);
     }
   }
 }

Modified: lldb/trunk/source/Expression/FunctionCaller.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/FunctionCaller.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Expression/FunctionCaller.cpp (original)
+++ lldb/trunk/source/Expression/FunctionCaller.cpp Wed Jul 24 10:56:10 2019
@@ -217,9 +217,8 @@ bool FunctionCaller::InsertFunction(Exec
     return false;
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
-  if (log)
-    log->Printf("Call Address: 0x%" PRIx64 " Struct Address: 0x%" PRIx64 ".\n",
-                m_jit_start_addr, args_addr_ref);
+  LLDB_LOGF(log, "Call Address: 0x%" PRIx64 " Struct Address: 0x%" PRIx64 ".\n",
+            m_jit_start_addr, args_addr_ref);
 
   return true;
 }
@@ -231,10 +230,10 @@ lldb::ThreadPlanSP FunctionCaller::GetTh
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS |
                                                   LIBLLDB_LOG_STEP));
 
-  if (log)
-    log->Printf("-- [FunctionCaller::GetThreadPlanToCallFunction] Creating "
-                "thread plan to call function \"%s\" --",
-                m_name.c_str());
+  LLDB_LOGF(log,
+            "-- [FunctionCaller::GetThreadPlanToCallFunction] Creating "
+            "thread plan to call function \"%s\" --",
+            m_name.c_str());
 
   // FIXME: Use the errors Stream for better error reporting.
   Thread *thread = exe_ctx.GetThreadPtr();
@@ -271,10 +270,10 @@ bool FunctionCaller::FetchFunctionResult
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS |
                                                   LIBLLDB_LOG_STEP));
 
-  if (log)
-    log->Printf("-- [FunctionCaller::FetchFunctionResults] Fetching function "
-                "results for \"%s\"--",
-                m_name.c_str());
+  LLDB_LOGF(log,
+            "-- [FunctionCaller::FetchFunctionResults] Fetching function "
+            "results for \"%s\"--",
+            m_name.c_str());
 
   Process *process = exe_ctx.GetProcessPtr();
 
@@ -341,10 +340,9 @@ lldb::ExpressionResults FunctionCaller::
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS |
                                                   LIBLLDB_LOG_STEP));
 
-  if (log)
-    log->Printf(
-        "== [FunctionCaller::ExecuteFunction] Executing function \"%s\" ==",
-        m_name.c_str());
+  LLDB_LOGF(log,
+            "== [FunctionCaller::ExecuteFunction] Executing function \"%s\" ==",
+            m_name.c_str());
 
   lldb::ThreadPlanSP call_plan_sp = GetThreadPlanToCallFunction(
       exe_ctx, args_addr, real_options, diagnostic_manager);
@@ -362,13 +360,15 @@ lldb::ExpressionResults FunctionCaller::
 
   if (log) {
     if (return_value != lldb::eExpressionCompleted) {
-      log->Printf("== [FunctionCaller::ExecuteFunction] Execution of \"%s\" "
-                  "completed abnormally ==",
-                  m_name.c_str());
+      LLDB_LOGF(log,
+                "== [FunctionCaller::ExecuteFunction] Execution of \"%s\" "
+                "completed abnormally ==",
+                m_name.c_str());
     } else {
-      log->Printf("== [FunctionCaller::ExecuteFunction] Execution of \"%s\" "
-                  "completed normally ==",
-                  m_name.c_str());
+      LLDB_LOGF(log,
+                "== [FunctionCaller::ExecuteFunction] Execution of \"%s\" "
+                "completed normally ==",
+                m_name.c_str());
     }
   }
 

Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRExecutionUnit.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original)
+++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Wed Jul 24 10:56:10 2019
@@ -122,10 +122,10 @@ Status IRExecutionUnit::DisassembleFunct
     return ret;
   }
 
-  if (log)
-    log->Printf("Found function, has local address 0x%" PRIx64
-                " and remote address 0x%" PRIx64,
-                (uint64_t)func_local_addr, (uint64_t)func_remote_addr);
+  LLDB_LOGF(log,
+            "Found function, has local address 0x%" PRIx64
+            " and remote address 0x%" PRIx64,
+            (uint64_t)func_local_addr, (uint64_t)func_remote_addr);
 
   std::pair<lldb::addr_t, lldb::addr_t> func_range;
 
@@ -138,9 +138,8 @@ Status IRExecutionUnit::DisassembleFunct
     return ret;
   }
 
-  if (log)
-    log->Printf("Function's code range is [0x%" PRIx64 "+0x%" PRIx64 "]",
-                func_range.first, func_range.second);
+  LLDB_LOGF(log, "Function's code range is [0x%" PRIx64 "+0x%" PRIx64 "]",
+            func_range.first, func_range.second);
 
   Target *target = exe_ctx.GetTargetPtr();
   if (!target) {
@@ -188,7 +187,7 @@ Status IRExecutionUnit::DisassembleFunct
                           target->GetArchitecture().GetAddressByteSize());
 
   if (log) {
-    log->Printf("Function data has contents:");
+    LLDB_LOGF(log, "Function data has contents:");
     extractor.PutToLog(log, 0, extractor.GetByteSize(), func_remote_addr, 16,
                        DataExtractor::TypeUInt8);
   }
@@ -255,7 +254,7 @@ void IRExecutionUnit::GetRunnableInfo(St
 
     oss.flush();
 
-    log->Printf("Module being sent to JIT: \n%s", s.c_str());
+    LLDB_LOGF(log, "Module being sent to JIT: \n%s", s.c_str());
   }
 
   m_module_up->getContext().setInlineAsmDiagnosticHandler(ReportInlineAsmError,
@@ -433,20 +432,20 @@ void IRExecutionUnit::GetRunnableInfo(St
   }
 
   if (log) {
-    log->Printf("Code can be run in the target.");
+    LLDB_LOGF(log, "Code can be run in the target.");
 
     StreamString disassembly_stream;
 
     Status err = DisassembleFunction(disassembly_stream, process_sp);
 
     if (!err.Success()) {
-      log->Printf("Couldn't disassemble function : %s",
-                  err.AsCString("unknown error"));
+      LLDB_LOGF(log, "Couldn't disassemble function : %s",
+                err.AsCString("unknown error"));
     } else {
-      log->Printf("Function disassembly:\n%s", disassembly_stream.GetData());
+      LLDB_LOGF(log, "Function disassembly:\n%s", disassembly_stream.GetData());
     }
 
-    log->Printf("Sections: ");
+    LLDB_LOGF(log, "Sections: ");
     for (AllocationRecord &record : m_records) {
       if (record.m_process_address != LLDB_INVALID_ADDRESS) {
         record.dump(log);
@@ -599,11 +598,10 @@ uint8_t *IRExecutionUnit::MemoryManager:
       GetSectionTypeFromSectionName(SectionName, AllocationKind::Code), Size,
       Alignment, SectionID, SectionName.str().c_str()));
 
-  if (log) {
-    log->Printf("IRExecutionUnit::allocateCodeSection(Size=0x%" PRIx64
-                ", Alignment=%u, SectionID=%u) = %p",
-                (uint64_t)Size, Alignment, SectionID, (void *)return_value);
-  }
+  LLDB_LOGF(log,
+            "IRExecutionUnit::allocateCodeSection(Size=0x%" PRIx64
+            ", Alignment=%u, SectionID=%u) = %p",
+            (uint64_t)Size, Alignment, SectionID, (void *)return_value);
 
   if (m_parent.m_reported_allocations) {
     Status err;
@@ -631,11 +629,10 @@ uint8_t *IRExecutionUnit::MemoryManager:
       (uintptr_t)return_value, permissions,
       GetSectionTypeFromSectionName(SectionName, AllocationKind::Data), Size,
       Alignment, SectionID, SectionName.str().c_str()));
-  if (log) {
-    log->Printf("IRExecutionUnit::allocateDataSection(Size=0x%" PRIx64
-                ", Alignment=%u, SectionID=%u) = %p",
-                (uint64_t)Size, Alignment, SectionID, (void *)return_value);
-  }
+  LLDB_LOGF(log,
+            "IRExecutionUnit::allocateDataSection(Size=0x%" PRIx64
+            ", Alignment=%u, SectionID=%u) = %p",
+            (uint64_t)Size, Alignment, SectionID, (void *)return_value);
 
   if (m_parent.m_reported_allocations) {
     Status err;
@@ -1042,17 +1039,15 @@ IRExecutionUnit::MemoryManager::GetSymbo
   lldb::addr_t ret = m_parent.FindSymbol(name_cs, missing_weak);
 
   if (ret == LLDB_INVALID_ADDRESS) {
-    if (log)
-      log->Printf(
-          "IRExecutionUnit::getSymbolAddress(Name=\"%s\") = <not found>",
-          Name.c_str());
+    LLDB_LOGF(log,
+              "IRExecutionUnit::getSymbolAddress(Name=\"%s\") = <not found>",
+              Name.c_str());
 
     m_parent.ReportSymbolLookupError(name_cs);
     return 0;
   } else {
-    if (log)
-      log->Printf("IRExecutionUnit::getSymbolAddress(Name=\"%s\") = %" PRIx64,
-                  Name.c_str(), ret);
+    LLDB_LOGF(log, "IRExecutionUnit::getSymbolAddress(Name=\"%s\") = %" PRIx64,
+              Name.c_str(), ret);
     return ret;
   }
 }
@@ -1075,15 +1070,14 @@ IRExecutionUnit::GetRemoteAddressForLoca
       lldb::addr_t ret =
           record.m_process_address + (local_address - record.m_host_address);
 
-      if (log) {
-        log->Printf(
-            "IRExecutionUnit::GetRemoteAddressForLocal() found 0x%" PRIx64
-            " in [0x%" PRIx64 "..0x%" PRIx64 "], and returned 0x%" PRIx64
-            " from [0x%" PRIx64 "..0x%" PRIx64 "].",
-            local_address, (uint64_t)record.m_host_address,
-            (uint64_t)record.m_host_address + (uint64_t)record.m_size, ret,
-            record.m_process_address, record.m_process_address + record.m_size);
-      }
+      LLDB_LOGF(log,
+                "IRExecutionUnit::GetRemoteAddressForLocal() found 0x%" PRIx64
+                " in [0x%" PRIx64 "..0x%" PRIx64 "], and returned 0x%" PRIx64
+                " from [0x%" PRIx64 "..0x%" PRIx64 "].",
+                local_address, (uint64_t)record.m_host_address,
+                (uint64_t)record.m_host_address + (uint64_t)record.m_size, ret,
+                record.m_process_address,
+                record.m_process_address + record.m_size);
 
       return ret;
     }
@@ -1210,10 +1204,11 @@ void IRExecutionUnit::AllocationRecord::
   if (!log)
     return;
 
-  log->Printf("[0x%llx+0x%llx]->0x%llx (alignment %d, section ID %d, name %s)",
-              (unsigned long long)m_host_address, (unsigned long long)m_size,
-              (unsigned long long)m_process_address, (unsigned)m_alignment,
-              (unsigned)m_section_id, m_name.c_str());
+  LLDB_LOGF(log,
+            "[0x%llx+0x%llx]->0x%llx (alignment %d, section ID %d, name %s)",
+            (unsigned long long)m_host_address, (unsigned long long)m_size,
+            (unsigned long long)m_process_address, (unsigned)m_alignment,
+            (unsigned)m_section_id, m_name.c_str());
 }
 
 lldb::ByteOrder IRExecutionUnit::GetByteOrder() const {

Modified: lldb/trunk/source/Expression/IRInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRInterpreter.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRInterpreter.cpp (original)
+++ lldb/trunk/source/Expression/IRInterpreter.cpp Wed Jul 24 10:56:10 2019
@@ -327,10 +327,11 @@ public:
         lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
     if (log) {
-      log->Printf("Made an allocation for argument %s",
-                  PrintValue(value).c_str());
-      log->Printf("  Data region    : %llx", (unsigned long long)address);
-      log->Printf("  Ref region     : %llx", (unsigned long long)data_address);
+      LLDB_LOGF(log, "Made an allocation for argument %s",
+                PrintValue(value).c_str());
+      LLDB_LOGF(log, "  Data region    : %llx", (unsigned long long)address);
+      LLDB_LOGF(log, "  Ref region     : %llx",
+                (unsigned long long)data_address);
     }
 
     return true;
@@ -494,8 +495,7 @@ bool IRInterpreter::CanInterpret(llvm::M
        ++fi) {
     if (fi->begin() != fi->end()) {
       if (saw_function_with_body) {
-        if (log)
-          log->Printf("More than one function in the module has a body");
+        LLDB_LOGF(log, "More than one function in the module has a body");
         error.SetErrorToGenericError();
         error.SetErrorString(too_many_functions_error);
         return false;
@@ -510,8 +510,7 @@ bool IRInterpreter::CanInterpret(llvm::M
          ++ii) {
       switch (ii->getOpcode()) {
       default: {
-        if (log)
-          log->Printf("Unsupported instruction: %s", PrintValue(&*ii).c_str());
+        LLDB_LOGF(log, "Unsupported instruction: %s", PrintValue(&*ii).c_str());
         error.SetErrorToGenericError();
         error.SetErrorString(unsupported_opcode_error);
         return false;
@@ -532,9 +531,8 @@ bool IRInterpreter::CanInterpret(llvm::M
         }
 
         if (!CanIgnoreCall(call_inst) && !support_function_calls) {
-          if (log)
-            log->Printf("Unsupported instruction: %s",
-                        PrintValue(&*ii).c_str());
+          LLDB_LOGF(log, "Unsupported instruction: %s",
+                    PrintValue(&*ii).c_str());
           error.SetErrorToGenericError();
           error.SetErrorString(unsupported_opcode_error);
           return false;
@@ -553,9 +551,8 @@ bool IRInterpreter::CanInterpret(llvm::M
 
         switch (icmp_inst->getPredicate()) {
         default: {
-          if (log)
-            log->Printf("Unsupported ICmp predicate: %s",
-                        PrintValue(&*ii).c_str());
+          LLDB_LOGF(log, "Unsupported ICmp predicate: %s",
+                    PrintValue(&*ii).c_str());
 
           error.SetErrorToGenericError();
           error.SetErrorString(unsupported_opcode_error);
@@ -605,9 +602,8 @@ bool IRInterpreter::CanInterpret(llvm::M
         default:
           break;
         case Type::VectorTyID: {
-          if (log)
-            log->Printf("Unsupported operand type: %s",
-                        PrintType(operand_type).c_str());
+          LLDB_LOGF(log, "Unsupported operand type: %s",
+                    PrintType(operand_type).c_str());
           error.SetErrorString(unsupported_operand_error);
           return false;
         }
@@ -618,18 +614,16 @@ bool IRInterpreter::CanInterpret(llvm::M
         // we can just fall back to the JIT rather than
         // choking.
         if (operand_type->getPrimitiveSizeInBits() > 64) {
-          if (log)
-            log->Printf("Unsupported operand type: %s",
-                        PrintType(operand_type).c_str());
+          LLDB_LOGF(log, "Unsupported operand type: %s",
+                    PrintType(operand_type).c_str());
           error.SetErrorString(unsupported_operand_error);
           return false;
         }
 
         if (Constant *constant = llvm::dyn_cast<Constant>(operand)) {
           if (!CanResolveConstant(constant)) {
-            if (log)
-              log->Printf("Unsupported constant: %s",
-                          PrintValue(constant).c_str());
+            LLDB_LOGF(log, "Unsupported constant: %s",
+                      PrintValue(constant).c_str());
             error.SetErrorString(unsupported_operand_error);
             return false;
           }
@@ -659,8 +653,8 @@ bool IRInterpreter::Interpret(llvm::Modu
 
     oss.flush();
 
-    log->Printf("Module as passed in to IRInterpreter::Interpret: \n\"%s\"",
-                s.c_str());
+    LLDB_LOGF(log, "Module as passed in to IRInterpreter::Interpret: \n\"%s\"",
+              s.c_str());
   }
 
   DataLayout data_layout(&module);
@@ -694,8 +688,7 @@ bool IRInterpreter::Interpret(llvm::Modu
   while (frame.m_ii != frame.m_ie && (++num_insts < 4096)) {
     const Instruction *inst = &*frame.m_ii;
 
-    if (log)
-      log->Printf("Interpreting %s", PrintValue(inst).c_str());
+    LLDB_LOGF(log, "Interpreting %s", PrintValue(inst).c_str());
 
     switch (inst->getOpcode()) {
     default:
@@ -717,10 +710,10 @@ bool IRInterpreter::Interpret(llvm::Modu
       const BinaryOperator *bin_op = dyn_cast<BinaryOperator>(inst);
 
       if (!bin_op) {
-        if (log)
-          log->Printf(
-              "getOpcode() returns %s, but instruction is not a BinaryOperator",
-              inst->getOpcodeName());
+        LLDB_LOGF(
+            log,
+            "getOpcode() returns %s, but instruction is not a BinaryOperator",
+            inst->getOpcodeName());
         error.SetErrorToGenericError();
         error.SetErrorString(interpreter_internal_error);
         return false;
@@ -733,16 +726,14 @@ bool IRInterpreter::Interpret(llvm::Modu
       lldb_private::Scalar R;
 
       if (!frame.EvaluateValue(L, lhs, module)) {
-        if (log)
-          log->Printf("Couldn't evaluate %s", PrintValue(lhs).c_str());
+        LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(lhs).c_str());
         error.SetErrorToGenericError();
         error.SetErrorString(bad_value_error);
         return false;
       }
 
       if (!frame.EvaluateValue(R, rhs, module)) {
-        if (log)
-          log->Printf("Couldn't evaluate %s", PrintValue(rhs).c_str());
+        LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(rhs).c_str());
         error.SetErrorToGenericError();
         error.SetErrorString(bad_value_error);
         return false;
@@ -806,28 +797,26 @@ bool IRInterpreter::Interpret(llvm::Modu
       frame.AssignValue(inst, result, module);
 
       if (log) {
-        log->Printf("Interpreted a %s", inst->getOpcodeName());
-        log->Printf("  L : %s", frame.SummarizeValue(lhs).c_str());
-        log->Printf("  R : %s", frame.SummarizeValue(rhs).c_str());
-        log->Printf("  = : %s", frame.SummarizeValue(inst).c_str());
+        LLDB_LOGF(log, "Interpreted a %s", inst->getOpcodeName());
+        LLDB_LOGF(log, "  L : %s", frame.SummarizeValue(lhs).c_str());
+        LLDB_LOGF(log, "  R : %s", frame.SummarizeValue(rhs).c_str());
+        LLDB_LOGF(log, "  = : %s", frame.SummarizeValue(inst).c_str());
       }
     } break;
     case Instruction::Alloca: {
       const AllocaInst *alloca_inst = dyn_cast<AllocaInst>(inst);
 
       if (!alloca_inst) {
-        if (log)
-          log->Printf("getOpcode() returns Alloca, but instruction is not an "
-                      "AllocaInst");
+        LLDB_LOGF(log, "getOpcode() returns Alloca, but instruction is not an "
+                       "AllocaInst");
         error.SetErrorToGenericError();
         error.SetErrorString(interpreter_internal_error);
         return false;
       }
 
       if (alloca_inst->isArrayAllocation()) {
-        if (log)
-          log->Printf(
-              "AllocaInsts are not handled if isArrayAllocation() is true");
+        LLDB_LOGF(log,
+                  "AllocaInsts are not handled if isArrayAllocation() is true");
         error.SetErrorToGenericError();
         error.SetErrorString(unsupported_opcode_error);
         return false;
@@ -846,8 +835,7 @@ bool IRInterpreter::Interpret(llvm::Modu
       lldb::addr_t R = frame.Malloc(T);
 
       if (R == LLDB_INVALID_ADDRESS) {
-        if (log)
-          log->Printf("Couldn't allocate memory for an AllocaInst");
+        LLDB_LOGF(log, "Couldn't allocate memory for an AllocaInst");
         error.SetErrorToGenericError();
         error.SetErrorString(memory_allocation_error);
         return false;
@@ -856,8 +844,8 @@ bool IRInterpreter::Interpret(llvm::Modu
       lldb::addr_t P = frame.Malloc(Tptr);
 
       if (P == LLDB_INVALID_ADDRESS) {
-        if (log)
-          log->Printf("Couldn't allocate the result pointer for an AllocaInst");
+        LLDB_LOGF(log,
+                  "Couldn't allocate the result pointer for an AllocaInst");
         error.SetErrorToGenericError();
         error.SetErrorString(memory_allocation_error);
         return false;
@@ -868,8 +856,7 @@ bool IRInterpreter::Interpret(llvm::Modu
       execution_unit.WritePointerToMemory(P, R, write_error);
 
       if (!write_error.Success()) {
-        if (log)
-          log->Printf("Couldn't write the result pointer for an AllocaInst");
+        LLDB_LOGF(log, "Couldn't write the result pointer for an AllocaInst");
         error.SetErrorToGenericError();
         error.SetErrorString(memory_write_error);
         lldb_private::Status free_error;
@@ -881,9 +868,9 @@ bool IRInterpreter::Interpret(llvm::Modu
       frame.m_values[alloca_inst] = P;
 
       if (log) {
-        log->Printf("Interpreted an AllocaInst");
-        log->Printf("  R : 0x%" PRIx64, R);
-        log->Printf("  P : 0x%" PRIx64, P);
+        LLDB_LOGF(log, "Interpreted an AllocaInst");
+        LLDB_LOGF(log, "  R : 0x%" PRIx64, R);
+        LLDB_LOGF(log, "  P : 0x%" PRIx64, P);
       }
     } break;
     case Instruction::BitCast:
@@ -891,10 +878,9 @@ bool IRInterpreter::Interpret(llvm::Modu
       const CastInst *cast_inst = dyn_cast<CastInst>(inst);
 
       if (!cast_inst) {
-        if (log)
-          log->Printf(
-              "getOpcode() returns %s, but instruction is not a BitCastInst",
-              cast_inst->getOpcodeName());
+        LLDB_LOGF(
+            log, "getOpcode() returns %s, but instruction is not a BitCastInst",
+            cast_inst->getOpcodeName());
         error.SetErrorToGenericError();
         error.SetErrorString(interpreter_internal_error);
         return false;
@@ -905,8 +891,7 @@ bool IRInterpreter::Interpret(llvm::Modu
       lldb_private::Scalar S;
 
       if (!frame.EvaluateValue(S, source, module)) {
-        if (log)
-          log->Printf("Couldn't evaluate %s", PrintValue(source).c_str());
+        LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(source).c_str());
         error.SetErrorToGenericError();
         error.SetErrorString(bad_value_error);
         return false;
@@ -918,10 +903,9 @@ bool IRInterpreter::Interpret(llvm::Modu
       const CastInst *cast_inst = dyn_cast<CastInst>(inst);
 
       if (!cast_inst) {
-        if (log)
-          log->Printf(
-              "getOpcode() returns %s, but instruction is not a BitCastInst",
-              cast_inst->getOpcodeName());
+        LLDB_LOGF(
+            log, "getOpcode() returns %s, but instruction is not a BitCastInst",
+            cast_inst->getOpcodeName());
         error.SetErrorToGenericError();
         error.SetErrorString(interpreter_internal_error);
         return false;
@@ -932,8 +916,7 @@ bool IRInterpreter::Interpret(llvm::Modu
       lldb_private::Scalar S;
 
       if (!frame.EvaluateValue(S, source, module)) {
-        if (log)
-          log->Printf("Couldn't evaluate %s", PrintValue(source).c_str());
+        LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(source).c_str());
         error.SetErrorToGenericError();
         error.SetErrorString(bad_value_error);
         return false;
@@ -949,9 +932,8 @@ bool IRInterpreter::Interpret(llvm::Modu
       const BranchInst *br_inst = dyn_cast<BranchInst>(inst);
 
       if (!br_inst) {
-        if (log)
-          log->Printf(
-              "getOpcode() returns Br, but instruction is not a BranchInst");
+        LLDB_LOGF(
+            log, "getOpcode() returns Br, but instruction is not a BranchInst");
         error.SetErrorToGenericError();
         error.SetErrorString(interpreter_internal_error);
         return false;
@@ -963,8 +945,7 @@ bool IRInterpreter::Interpret(llvm::Modu
         lldb_private::Scalar C;
 
         if (!frame.EvaluateValue(C, condition, module)) {
-          if (log)
-            log->Printf("Couldn't evaluate %s", PrintValue(condition).c_str());
+          LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(condition).c_str());
           error.SetErrorToGenericError();
           error.SetErrorString(bad_value_error);
           return false;
@@ -976,14 +957,15 @@ bool IRInterpreter::Interpret(llvm::Modu
           frame.Jump(br_inst->getSuccessor(1));
 
         if (log) {
-          log->Printf("Interpreted a BrInst with a condition");
-          log->Printf("  cond : %s", frame.SummarizeValue(condition).c_str());
+          LLDB_LOGF(log, "Interpreted a BrInst with a condition");
+          LLDB_LOGF(log, "  cond : %s",
+                    frame.SummarizeValue(condition).c_str());
         }
       } else {
         frame.Jump(br_inst->getSuccessor(0));
 
         if (log) {
-          log->Printf("Interpreted a BrInst with no condition");
+          LLDB_LOGF(log, "Interpreted a BrInst with no condition");
         }
       }
     }
@@ -992,17 +974,16 @@ bool IRInterpreter::Interpret(llvm::Modu
       const PHINode *phi_inst = dyn_cast<PHINode>(inst);
 
       if (!phi_inst) {
-        if (log)
-          log->Printf(
-              "getOpcode() returns PHI, but instruction is not a PHINode");
+        LLDB_LOGF(log,
+                  "getOpcode() returns PHI, but instruction is not a PHINode");
         error.SetErrorToGenericError();
         error.SetErrorString(interpreter_internal_error);
         return false;
       }
       if (!frame.m_prev_bb) {
-        if (log)
-          log->Printf("Encountered PHI node without having jumped from another "
-                      "basic block");
+        LLDB_LOGF(log,
+                  "Encountered PHI node without having jumped from another "
+                  "basic block");
         error.SetErrorToGenericError();
         error.SetErrorString(interpreter_internal_error);
         return false;
@@ -1011,8 +992,7 @@ bool IRInterpreter::Interpret(llvm::Modu
       Value *value = phi_inst->getIncomingValueForBlock(frame.m_prev_bb);
       lldb_private::Scalar result;
       if (!frame.EvaluateValue(result, value, module)) {
-        if (log)
-          log->Printf("Couldn't evaluate %s", PrintValue(value).c_str());
+        LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(value).c_str());
         error.SetErrorToGenericError();
         error.SetErrorString(bad_value_error);
         return false;
@@ -1020,18 +1000,17 @@ bool IRInterpreter::Interpret(llvm::Modu
       frame.AssignValue(inst, result, module);
 
       if (log) {
-        log->Printf("Interpreted a %s", inst->getOpcodeName());
-        log->Printf("  Incoming value : %s",
-                    frame.SummarizeValue(value).c_str());
+        LLDB_LOGF(log, "Interpreted a %s", inst->getOpcodeName());
+        LLDB_LOGF(log, "  Incoming value : %s",
+                  frame.SummarizeValue(value).c_str());
       }
     } break;
     case Instruction::GetElementPtr: {
       const GetElementPtrInst *gep_inst = dyn_cast<GetElementPtrInst>(inst);
 
       if (!gep_inst) {
-        if (log)
-          log->Printf("getOpcode() returns GetElementPtr, but instruction is "
-                      "not a GetElementPtrInst");
+        LLDB_LOGF(log, "getOpcode() returns GetElementPtr, but instruction is "
+                       "not a GetElementPtrInst");
         error.SetErrorToGenericError();
         error.SetErrorString(interpreter_internal_error);
         return false;
@@ -1043,9 +1022,8 @@ bool IRInterpreter::Interpret(llvm::Modu
       lldb_private::Scalar P;
 
       if (!frame.EvaluateValue(P, pointer_operand, module)) {
-        if (log)
-          log->Printf("Couldn't evaluate %s",
-                      PrintValue(pointer_operand).c_str());
+        LLDB_LOGF(log, "Couldn't evaluate %s",
+                  PrintValue(pointer_operand).c_str());
         error.SetErrorToGenericError();
         error.SetErrorString(bad_value_error);
         return false;
@@ -1067,17 +1045,14 @@ bool IRInterpreter::Interpret(llvm::Modu
           lldb_private::Scalar I;
 
           if (!frame.EvaluateValue(I, *ii, module)) {
-            if (log)
-              log->Printf("Couldn't evaluate %s", PrintValue(*ii).c_str());
+            LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(*ii).c_str());
             error.SetErrorToGenericError();
             error.SetErrorString(bad_value_error);
             return false;
           }
 
-          if (log)
-            log->Printf("Evaluated constant index %s as %llu",
-                        PrintValue(*ii).c_str(),
-                        I.ULongLong(LLDB_INVALID_ADDRESS));
+          LLDB_LOGF(log, "Evaluated constant index %s as %llu",
+                    PrintValue(*ii).c_str(), I.ULongLong(LLDB_INVALID_ADDRESS));
 
           constant_index = cast<ConstantInt>(ConstantInt::get(
               (*ii)->getType(), I.ULongLong(LLDB_INVALID_ADDRESS)));
@@ -1094,19 +1069,19 @@ bool IRInterpreter::Interpret(llvm::Modu
       frame.AssignValue(inst, Poffset, module);
 
       if (log) {
-        log->Printf("Interpreted a GetElementPtrInst");
-        log->Printf("  P       : %s",
-                    frame.SummarizeValue(pointer_operand).c_str());
-        log->Printf("  Poffset : %s", frame.SummarizeValue(inst).c_str());
+        LLDB_LOGF(log, "Interpreted a GetElementPtrInst");
+        LLDB_LOGF(log, "  P       : %s",
+                  frame.SummarizeValue(pointer_operand).c_str());
+        LLDB_LOGF(log, "  Poffset : %s", frame.SummarizeValue(inst).c_str());
       }
     } break;
     case Instruction::ICmp: {
       const ICmpInst *icmp_inst = dyn_cast<ICmpInst>(inst);
 
       if (!icmp_inst) {
-        if (log)
-          log->Printf(
-              "getOpcode() returns ICmp, but instruction is not an ICmpInst");
+        LLDB_LOGF(
+            log,
+            "getOpcode() returns ICmp, but instruction is not an ICmpInst");
         error.SetErrorToGenericError();
         error.SetErrorString(interpreter_internal_error);
         return false;
@@ -1121,16 +1096,14 @@ bool IRInterpreter::Interpret(llvm::Modu
       lldb_private::Scalar R;
 
       if (!frame.EvaluateValue(L, lhs, module)) {
-        if (log)
-          log->Printf("Couldn't evaluate %s", PrintValue(lhs).c_str());
+        LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(lhs).c_str());
         error.SetErrorToGenericError();
         error.SetErrorString(bad_value_error);
         return false;
       }
 
       if (!frame.EvaluateValue(R, rhs, module)) {
-        if (log)
-          log->Printf("Couldn't evaluate %s", PrintValue(rhs).c_str());
+        LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(rhs).c_str());
         error.SetErrorToGenericError();
         error.SetErrorString(bad_value_error);
         return false;
@@ -1192,19 +1165,19 @@ bool IRInterpreter::Interpret(llvm::Modu
       frame.AssignValue(inst, result, module);
 
       if (log) {
-        log->Printf("Interpreted an ICmpInst");
-        log->Printf("  L : %s", frame.SummarizeValue(lhs).c_str());
-        log->Printf("  R : %s", frame.SummarizeValue(rhs).c_str());
-        log->Printf("  = : %s", frame.SummarizeValue(inst).c_str());
+        LLDB_LOGF(log, "Interpreted an ICmpInst");
+        LLDB_LOGF(log, "  L : %s", frame.SummarizeValue(lhs).c_str());
+        LLDB_LOGF(log, "  R : %s", frame.SummarizeValue(rhs).c_str());
+        LLDB_LOGF(log, "  = : %s", frame.SummarizeValue(inst).c_str());
       }
     } break;
     case Instruction::IntToPtr: {
       const IntToPtrInst *int_to_ptr_inst = dyn_cast<IntToPtrInst>(inst);
 
       if (!int_to_ptr_inst) {
-        if (log)
-          log->Printf("getOpcode() returns IntToPtr, but instruction is not an "
-                      "IntToPtrInst");
+        LLDB_LOGF(log,
+                  "getOpcode() returns IntToPtr, but instruction is not an "
+                  "IntToPtrInst");
         error.SetErrorToGenericError();
         error.SetErrorString(interpreter_internal_error);
         return false;
@@ -1215,8 +1188,7 @@ bool IRInterpreter::Interpret(llvm::Modu
       lldb_private::Scalar I;
 
       if (!frame.EvaluateValue(I, src_operand, module)) {
-        if (log)
-          log->Printf("Couldn't evaluate %s", PrintValue(src_operand).c_str());
+        LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(src_operand).c_str());
         error.SetErrorToGenericError();
         error.SetErrorString(bad_value_error);
         return false;
@@ -1225,18 +1197,18 @@ bool IRInterpreter::Interpret(llvm::Modu
       frame.AssignValue(inst, I, module);
 
       if (log) {
-        log->Printf("Interpreted an IntToPtr");
-        log->Printf("  Src : %s", frame.SummarizeValue(src_operand).c_str());
-        log->Printf("  =   : %s", frame.SummarizeValue(inst).c_str());
+        LLDB_LOGF(log, "Interpreted an IntToPtr");
+        LLDB_LOGF(log, "  Src : %s", frame.SummarizeValue(src_operand).c_str());
+        LLDB_LOGF(log, "  =   : %s", frame.SummarizeValue(inst).c_str());
       }
     } break;
     case Instruction::PtrToInt: {
       const PtrToIntInst *ptr_to_int_inst = dyn_cast<PtrToIntInst>(inst);
 
       if (!ptr_to_int_inst) {
-        if (log)
-          log->Printf("getOpcode() returns PtrToInt, but instruction is not an "
-                      "PtrToIntInst");
+        LLDB_LOGF(log,
+                  "getOpcode() returns PtrToInt, but instruction is not an "
+                  "PtrToIntInst");
         error.SetErrorToGenericError();
         error.SetErrorString(interpreter_internal_error);
         return false;
@@ -1247,8 +1219,7 @@ bool IRInterpreter::Interpret(llvm::Modu
       lldb_private::Scalar I;
 
       if (!frame.EvaluateValue(I, src_operand, module)) {
-        if (log)
-          log->Printf("Couldn't evaluate %s", PrintValue(src_operand).c_str());
+        LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(src_operand).c_str());
         error.SetErrorToGenericError();
         error.SetErrorString(bad_value_error);
         return false;
@@ -1257,18 +1228,18 @@ bool IRInterpreter::Interpret(llvm::Modu
       frame.AssignValue(inst, I, module);
 
       if (log) {
-        log->Printf("Interpreted a PtrToInt");
-        log->Printf("  Src : %s", frame.SummarizeValue(src_operand).c_str());
-        log->Printf("  =   : %s", frame.SummarizeValue(inst).c_str());
+        LLDB_LOGF(log, "Interpreted a PtrToInt");
+        LLDB_LOGF(log, "  Src : %s", frame.SummarizeValue(src_operand).c_str());
+        LLDB_LOGF(log, "  =   : %s", frame.SummarizeValue(inst).c_str());
       }
     } break;
     case Instruction::Trunc: {
       const TruncInst *trunc_inst = dyn_cast<TruncInst>(inst);
 
       if (!trunc_inst) {
-        if (log)
-          log->Printf(
-              "getOpcode() returns Trunc, but instruction is not a TruncInst");
+        LLDB_LOGF(
+            log,
+            "getOpcode() returns Trunc, but instruction is not a TruncInst");
         error.SetErrorToGenericError();
         error.SetErrorString(interpreter_internal_error);
         return false;
@@ -1279,8 +1250,7 @@ bool IRInterpreter::Interpret(llvm::Modu
       lldb_private::Scalar I;
 
       if (!frame.EvaluateValue(I, src_operand, module)) {
-        if (log)
-          log->Printf("Couldn't evaluate %s", PrintValue(src_operand).c_str());
+        LLDB_LOGF(log, "Couldn't evaluate %s", PrintValue(src_operand).c_str());
         error.SetErrorToGenericError();
         error.SetErrorString(bad_value_error);
         return false;
@@ -1289,18 +1259,17 @@ bool IRInterpreter::Interpret(llvm::Modu
       frame.AssignValue(inst, I, module);
 
       if (log) {
-        log->Printf("Interpreted a Trunc");
-        log->Printf("  Src : %s", frame.SummarizeValue(src_operand).c_str());
-        log->Printf("  =   : %s", frame.SummarizeValue(inst).c_str());
+        LLDB_LOGF(log, "Interpreted a Trunc");
+        LLDB_LOGF(log, "  Src : %s", frame.SummarizeValue(src_operand).c_str());
+        LLDB_LOGF(log, "  =   : %s", frame.SummarizeValue(inst).c_str());
       }
     } break;
     case Instruction::Load: {
       const LoadInst *load_inst = dyn_cast<LoadInst>(inst);
 
       if (!load_inst) {
-        if (log)
-          log->Printf(
-              "getOpcode() returns Load, but instruction is not a LoadInst");
+        LLDB_LOGF(
+            log, "getOpcode() returns Load, but instruction is not a LoadInst");
         error.SetErrorToGenericError();
         error.SetErrorString(interpreter_internal_error);
         return false;
@@ -1317,8 +1286,7 @@ bool IRInterpreter::Interpret(llvm::Modu
       Type *pointer_ty = pointer_operand->getType();
       PointerType *pointer_ptr_ty = dyn_cast<PointerType>(pointer_ty);
       if (!pointer_ptr_ty) {
-        if (log)
-          log->Printf("getPointerOperand()->getType() is not a PointerType");
+        LLDB_LOGF(log, "getPointerOperand()->getType() is not a PointerType");
         error.SetErrorToGenericError();
         error.SetErrorString(interpreter_internal_error);
         return false;
@@ -1329,16 +1297,14 @@ bool IRInterpreter::Interpret(llvm::Modu
       lldb::addr_t P = frame.ResolveValue(pointer_operand, module);
 
       if (D == LLDB_INVALID_ADDRESS) {
-        if (log)
-          log->Printf("LoadInst's value doesn't resolve to anything");
+        LLDB_LOGF(log, "LoadInst's value doesn't resolve to anything");
         error.SetErrorToGenericError();
         error.SetErrorString(bad_value_error);
         return false;
       }
 
       if (P == LLDB_INVALID_ADDRESS) {
-        if (log)
-          log->Printf("LoadInst's pointer doesn't resolve to anything");
+        LLDB_LOGF(log, "LoadInst's pointer doesn't resolve to anything");
         error.SetErrorToGenericError();
         error.SetErrorString(bad_value_error);
         return false;
@@ -1349,8 +1315,7 @@ bool IRInterpreter::Interpret(llvm::Modu
       execution_unit.ReadPointerFromMemory(&R, P, read_error);
 
       if (!read_error.Success()) {
-        if (log)
-          log->Printf("Couldn't read the address to be loaded for a LoadInst");
+        LLDB_LOGF(log, "Couldn't read the address to be loaded for a LoadInst");
         error.SetErrorToGenericError();
         error.SetErrorString(memory_read_error);
         return false;
@@ -1363,8 +1328,7 @@ bool IRInterpreter::Interpret(llvm::Modu
       execution_unit.ReadMemory(buffer.GetBytes(), R, buffer.GetByteSize(),
                                 read_error);
       if (!read_error.Success()) {
-        if (log)
-          log->Printf("Couldn't read from a region on behalf of a LoadInst");
+        LLDB_LOGF(log, "Couldn't read from a region on behalf of a LoadInst");
         error.SetErrorToGenericError();
         error.SetErrorString(memory_read_error);
         return false;
@@ -1374,18 +1338,17 @@ bool IRInterpreter::Interpret(llvm::Modu
       execution_unit.WriteMemory(D, buffer.GetBytes(), buffer.GetByteSize(),
                                  write_error);
       if (!write_error.Success()) {
-        if (log)
-          log->Printf("Couldn't write to a region on behalf of a LoadInst");
+        LLDB_LOGF(log, "Couldn't write to a region on behalf of a LoadInst");
         error.SetErrorToGenericError();
         error.SetErrorString(memory_read_error);
         return false;
       }
 
       if (log) {
-        log->Printf("Interpreted a LoadInst");
-        log->Printf("  P : 0x%" PRIx64, P);
-        log->Printf("  R : 0x%" PRIx64, R);
-        log->Printf("  D : 0x%" PRIx64, D);
+        LLDB_LOGF(log, "Interpreted a LoadInst");
+        LLDB_LOGF(log, "  P : 0x%" PRIx64, P);
+        LLDB_LOGF(log, "  R : 0x%" PRIx64, R);
+        LLDB_LOGF(log, "  D : 0x%" PRIx64, D);
       }
     } break;
     case Instruction::Ret: {
@@ -1395,9 +1358,9 @@ bool IRInterpreter::Interpret(llvm::Modu
       const StoreInst *store_inst = dyn_cast<StoreInst>(inst);
 
       if (!store_inst) {
-        if (log)
-          log->Printf(
-              "getOpcode() returns Store, but instruction is not a StoreInst");
+        LLDB_LOGF(
+            log,
+            "getOpcode() returns Store, but instruction is not a StoreInst");
         error.SetErrorToGenericError();
         error.SetErrorString(interpreter_internal_error);
         return false;
@@ -1422,16 +1385,14 @@ bool IRInterpreter::Interpret(llvm::Modu
       lldb::addr_t P = frame.ResolveValue(pointer_operand, module);
 
       if (D == LLDB_INVALID_ADDRESS) {
-        if (log)
-          log->Printf("StoreInst's value doesn't resolve to anything");
+        LLDB_LOGF(log, "StoreInst's value doesn't resolve to anything");
         error.SetErrorToGenericError();
         error.SetErrorString(bad_value_error);
         return false;
       }
 
       if (P == LLDB_INVALID_ADDRESS) {
-        if (log)
-          log->Printf("StoreInst's pointer doesn't resolve to anything");
+        LLDB_LOGF(log, "StoreInst's pointer doesn't resolve to anything");
         error.SetErrorToGenericError();
         error.SetErrorString(bad_value_error);
         return false;
@@ -1442,8 +1403,7 @@ bool IRInterpreter::Interpret(llvm::Modu
       execution_unit.ReadPointerFromMemory(&R, P, read_error);
 
       if (!read_error.Success()) {
-        if (log)
-          log->Printf("Couldn't read the address to be loaded for a LoadInst");
+        LLDB_LOGF(log, "Couldn't read the address to be loaded for a LoadInst");
         error.SetErrorToGenericError();
         error.SetErrorString(memory_read_error);
         return false;
@@ -1456,8 +1416,7 @@ bool IRInterpreter::Interpret(llvm::Modu
       execution_unit.ReadMemory(buffer.GetBytes(), D, buffer.GetByteSize(),
                                 read_error);
       if (!read_error.Success()) {
-        if (log)
-          log->Printf("Couldn't read from a region on behalf of a StoreInst");
+        LLDB_LOGF(log, "Couldn't read from a region on behalf of a StoreInst");
         error.SetErrorToGenericError();
         error.SetErrorString(memory_read_error);
         return false;
@@ -1467,28 +1426,26 @@ bool IRInterpreter::Interpret(llvm::Modu
       execution_unit.WriteMemory(R, buffer.GetBytes(), buffer.GetByteSize(),
                                  write_error);
       if (!write_error.Success()) {
-        if (log)
-          log->Printf("Couldn't write to a region on behalf of a StoreInst");
+        LLDB_LOGF(log, "Couldn't write to a region on behalf of a StoreInst");
         error.SetErrorToGenericError();
         error.SetErrorString(memory_write_error);
         return false;
       }
 
       if (log) {
-        log->Printf("Interpreted a StoreInst");
-        log->Printf("  D : 0x%" PRIx64, D);
-        log->Printf("  P : 0x%" PRIx64, P);
-        log->Printf("  R : 0x%" PRIx64, R);
+        LLDB_LOGF(log, "Interpreted a StoreInst");
+        LLDB_LOGF(log, "  D : 0x%" PRIx64, D);
+        LLDB_LOGF(log, "  P : 0x%" PRIx64, P);
+        LLDB_LOGF(log, "  R : 0x%" PRIx64, R);
       }
     } break;
     case Instruction::Call: {
       const CallInst *call_inst = dyn_cast<CallInst>(inst);
 
       if (!call_inst) {
-        if (log)
-          log->Printf(
-              "getOpcode() returns %s, but instruction is not a CallInst",
-              inst->getOpcodeName());
+        LLDB_LOGF(log,
+                  "getOpcode() returns %s, but instruction is not a CallInst",
+                  inst->getOpcodeName());
         error.SetErrorToGenericError();
         error.SetErrorString(interpreter_internal_error);
         return false;

Modified: lldb/trunk/source/Expression/IRMemoryMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRMemoryMap.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRMemoryMap.cpp (original)
+++ lldb/trunk/source/Expression/IRMemoryMap.cpp Wed Jul 24 10:56:10 2019
@@ -327,12 +327,12 @@ lldb::addr_t IRMemoryMap::Malloc(size_t
     break;
   case eAllocationPolicyMirror:
     process_sp = m_process_wp.lock();
-    if (log)
-      log->Printf("IRMemoryMap::%s process_sp=0x%" PRIx64
-                  ", process_sp->CanJIT()=%s, process_sp->IsAlive()=%s",
-                  __FUNCTION__, (lldb::addr_t)process_sp.get(),
-                  process_sp && process_sp->CanJIT() ? "true" : "false",
-                  process_sp && process_sp->IsAlive() ? "true" : "false");
+    LLDB_LOGF(log,
+              "IRMemoryMap::%s process_sp=0x%" PRIx64
+              ", process_sp->CanJIT()=%s, process_sp->IsAlive()=%s",
+              __FUNCTION__, (lldb::addr_t)process_sp.get(),
+              process_sp && process_sp->CanJIT() ? "true" : "false",
+              process_sp && process_sp->IsAlive() ? "true" : "false");
     if (process_sp && process_sp->CanJIT() && process_sp->IsAlive()) {
       if (!zero_memory)
         allocation_address =
@@ -344,10 +344,10 @@ lldb::addr_t IRMemoryMap::Malloc(size_t
       if (!error.Success())
         return LLDB_INVALID_ADDRESS;
     } else {
-      if (log)
-        log->Printf("IRMemoryMap::%s switching to eAllocationPolicyHostOnly "
-                    "due to failed condition (see previous expr log message)",
-                    __FUNCTION__);
+      LLDB_LOGF(log,
+                "IRMemoryMap::%s switching to eAllocationPolicyHostOnly "
+                "due to failed condition (see previous expr log message)",
+                __FUNCTION__);
       policy = eAllocationPolicyHostOnly;
       allocation_address = FindSpace(allocation_size);
       if (allocation_address == LLDB_INVALID_ADDRESS) {
@@ -417,10 +417,11 @@ lldb::addr_t IRMemoryMap::Malloc(size_t
       break;
     }
 
-    log->Printf("IRMemoryMap::Malloc (%" PRIu64 ", 0x%" PRIx64 ", 0x%" PRIx64
-                ", %s) -> 0x%" PRIx64,
-                (uint64_t)allocation_size, (uint64_t)alignment,
-                (uint64_t)permissions, policy_string, aligned_address);
+    LLDB_LOGF(log,
+              "IRMemoryMap::Malloc (%" PRIu64 ", 0x%" PRIx64 ", 0x%" PRIx64
+              ", %s) -> 0x%" PRIx64,
+              (uint64_t)allocation_size, (uint64_t)alignment,
+              (uint64_t)permissions, policy_string, aligned_address);
   }
 
   return aligned_address;
@@ -477,10 +478,11 @@ void IRMemoryMap::Free(lldb::addr_t proc
 
   if (lldb_private::Log *log =
           lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) {
-    log->Printf("IRMemoryMap::Free (0x%" PRIx64 ") freed [0x%" PRIx64
-                "..0x%" PRIx64 ")",
-                (uint64_t)process_address, iter->second.m_process_start,
-                iter->second.m_process_start + iter->second.m_size);
+    LLDB_LOGF(log,
+              "IRMemoryMap::Free (0x%" PRIx64 ") freed [0x%" PRIx64
+              "..0x%" PRIx64 ")",
+              (uint64_t)process_address, iter->second.m_process_start,
+              iter->second.m_process_start + iter->second.m_size);
   }
 
   m_allocations.erase(iter);
@@ -574,12 +576,13 @@ void IRMemoryMap::WriteMemory(lldb::addr
 
   if (lldb_private::Log *log =
           lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) {
-    log->Printf("IRMemoryMap::WriteMemory (0x%" PRIx64 ", 0x%" PRIx64
-                ", 0x%" PRId64 ") went to [0x%" PRIx64 "..0x%" PRIx64 ")",
-                (uint64_t)process_address, (uint64_t)bytes, (uint64_t)size,
-                (uint64_t)allocation.m_process_start,
-                (uint64_t)allocation.m_process_start +
-                    (uint64_t)allocation.m_size);
+    LLDB_LOGF(log,
+              "IRMemoryMap::WriteMemory (0x%" PRIx64 ", 0x%" PRIx64
+              ", 0x%" PRId64 ") went to [0x%" PRIx64 "..0x%" PRIx64 ")",
+              (uint64_t)process_address, (uint64_t)bytes, (uint64_t)size,
+              (uint64_t)allocation.m_process_start,
+              (uint64_t)allocation.m_process_start +
+                  (uint64_t)allocation.m_size);
   }
 }
 
@@ -704,12 +707,13 @@ void IRMemoryMap::ReadMemory(uint8_t *by
 
   if (lldb_private::Log *log =
           lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) {
-    log->Printf("IRMemoryMap::ReadMemory (0x%" PRIx64 ", 0x%" PRIx64
-                ", 0x%" PRId64 ") came from [0x%" PRIx64 "..0x%" PRIx64 ")",
-                (uint64_t)process_address, (uint64_t)bytes, (uint64_t)size,
-                (uint64_t)allocation.m_process_start,
-                (uint64_t)allocation.m_process_start +
-                    (uint64_t)allocation.m_size);
+    LLDB_LOGF(log,
+              "IRMemoryMap::ReadMemory (0x%" PRIx64 ", 0x%" PRIx64
+              ", 0x%" PRId64 ") came from [0x%" PRIx64 "..0x%" PRIx64 ")",
+              (uint64_t)process_address, (uint64_t)bytes, (uint64_t)size,
+              (uint64_t)allocation.m_process_start,
+              (uint64_t)allocation.m_process_start +
+                  (uint64_t)allocation.m_size);
   }
 }
 

Modified: lldb/trunk/source/Expression/LLVMUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/LLVMUserExpression.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Expression/LLVMUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/LLVMUserExpression.cpp Wed Jul 24 10:56:10 2019
@@ -161,9 +161,9 @@ LLVMUserExpression::DoExecute(Diagnostic
       function_stack_bottom = function_stack_pointer - HostInfo::GetPageSize();
       function_stack_top = function_stack_pointer;
 
-      if (log)
-        log->Printf(
-            "-- [UserExpression::Execute] Execution of expression begins --");
+      LLDB_LOGF(
+          log,
+          "-- [UserExpression::Execute] Execution of expression begins --");
 
       if (exe_ctx.GetProcessPtr())
         exe_ctx.GetProcessPtr()->SetRunningUserExpression(true);
@@ -175,9 +175,8 @@ LLVMUserExpression::DoExecute(Diagnostic
       if (exe_ctx.GetProcessPtr())
         exe_ctx.GetProcessPtr()->SetRunningUserExpression(false);
 
-      if (log)
-        log->Printf("-- [UserExpression::Execute] Execution of expression "
-                    "completed --");
+      LLDB_LOGF(log, "-- [UserExpression::Execute] Execution of expression "
+                     "completed --");
 
       if (execution_result == lldb::eExpressionInterrupted ||
           execution_result == lldb::eExpressionHitBreakpoint) {
@@ -251,9 +250,8 @@ bool LLVMUserExpression::FinalizeJITExec
     lldb::addr_t function_stack_top) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
-  if (log)
-    log->Printf("-- [UserExpression::FinalizeJITExecution] Dematerializing "
-                "after execution --");
+  LLDB_LOGF(log, "-- [UserExpression::FinalizeJITExecution] Dematerializing "
+                 "after execution --");
 
   if (!m_dematerializer_sp) {
     diagnostic_manager.Printf(eDiagnosticSeverityError,

Modified: lldb/trunk/source/Expression/Materializer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/Materializer.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Expression/Materializer.cpp (original)
+++ lldb/trunk/source/Expression/Materializer.cpp Wed Jul 24 10:56:10 2019
@@ -93,9 +93,8 @@ public:
       return;
     }
 
-    if (log)
-      log->Printf("Allocated %s (0x%" PRIx64 ") successfully",
-                  m_persistent_variable_sp->GetName().GetCString(), mem);
+    LLDB_LOGF(log, "Allocated %s (0x%" PRIx64 ") successfully",
+              m_persistent_variable_sp->GetName().GetCString(), mem);
 
     // Put the location of the spare memory into the live data of the
     // ValueObject.
@@ -157,11 +156,12 @@ public:
     const lldb::addr_t load_addr = process_address + m_offset;
 
     if (log) {
-      log->Printf("EntityPersistentVariable::Materialize [address = 0x%" PRIx64
-                  ", m_name = %s, m_flags = 0x%hx]",
-                  (uint64_t)load_addr,
-                  m_persistent_variable_sp->GetName().AsCString(),
-                  m_persistent_variable_sp->m_flags);
+      LLDB_LOGF(log,
+                "EntityPersistentVariable::Materialize [address = 0x%" PRIx64
+                ", m_name = %s, m_flags = 0x%hx]",
+                (uint64_t)load_addr,
+                m_persistent_variable_sp->GetName().AsCString(),
+                m_persistent_variable_sp->m_flags);
     }
 
     if (m_persistent_variable_sp->m_flags &
@@ -208,12 +208,12 @@ public:
     const lldb::addr_t load_addr = process_address + m_offset;
 
     if (log) {
-      log->Printf(
-          "EntityPersistentVariable::Dematerialize [address = 0x%" PRIx64
-          ", m_name = %s, m_flags = 0x%hx]",
-          (uint64_t)process_address + m_offset,
-          m_persistent_variable_sp->GetName().AsCString(),
-          m_persistent_variable_sp->m_flags);
+      LLDB_LOGF(log,
+                "EntityPersistentVariable::Dematerialize [address = 0x%" PRIx64
+                ", m_name = %s, m_flags = 0x%hx]",
+                (uint64_t)process_address + m_offset,
+                m_persistent_variable_sp->GetName().AsCString(),
+                m_persistent_variable_sp->m_flags);
     }
 
     if (m_delegate) {
@@ -290,11 +290,10 @@ public:
               ExpressionVariable::EVNeedsFreezeDry ||
           m_persistent_variable_sp->m_flags &
               ExpressionVariable::EVKeepInTarget) {
-        if (log)
-          log->Printf(
-              "Dematerializing %s from 0x%" PRIx64 " (size = %llu)",
-              m_persistent_variable_sp->GetName().GetCString(), (uint64_t)mem,
-              (unsigned long long)m_persistent_variable_sp->GetByteSize());
+        LLDB_LOGF(log, "Dematerializing %s from 0x%" PRIx64 " (size = %llu)",
+                  m_persistent_variable_sp->GetName().GetCString(),
+                  (uint64_t)mem,
+                  (unsigned long long)m_persistent_variable_sp->GetByteSize());
 
         // Read the contents of the spare memory area
 
@@ -440,9 +439,10 @@ public:
 
     const lldb::addr_t load_addr = process_address + m_offset;
     if (log) {
-      log->Printf("EntityVariable::Materialize [address = 0x%" PRIx64
-                  ", m_variable_sp = %s]",
-                  (uint64_t)load_addr, m_variable_sp->GetName().AsCString());
+      LLDB_LOGF(log,
+                "EntityVariable::Materialize [address = 0x%" PRIx64
+                ", m_variable_sp = %s]",
+                (uint64_t)load_addr, m_variable_sp->GetName().AsCString());
     }
 
     ExecutionContextScope *scope = frame_sp.get();
@@ -605,9 +605,10 @@ public:
 
     const lldb::addr_t load_addr = process_address + m_offset;
     if (log) {
-      log->Printf("EntityVariable::Dematerialize [address = 0x%" PRIx64
-                  ", m_variable_sp = %s]",
-                  (uint64_t)load_addr, m_variable_sp->GetName().AsCString());
+      LLDB_LOGF(log,
+                "EntityVariable::Dematerialize [address = 0x%" PRIx64
+                ", m_variable_sp = %s]",
+                (uint64_t)load_addr, m_variable_sp->GetName().AsCString());
     }
 
     if (m_temporary_allocation != LLDB_INVALID_ADDRESS) {
@@ -1063,9 +1064,10 @@ public:
     const lldb::addr_t load_addr = process_address + m_offset;
 
     if (log) {
-      log->Printf("EntitySymbol::Materialize [address = 0x%" PRIx64
-                  ", m_symbol = %s]",
-                  (uint64_t)load_addr, m_symbol.GetName().AsCString());
+      LLDB_LOGF(log,
+                "EntitySymbol::Materialize [address = 0x%" PRIx64
+                ", m_symbol = %s]",
+                (uint64_t)load_addr, m_symbol.GetName().AsCString());
     }
 
     const Address sym_address = m_symbol.GetAddress();
@@ -1109,9 +1111,10 @@ public:
     const lldb::addr_t load_addr = process_address + m_offset;
 
     if (log) {
-      log->Printf("EntitySymbol::Dematerialize [address = 0x%" PRIx64
-                  ", m_symbol = %s]",
-                  (uint64_t)load_addr, m_symbol.GetName().AsCString());
+      LLDB_LOGF(log,
+                "EntitySymbol::Dematerialize [address = 0x%" PRIx64
+                ", m_symbol = %s]",
+                (uint64_t)load_addr, m_symbol.GetName().AsCString());
     }
 
     // no work needs to be done
@@ -1178,9 +1181,10 @@ public:
     const lldb::addr_t load_addr = process_address + m_offset;
 
     if (log) {
-      log->Printf("EntityRegister::Materialize [address = 0x%" PRIx64
-                  ", m_register_info = %s]",
-                  (uint64_t)load_addr, m_register_info.name);
+      LLDB_LOGF(log,
+                "EntityRegister::Materialize [address = 0x%" PRIx64
+                ", m_register_info = %s]",
+                (uint64_t)load_addr, m_register_info.name);
     }
 
     RegisterValue reg_value;
@@ -1240,9 +1244,10 @@ public:
     const lldb::addr_t load_addr = process_address + m_offset;
 
     if (log) {
-      log->Printf("EntityRegister::Dematerialize [address = 0x%" PRIx64
-                  ", m_register_info = %s]",
-                  (uint64_t)load_addr, m_register_info.name);
+      LLDB_LOGF(log,
+                "EntityRegister::Dematerialize [address = 0x%" PRIx64
+                ", m_register_info = %s]",
+                (uint64_t)load_addr, m_register_info.name);
     }
 
     Status extract_error;
@@ -1379,7 +1384,8 @@ Materializer::Materialize(lldb::StackFra
 
   if (Log *log =
           lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) {
-    log->Printf(
+    LLDB_LOGF(
+        log,
         "Materializer::Materialize (frame_sp = %p, process_address = 0x%" PRIx64
         ") materialized:",
         static_cast<void *>(frame_sp.get()), process_address);
@@ -1414,9 +1420,10 @@ void Materializer::Dematerializer::Demat
   } else {
     if (Log *log =
             lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) {
-      log->Printf("Materializer::Dematerialize (frame_sp = %p, process_address "
-                  "= 0x%" PRIx64 ") about to dematerialize:",
-                  static_cast<void *>(frame_sp.get()), m_process_address);
+      LLDB_LOGF(log,
+                "Materializer::Dematerialize (frame_sp = %p, process_address "
+                "= 0x%" PRIx64 ") about to dematerialize:",
+                static_cast<void *>(frame_sp.get()), m_process_address);
       for (EntityUP &entity_up : m_materializer->m_entities)
         entity_up->DumpToLog(*m_map, m_process_address, log);
     }

Modified: lldb/trunk/source/Expression/UserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/UserExpression.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Expression/UserExpression.cpp (original)
+++ lldb/trunk/source/Expression/UserExpression.cpp Wed Jul 24 10:56:10 2019
@@ -165,9 +165,8 @@ lldb::ExpressionResults UserExpression::
 
   Target *target = exe_ctx.GetTargetPtr();
   if (!target) {
-    if (log)
-      log->Printf("== [UserExpression::Evaluate] Passed a NULL target, can't "
-                  "run expressions.");
+    LLDB_LOGF(log, "== [UserExpression::Evaluate] Passed a NULL target, can't "
+                   "run expressions.");
     error.SetErrorString("expression passed a null target");
     return lldb::eExpressionSetupError;
   }
@@ -176,9 +175,9 @@ lldb::ExpressionResults UserExpression::
 
   if (process == nullptr || process->GetState() != lldb::eStateStopped) {
     if (execution_policy == eExecutionPolicyAlways) {
-      if (log)
-        log->Printf("== [UserExpression::Evaluate] Expression may not run, but "
-                    "is not constant ==");
+      LLDB_LOGF(log,
+                "== [UserExpression::Evaluate] Expression may not run, but "
+                "is not constant ==");
 
       error.SetErrorString("expression needed to run but couldn't");
 
@@ -224,14 +223,14 @@ lldb::ExpressionResults UserExpression::
                                            error));
   if (error.Fail()) {
     if (log)
-      log->Printf("== [UserExpression::Evaluate] Getting expression: %s ==",
-                  error.AsCString());
+      LLDB_LOGF(log, "== [UserExpression::Evaluate] Getting expression: %s ==",
+                error.AsCString());
     return lldb::eExpressionSetupError;
   }
 
   if (log)
-    log->Printf("== [UserExpression::Evaluate] Parsing expression %s ==",
-                expr.str().c_str());
+    LLDB_LOGF(log, "== [UserExpression::Evaluate] Parsing expression %s ==",
+              expr.str().c_str());
 
   const bool keep_expression_in_memory = true;
   const bool generate_debug_info = options.GetGenerateDebugInfo();
@@ -310,8 +309,9 @@ lldb::ExpressionResults UserExpression::
     if (execution_policy == eExecutionPolicyNever &&
         !user_expression_sp->CanInterpret()) {
       if (log)
-        log->Printf("== [UserExpression::Evaluate] Expression may not run, but "
-                    "is not constant ==");
+        LLDB_LOGF(log,
+                  "== [UserExpression::Evaluate] Expression may not run, but "
+                  "is not constant ==");
 
       if (!diagnostic_manager.Diagnostics().size())
         error.SetExpressionError(lldb::eExpressionSetupError,
@@ -332,7 +332,7 @@ lldb::ExpressionResults UserExpression::
       diagnostic_manager.Clear();
 
       if (log)
-        log->Printf("== [UserExpression::Evaluate] Executing expression ==");
+        LLDB_LOGF(log, "== [UserExpression::Evaluate] Executing expression ==");
 
       execution_results =
           user_expression_sp->Execute(diagnostic_manager, exe_ctx, options,
@@ -340,8 +340,8 @@ lldb::ExpressionResults UserExpression::
 
       if (execution_results != lldb::eExpressionCompleted) {
         if (log)
-          log->Printf("== [UserExpression::Evaluate] Execution completed "
-                      "abnormally ==");
+          LLDB_LOGF(log, "== [UserExpression::Evaluate] Execution completed "
+                         "abnormally ==");
 
         if (!diagnostic_manager.Diagnostics().size())
           error.SetExpressionError(
@@ -354,13 +354,14 @@ lldb::ExpressionResults UserExpression::
           result_valobj_sp = expr_result->GetValueObject();
 
           if (log)
-            log->Printf("== [UserExpression::Evaluate] Execution completed "
-                        "normally with result %s ==",
-                        result_valobj_sp->GetValueAsCString());
+            LLDB_LOGF(log,
+                      "== [UserExpression::Evaluate] Execution completed "
+                      "normally with result %s ==",
+                      result_valobj_sp->GetValueAsCString());
         } else {
           if (log)
-            log->Printf("== [UserExpression::Evaluate] Execution completed "
-                        "normally with no result ==");
+            LLDB_LOGF(log, "== [UserExpression::Evaluate] Execution completed "
+                           "normally with no result ==");
 
           error.SetError(UserExpression::kNoResult, lldb::eErrorTypeGeneric);
         }

Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Wed Jul 24 10:56:10 2019
@@ -164,8 +164,7 @@ static bool CheckForMonitorCancellation(
 static thread_result_t MonitorChildProcessThreadFunction(void *arg) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
   const char *function = __FUNCTION__;
-  if (log)
-    log->Printf("%s (arg = %p) thread starting...", function, arg);
+  LLDB_LOGF(log, "%s (arg = %p) thread starting...", function, arg);
 
   MonitorInfo *info = (MonitorInfo *)arg;
 
@@ -193,9 +192,8 @@ static thread_result_t MonitorChildProce
 
   while (1) {
     log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS);
-    if (log)
-      log->Printf("%s ::waitpid (pid = %" PRIi32 ", &status, options = %i)...",
-                  function, pid, options);
+    LLDB_LOGF(log, "%s ::waitpid (pid = %" PRIi32 ", &status, options = %i)...",
+              function, pid, options);
 
     if (CheckForMonitorCancellation())
       break;
@@ -245,12 +243,12 @@ static thread_result_t MonitorChildProce
 #endif
 
         log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS);
-        if (log)
-          log->Printf("%s ::waitpid (pid = %" PRIi32
-                      ", &status, options = %i) => pid = %" PRIi32
-                      ", status = 0x%8.8x (%s), signal = %i, exit_state = %i",
-                      function, pid, options, wait_pid, status, status_cstr,
-                      signal, exit_status);
+        LLDB_LOGF(log,
+                  "%s ::waitpid (pid = %" PRIi32
+                  ", &status, options = %i) => pid = %" PRIi32
+                  ", status = 0x%8.8x (%s), signal = %i, exit_state = %i",
+                  function, pid, options, wait_pid, status, status_cstr, signal,
+                  exit_status);
 
         if (exited || (signal != 0 && monitor_signals)) {
           bool callback_return = false;
@@ -259,18 +257,18 @@ static thread_result_t MonitorChildProce
 
           // If our process exited, then this thread should exit
           if (exited && wait_pid == abs(pid)) {
-            if (log)
-              log->Printf("%s (arg = %p) thread exiting because pid received "
-                          "exit signal...",
-                          __FUNCTION__, arg);
+            LLDB_LOGF(log,
+                      "%s (arg = %p) thread exiting because pid received "
+                      "exit signal...",
+                      __FUNCTION__, arg);
             break;
           }
           // If the callback returns true, it means this process should exit
           if (callback_return) {
-            if (log)
-              log->Printf("%s (arg = %p) thread exiting because callback "
-                          "returned true...",
-                          __FUNCTION__, arg);
+            LLDB_LOGF(log,
+                      "%s (arg = %p) thread exiting because callback "
+                      "returned true...",
+                      __FUNCTION__, arg);
             break;
           }
         }
@@ -279,8 +277,7 @@ static thread_result_t MonitorChildProce
   }
 
   log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS);
-  if (log)
-    log->Printf("%s (arg = %p) thread exiting...", __FUNCTION__, arg);
+  LLDB_LOGF(log, "%s (arg = %p) thread exiting...", __FUNCTION__, arg);
 
   return nullptr;
 }

Modified: lldb/trunk/source/Host/common/HostInfoBase.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/HostInfoBase.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/HostInfoBase.cpp (original)
+++ lldb/trunk/source/Host/common/HostInfoBase.cpp Wed Jul 24 10:56:10 2019
@@ -221,25 +221,24 @@ bool HostInfoBase::ComputePathRelativeTo
     return false;
 
   std::string raw_path = lldb_file_spec.GetPath();
-  if (log)
-    log->Printf("HostInfo::%s() attempting to "
-                "derive the path %s relative to liblldb install path: %s",
-                __FUNCTION__, dir.data(), raw_path.c_str());
+  LLDB_LOGF(log,
+            "HostInfo::%s() attempting to "
+            "derive the path %s relative to liblldb install path: %s",
+            __FUNCTION__, dir.data(), raw_path.c_str());
 
   // Drop bin (windows) or lib
   llvm::StringRef parent_path = llvm::sys::path::parent_path(raw_path);
   if (parent_path.empty()) {
-    if (log)
-      log->Printf("HostInfo::%s() failed to find liblldb within the shared "
-                  "lib path",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "HostInfo::%s() failed to find liblldb within the shared "
+              "lib path",
+              __FUNCTION__);
     return false;
   }
 
   raw_path = (parent_path + dir).str();
-  if (log)
-    log->Printf("HostInfo::%s() derived the path as: %s", __FUNCTION__,
-                raw_path.c_str());
+  LLDB_LOGF(log, "HostInfo::%s() derived the path as: %s", __FUNCTION__,
+            raw_path.c_str());
   file_spec.GetDirectory().SetString(raw_path);
   return (bool)file_spec.GetDirectory();
 }

Modified: lldb/trunk/source/Host/common/HostNativeThreadBase.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/HostNativeThreadBase.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/HostNativeThreadBase.cpp (original)
+++ lldb/trunk/source/Host/common/HostNativeThreadBase.cpp Wed Jul 24 10:56:10 2019
@@ -62,8 +62,7 @@ HostNativeThreadBase::ThreadCreateTrampo
   thread_arg_t thread_arg = info->thread_arg;
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
-  if (log)
-    log->Printf("thread created");
+  LLDB_LOGF(log, "thread created");
 
   delete info;
   return thread_fptr(thread_arg);

Modified: lldb/trunk/source/Host/common/NativeProcessProtocol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/NativeProcessProtocol.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/NativeProcessProtocol.cpp (original)
+++ lldb/trunk/source/Host/common/NativeProcessProtocol.cpp Wed Jul 24 10:56:10 2019
@@ -331,22 +331,23 @@ void NativeProcessProtocol::Synchronousl
 
   if (log) {
     if (!m_delegates.empty()) {
-      log->Printf("NativeProcessProtocol::%s: sent state notification [%s] "
-                  "from process %" PRIu64,
-                  __FUNCTION__, lldb_private::StateAsCString(state), GetID());
+      LLDB_LOGF(log,
+                "NativeProcessProtocol::%s: sent state notification [%s] "
+                "from process %" PRIu64,
+                __FUNCTION__, lldb_private::StateAsCString(state), GetID());
     } else {
-      log->Printf("NativeProcessProtocol::%s: would send state notification "
-                  "[%s] from process %" PRIu64 ", but no delegates",
-                  __FUNCTION__, lldb_private::StateAsCString(state), GetID());
+      LLDB_LOGF(log,
+                "NativeProcessProtocol::%s: would send state notification "
+                "[%s] from process %" PRIu64 ", but no delegates",
+                __FUNCTION__, lldb_private::StateAsCString(state), GetID());
     }
   }
 }
 
 void NativeProcessProtocol::NotifyDidExec() {
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("NativeProcessProtocol::%s - preparing to call delegates",
-                __FUNCTION__);
+  LLDB_LOGF(log, "NativeProcessProtocol::%s - preparing to call delegates",
+            __FUNCTION__);
 
   {
     std::lock_guard<std::recursive_mutex> guard(m_delegates_mutex);

Modified: lldb/trunk/source/Host/common/NativeRegisterContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/NativeRegisterContext.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/NativeRegisterContext.cpp (original)
+++ lldb/trunk/source/Host/common/NativeRegisterContext.cpp Wed Jul 24 10:56:10 2019
@@ -114,16 +114,15 @@ lldb::addr_t NativeRegisterContext::GetP
 
   uint32_t reg = ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric,
                                                      LLDB_REGNUM_GENERIC_PC);
-  if (log)
-    log->Printf("NativeRegisterContext::%s using reg index %" PRIu32
-                " (default %" PRIu64 ")",
-                __FUNCTION__, reg, fail_value);
+  LLDB_LOGF(log,
+            "NativeRegisterContext::%s using reg index %" PRIu32
+            " (default %" PRIu64 ")",
+            __FUNCTION__, reg, fail_value);
 
   const uint64_t retval = ReadRegisterAsUnsigned(reg, fail_value);
 
-  if (log)
-    log->Printf("NativeRegisterContext::%s " PRIu32 " retval %" PRIu64,
-                __FUNCTION__, retval);
+  LLDB_LOGF(log, "NativeRegisterContext::%s " PRIu32 " retval %" PRIu64,
+            __FUNCTION__, retval);
 
   return retval;
 }
@@ -192,20 +191,19 @@ NativeRegisterContext::ReadRegisterAsUns
     RegisterValue value;
     Status error = ReadRegister(reg_info, value);
     if (error.Success()) {
-      if (log)
-        log->Printf("NativeRegisterContext::%s ReadRegister() succeeded, value "
-                    "%" PRIu64,
-                    __FUNCTION__, value.GetAsUInt64());
+      LLDB_LOGF(log,
+                "NativeRegisterContext::%s ReadRegister() succeeded, value "
+                "%" PRIu64,
+                __FUNCTION__, value.GetAsUInt64());
       return value.GetAsUInt64();
     } else {
-      if (log)
-        log->Printf("NativeRegisterContext::%s ReadRegister() failed, error %s",
-                    __FUNCTION__, error.AsCString());
+      LLDB_LOGF(log,
+                "NativeRegisterContext::%s ReadRegister() failed, error %s",
+                __FUNCTION__, error.AsCString());
     }
   } else {
-    if (log)
-      log->Printf("NativeRegisterContext::%s ReadRegister() null reg_info",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "NativeRegisterContext::%s ReadRegister() null reg_info",
+              __FUNCTION__);
   }
   return fail_value;
 }

Modified: lldb/trunk/source/Host/common/Socket.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Socket.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Socket.cpp (original)
+++ lldb/trunk/source/Host/common/Socket.cpp Wed Jul 24 10:56:10 2019
@@ -149,9 +149,8 @@ std::unique_ptr<Socket> Socket::Create(c
 Status Socket::TcpConnect(llvm::StringRef host_and_port,
                           bool child_processes_inherit, Socket *&socket) {
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION));
-  if (log)
-    log->Printf("Socket::%s (host/port = %s)", __FUNCTION__,
-                host_and_port.str().c_str());
+  LLDB_LOGF(log, "Socket::%s (host/port = %s)", __FUNCTION__,
+            host_and_port.str().c_str());
 
   Status error;
   std::unique_ptr<Socket> connect_socket(
@@ -170,8 +169,7 @@ Status Socket::TcpListen(llvm::StringRef
                          bool child_processes_inherit, Socket *&socket,
                          Predicate<uint16_t> *predicate, int backlog) {
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
-  if (log)
-    log->Printf("Socket::%s (%s)", __FUNCTION__, host_and_port.str().c_str());
+  LLDB_LOGF(log, "Socket::%s (%s)", __FUNCTION__, host_and_port.str().c_str());
 
   Status error;
   std::string host_str;
@@ -209,9 +207,8 @@ Status Socket::TcpListen(llvm::StringRef
 Status Socket::UdpConnect(llvm::StringRef host_and_port,
                           bool child_processes_inherit, Socket *&socket) {
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
-  if (log)
-    log->Printf("Socket::%s (host/port = %s)", __FUNCTION__,
-                host_and_port.str().c_str());
+  LLDB_LOGF(log, "Socket::%s (host/port = %s)", __FUNCTION__,
+            host_and_port.str().c_str());
 
   return UDPSocket::Connect(host_and_port, child_processes_inherit, socket);
 }
@@ -345,12 +342,13 @@ Status Socket::Read(void *buf, size_t &n
 
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION));
   if (log) {
-    log->Printf("%p Socket::Read() (socket = %" PRIu64
-                ", src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64
-                " (error = %s)",
-                static_cast<void *>(this), static_cast<uint64_t>(m_socket), buf,
-                static_cast<uint64_t>(num_bytes),
-                static_cast<int64_t>(bytes_received), error.AsCString());
+    LLDB_LOGF(log,
+              "%p Socket::Read() (socket = %" PRIu64
+              ", src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64
+              " (error = %s)",
+              static_cast<void *>(this), static_cast<uint64_t>(m_socket), buf,
+              static_cast<uint64_t>(num_bytes),
+              static_cast<int64_t>(bytes_received), error.AsCString());
   }
 
   return error;
@@ -371,12 +369,13 @@ Status Socket::Write(const void *buf, si
 
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION));
   if (log) {
-    log->Printf("%p Socket::Write() (socket = %" PRIu64
-                ", src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64
-                " (error = %s)",
-                static_cast<void *>(this), static_cast<uint64_t>(m_socket), buf,
-                static_cast<uint64_t>(num_bytes),
-                static_cast<int64_t>(bytes_sent), error.AsCString());
+    LLDB_LOGF(log,
+              "%p Socket::Write() (socket = %" PRIu64
+              ", src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64
+              " (error = %s)",
+              static_cast<void *>(this), static_cast<uint64_t>(m_socket), buf,
+              static_cast<uint64_t>(num_bytes),
+              static_cast<int64_t>(bytes_sent), error.AsCString());
   }
 
   return error;
@@ -393,9 +392,8 @@ Status Socket::Close() {
     return error;
 
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
-  if (log)
-    log->Printf("%p Socket::Close (fd = %" PRIu64 ")",
-                static_cast<void *>(this), static_cast<uint64_t>(m_socket));
+  LLDB_LOGF(log, "%p Socket::Close (fd = %" PRIu64 ")",
+            static_cast<void *>(this), static_cast<uint64_t>(m_socket));
 
 #if defined(_WIN32)
   bool success = !!closesocket(m_socket);

Modified: lldb/trunk/source/Host/common/TCPSocket.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/TCPSocket.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/TCPSocket.cpp (original)
+++ lldb/trunk/source/Host/common/TCPSocket.cpp Wed Jul 24 10:56:10 2019
@@ -140,8 +140,7 @@ Status TCPSocket::CreateSocket(int domai
 Status TCPSocket::Connect(llvm::StringRef name) {
 
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION));
-  if (log)
-    log->Printf("TCPSocket::%s (host/port = %s)", __FUNCTION__, name.data());
+  LLDB_LOGF(log, "TCPSocket::%s (host/port = %s)", __FUNCTION__, name.data());
 
   Status error;
   std::string host_str;
@@ -177,8 +176,7 @@ Status TCPSocket::Connect(llvm::StringRe
 
 Status TCPSocket::Listen(llvm::StringRef name, int backlog) {
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
-  if (log)
-    log->Printf("TCPSocket::%s (%s)", __FUNCTION__, name.data());
+  LLDB_LOGF(log, "TCPSocket::%s (%s)", __FUNCTION__, name.data());
 
   Status error;
   std::string host_str;

Modified: lldb/trunk/source/Host/common/UDPSocket.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/UDPSocket.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/UDPSocket.cpp (original)
+++ lldb/trunk/source/Host/common/UDPSocket.cpp Wed Jul 24 10:56:10 2019
@@ -58,8 +58,7 @@ Status UDPSocket::Connect(llvm::StringRe
   std::unique_ptr<UDPSocket> final_socket;
 
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
-  if (log)
-    log->Printf("UDPSocket::%s (host/port = %s)", __FUNCTION__, name.data());
+  LLDB_LOGF(log, "UDPSocket::%s (host/port = %s)", __FUNCTION__, name.data());
 
   Status error;
   std::string host_str;

Modified: lldb/trunk/source/Host/linux/HostInfoLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/HostInfoLinux.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Host/linux/HostInfoLinux.cpp (original)
+++ lldb/trunk/source/Host/linux/HostInfoLinux.cpp Wed Jul 24 10:56:10 2019
@@ -88,8 +88,7 @@ llvm::StringRef HostInfoLinux::GetDistri
   llvm::call_once(g_once_flag, []() {
 
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST));
-    if (log)
-      log->Printf("attempting to determine Linux distribution...");
+    LLDB_LOGF(log, "attempting to determine Linux distribution...");
 
     // check if the lsb_release command exists at one of the following paths
     const char *const exe_paths[] = {"/bin/lsb_release",
@@ -100,9 +99,8 @@ llvm::StringRef HostInfoLinux::GetDistri
       const char *const get_distribution_info_exe = exe_paths[exe_index];
       if (access(get_distribution_info_exe, F_OK)) {
         // this exe doesn't exist, move on to next exe
-        if (log)
-          log->Printf("executable doesn't exist: %s",
-                      get_distribution_info_exe);
+        LLDB_LOGF(log, "executable doesn't exist: %s",
+                  get_distribution_info_exe);
         continue;
       }
 
@@ -112,10 +110,10 @@ llvm::StringRef HostInfoLinux::GetDistri
 
       FILE *file = popen(get_distribution_id_command.c_str(), "r");
       if (!file) {
-        if (log)
-          log->Printf("failed to run command: \"%s\", cannot retrieve "
-                      "platform information",
-                      get_distribution_id_command.c_str());
+        LLDB_LOGF(log,
+                  "failed to run command: \"%s\", cannot retrieve "
+                  "platform information",
+                  get_distribution_id_command.c_str());
         break;
       }
 
@@ -123,9 +121,8 @@ llvm::StringRef HostInfoLinux::GetDistri
       char distribution_id[256] = {'\0'};
       if (fgets(distribution_id, sizeof(distribution_id) - 1, file) !=
           nullptr) {
-        if (log)
-          log->Printf("distribution id command returned \"%s\"",
-                      distribution_id);
+        LLDB_LOGF(log, "distribution id command returned \"%s\"",
+                  distribution_id);
 
         const char *const distributor_id_key = "Distributor ID:\t";
         if (strstr(distribution_id, distributor_id_key)) {
@@ -140,19 +137,17 @@ llvm::StringRef HostInfoLinux::GetDistri
               [](char ch) { return tolower(isspace(ch) ? '_' : ch); });
 
           g_fields->m_distribution_id = id_string;
-          if (log)
-            log->Printf("distribution id set to \"%s\"",
-                        g_fields->m_distribution_id.c_str());
+          LLDB_LOGF(log, "distribution id set to \"%s\"",
+                    g_fields->m_distribution_id.c_str());
         } else {
-          if (log)
-            log->Printf("failed to find \"%s\" field in \"%s\"",
-                        distributor_id_key, distribution_id);
+          LLDB_LOGF(log, "failed to find \"%s\" field in \"%s\"",
+                    distributor_id_key, distribution_id);
         }
       } else {
-        if (log)
-          log->Printf("failed to retrieve distribution id, \"%s\" returned no"
-                      " lines",
-                      get_distribution_id_command.c_str());
+        LLDB_LOGF(log,
+                  "failed to retrieve distribution id, \"%s\" returned no"
+                  " lines",
+                  get_distribution_id_command.c_str());
       }
 
       // clean up the file

Modified: lldb/trunk/source/Host/macosx/objcxx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/objcxx/Host.mm?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/objcxx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/objcxx/Host.mm Wed Jul 24 10:56:10 2019
@@ -363,10 +363,9 @@ bool Host::OpenFileInExternalEditor(cons
   CFCReleaser<CFURLRef> file_URL(::CFURLCreateWithFileSystemPath(
       NULL, file_cfstr.get(), kCFURLPOSIXPathStyle, false));
 
-  if (log)
-    log->Printf(
-        "Sending source file: \"%s\" and line: %d to external editor.\n",
-        file_path, line_no);
+  LLDB_LOGF(log,
+            "Sending source file: \"%s\" and line: %d to external editor.\n",
+            file_path, line_no);
 
   long error;
   BabelAESelInfo file_and_line_info = {
@@ -385,8 +384,7 @@ bool Host::OpenFileInExternalEditor(cons
                          &(file_and_line_desc.descContent));
 
   if (error != noErr) {
-    if (log)
-      log->Printf("Error creating AEDesc: %ld.\n", error);
+    LLDB_LOGF(log, "Error creating AEDesc: %ld.\n", error);
     return false;
   }
 
@@ -403,8 +401,7 @@ bool Host::OpenFileInExternalEditor(cons
   char *external_editor = ::getenv("LLDB_EXTERNAL_EDITOR");
 
   if (external_editor) {
-    if (log)
-      log->Printf("Looking for external editor \"%s\".\n", external_editor);
+    LLDB_LOGF(log, "Looking for external editor \"%s\".\n", external_editor);
 
     if (g_app_name.empty() ||
         strcmp(g_app_name.c_str(), external_editor) != 0) {
@@ -415,10 +412,9 @@ bool Host::OpenFileInExternalEditor(cons
       // If we found the app, then store away the name so we don't have to
       // re-look it up.
       if (error != noErr) {
-        if (log)
-          log->Printf(
-              "Could not find External Editor application, error: %ld.\n",
-              error);
+        LLDB_LOGF(log,
+                  "Could not find External Editor application, error: %ld.\n",
+                  error);
         return false;
       }
     }
@@ -434,8 +430,7 @@ bool Host::OpenFileInExternalEditor(cons
   AEDisposeDesc(&(file_and_line_desc.descContent));
 
   if (error != noErr) {
-    if (log)
-      log->Printf("LSOpenURLsWithRole failed, error: %ld.\n", error);
+    LLDB_LOGF(log, "LSOpenURLsWithRole failed, error: %ld.\n", error);
 
     return false;
   }
@@ -1434,12 +1429,12 @@ llvm::Expected<HostThread> Host::StartMo
       DISPATCH_SOURCE_TYPE_PROC, pid, mask,
       ::dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0));
 
-  if (log)
-    log->Printf("Host::StartMonitoringChildProcess "
-                "(callback, pid=%i, monitor_signals=%i) "
-                "source = %p\n",
-                static_cast<int>(pid), monitor_signals,
-                reinterpret_cast<void *>(source));
+  LLDB_LOGF(log,
+            "Host::StartMonitoringChildProcess "
+            "(callback, pid=%i, monitor_signals=%i) "
+            "source = %p\n",
+            static_cast<int>(pid), monitor_signals,
+            reinterpret_cast<void *>(source));
 
   if (source) {
     Host::MonitorChildProcessCallback callback_copy = callback;
@@ -1473,10 +1468,10 @@ llvm::Expected<HostThread> Host::StartMo
           status_cstr = "???";
         }
 
-        if (log)
-          log->Printf("::waitpid (pid = %llu, &status, 0) => pid = %i, status "
-                      "= 0x%8.8x (%s), signal = %i, exit_status = %i",
-                      pid, wait_pid, status, status_cstr, signal, exit_status);
+        LLDB_LOGF(log,
+                  "::waitpid (pid = %llu, &status, 0) => pid = %i, status "
+                  "= 0x%8.8x (%s), signal = %i, exit_status = %i",
+                  pid, wait_pid, status, status_cstr, signal, exit_status);
 
         if (callback_copy)
           cancel = callback_copy(pid, exited, signal, exit_status);

Modified: lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm (original)
+++ lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm Wed Jul 24 10:56:10 2019
@@ -142,9 +142,8 @@ bool HostInfoMacOSX::ComputeSupportExeDi
     FileSystem::Instance().Resolve(support_dir_spec);
     if (!FileSystem::Instance().IsDirectory(support_dir_spec)) {
       Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
-      if (log)
-        log->Printf("HostInfoMacOSX::%s(): failed to find support directory",
-                    __FUNCTION__);
+      LLDB_LOGF(log, "HostInfoMacOSX::%s(): failed to find support directory",
+                __FUNCTION__);
       return false;
     }
 

Modified: lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp (original)
+++ lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp Wed Jul 24 10:56:10 2019
@@ -79,9 +79,8 @@ ConnectionFileDescriptor::ConnectionFile
       m_child_processes_inherit(child_processes_inherit) {
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION |
                                                   LIBLLDB_LOG_OBJECT));
-  if (log)
-    log->Printf("%p ConnectionFileDescriptor::ConnectionFileDescriptor ()",
-                static_cast<void *>(this));
+  LLDB_LOGF(log, "%p ConnectionFileDescriptor::ConnectionFileDescriptor ()",
+            static_cast<void *>(this));
 }
 
 ConnectionFileDescriptor::ConnectionFileDescriptor(int fd, bool owns_fd)
@@ -92,10 +91,10 @@ ConnectionFileDescriptor::ConnectionFile
 
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION |
                                                   LIBLLDB_LOG_OBJECT));
-  if (log)
-    log->Printf("%p ConnectionFileDescriptor::ConnectionFileDescriptor (fd = "
-                "%i, owns_fd = %i)",
-                static_cast<void *>(this), fd, owns_fd);
+  LLDB_LOGF(log,
+            "%p ConnectionFileDescriptor::ConnectionFileDescriptor (fd = "
+            "%i, owns_fd = %i)",
+            static_cast<void *>(this), fd, owns_fd);
   OpenCommandPipe();
 }
 
@@ -108,9 +107,8 @@ ConnectionFileDescriptor::ConnectionFile
 ConnectionFileDescriptor::~ConnectionFileDescriptor() {
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION |
                                                   LIBLLDB_LOG_OBJECT));
-  if (log)
-    log->Printf("%p ConnectionFileDescriptor::~ConnectionFileDescriptor ()",
-                static_cast<void *>(this));
+  LLDB_LOGF(log, "%p ConnectionFileDescriptor::~ConnectionFileDescriptor ()",
+            static_cast<void *>(this));
   Disconnect(nullptr);
   CloseCommandPipe();
 }
@@ -122,24 +120,23 @@ void ConnectionFileDescriptor::OpenComma
   // Make the command file descriptor here:
   Status result = m_pipe.CreateNew(m_child_processes_inherit);
   if (!result.Success()) {
-    if (log)
-      log->Printf("%p ConnectionFileDescriptor::OpenCommandPipe () - could not "
-                  "make pipe: %s",
-                  static_cast<void *>(this), result.AsCString());
+    LLDB_LOGF(log,
+              "%p ConnectionFileDescriptor::OpenCommandPipe () - could not "
+              "make pipe: %s",
+              static_cast<void *>(this), result.AsCString());
   } else {
-    if (log)
-      log->Printf("%p ConnectionFileDescriptor::OpenCommandPipe() - success "
-                  "readfd=%d writefd=%d",
-                  static_cast<void *>(this), m_pipe.GetReadFileDescriptor(),
-                  m_pipe.GetWriteFileDescriptor());
+    LLDB_LOGF(log,
+              "%p ConnectionFileDescriptor::OpenCommandPipe() - success "
+              "readfd=%d writefd=%d",
+              static_cast<void *>(this), m_pipe.GetReadFileDescriptor(),
+              m_pipe.GetWriteFileDescriptor());
   }
 }
 
 void ConnectionFileDescriptor::CloseCommandPipe() {
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
-  if (log)
-    log->Printf("%p ConnectionFileDescriptor::CloseCommandPipe()",
-                static_cast<void *>(this));
+  LLDB_LOGF(log, "%p ConnectionFileDescriptor::CloseCommandPipe()",
+            static_cast<void *>(this));
 
   m_pipe.Close();
 }
@@ -153,9 +150,8 @@ ConnectionStatus ConnectionFileDescripto
                                                    Status *error_ptr) {
   std::lock_guard<std::recursive_mutex> guard(m_mutex);
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
-  if (log)
-    log->Printf("%p ConnectionFileDescriptor::Connect (url = '%s')",
-                static_cast<void *>(this), path.str().c_str());
+  LLDB_LOGF(log, "%p ConnectionFileDescriptor::Connect (url = '%s')",
+            static_cast<void *>(this), path.str().c_str());
 
   OpenCommandPipe();
 
@@ -295,17 +291,15 @@ bool ConnectionFileDescriptor::Interrupt
 
 ConnectionStatus ConnectionFileDescriptor::Disconnect(Status *error_ptr) {
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
-  if (log)
-    log->Printf("%p ConnectionFileDescriptor::Disconnect ()",
-                static_cast<void *>(this));
+  LLDB_LOGF(log, "%p ConnectionFileDescriptor::Disconnect ()",
+            static_cast<void *>(this));
 
   ConnectionStatus status = eConnectionStatusSuccess;
 
   if (!IsConnected()) {
-    if (log)
-      log->Printf(
-          "%p ConnectionFileDescriptor::Disconnect(): Nothing to disconnect",
-          static_cast<void *>(this));
+    LLDB_LOGF(
+        log, "%p ConnectionFileDescriptor::Disconnect(): Nothing to disconnect",
+        static_cast<void *>(this));
     return eConnectionStatusSuccess;
   }
 
@@ -326,15 +320,16 @@ ConnectionStatus ConnectionFileDescripto
     if (m_pipe.CanWrite()) {
       size_t bytes_written = 0;
       Status result = m_pipe.Write("q", 1, bytes_written);
-      if (log)
-        log->Printf("%p ConnectionFileDescriptor::Disconnect(): Couldn't get "
-                    "the lock, sent 'q' to %d, error = '%s'.",
-                    static_cast<void *>(this), m_pipe.GetWriteFileDescriptor(),
-                    result.AsCString());
+      LLDB_LOGF(log,
+                "%p ConnectionFileDescriptor::Disconnect(): Couldn't get "
+                "the lock, sent 'q' to %d, error = '%s'.",
+                static_cast<void *>(this), m_pipe.GetWriteFileDescriptor(),
+                result.AsCString());
     } else if (log) {
-      log->Printf("%p ConnectionFileDescriptor::Disconnect(): Couldn't get the "
-                  "lock, but no command pipe is available.",
-                  static_cast<void *>(this));
+      LLDB_LOGF(log,
+                "%p ConnectionFileDescriptor::Disconnect(): Couldn't get the "
+                "lock, but no command pipe is available.",
+                static_cast<void *>(this));
     }
     locker.lock();
   }
@@ -362,10 +357,10 @@ size_t ConnectionFileDescriptor::Read(vo
 
   std::unique_lock<std::recursive_mutex> locker(m_mutex, std::defer_lock);
   if (!locker.try_lock()) {
-    if (log)
-      log->Printf("%p ConnectionFileDescriptor::Read () failed to get the "
-                  "connection lock.",
-                  static_cast<void *>(this));
+    LLDB_LOGF(log,
+              "%p ConnectionFileDescriptor::Read () failed to get the "
+              "connection lock.",
+              static_cast<void *>(this));
     if (error_ptr)
       error_ptr->SetErrorString("failed to get the connection lock for read.");
 
@@ -387,12 +382,13 @@ size_t ConnectionFileDescriptor::Read(vo
   error = m_read_sp->Read(dst, bytes_read);
 
   if (log) {
-    log->Printf("%p ConnectionFileDescriptor::Read()  fd = %" PRIu64
-                ", dst = %p, dst_len = %" PRIu64 ") => %" PRIu64 ", error = %s",
-                static_cast<void *>(this),
-                static_cast<uint64_t>(m_read_sp->GetWaitableHandle()),
-                static_cast<void *>(dst), static_cast<uint64_t>(dst_len),
-                static_cast<uint64_t>(bytes_read), error.AsCString());
+    LLDB_LOGF(log,
+              "%p ConnectionFileDescriptor::Read()  fd = %" PRIu64
+              ", dst = %p, dst_len = %" PRIu64 ") => %" PRIu64 ", error = %s",
+              static_cast<void *>(this),
+              static_cast<uint64_t>(m_read_sp->GetWaitableHandle()),
+              static_cast<void *>(dst), static_cast<uint64_t>(dst_len),
+              static_cast<uint64_t>(bytes_read), error.AsCString());
   }
 
   if (bytes_read == 0) {
@@ -464,11 +460,11 @@ size_t ConnectionFileDescriptor::Write(c
                                        ConnectionStatus &status,
                                        Status *error_ptr) {
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
-  if (log)
-    log->Printf(
-        "%p ConnectionFileDescriptor::Write (src = %p, src_len = %" PRIu64 ")",
-        static_cast<void *>(this), static_cast<const void *>(src),
-        static_cast<uint64_t>(src_len));
+  LLDB_LOGF(log,
+            "%p ConnectionFileDescriptor::Write (src = %p, src_len = %" PRIu64
+            ")",
+            static_cast<void *>(this), static_cast<const void *>(src),
+            static_cast<uint64_t>(src_len));
 
   if (!IsConnected()) {
     if (error_ptr)
@@ -483,13 +479,13 @@ size_t ConnectionFileDescriptor::Write(c
   error = m_write_sp->Write(src, bytes_sent);
 
   if (log) {
-    log->Printf("%p ConnectionFileDescriptor::Write(fd = %" PRIu64
-                ", src = %p, src_len = %" PRIu64 ") => %" PRIu64
-                " (error = %s)",
-                static_cast<void *>(this),
-                static_cast<uint64_t>(m_write_sp->GetWaitableHandle()),
-                static_cast<const void *>(src), static_cast<uint64_t>(src_len),
-                static_cast<uint64_t>(bytes_sent), error.AsCString());
+    LLDB_LOGF(log,
+              "%p ConnectionFileDescriptor::Write(fd = %" PRIu64
+              ", src = %p, src_len = %" PRIu64 ") => %" PRIu64 " (error = %s)",
+              static_cast<void *>(this),
+              static_cast<uint64_t>(m_write_sp->GetWaitableHandle()),
+              static_cast<const void *>(src), static_cast<uint64_t>(src_len),
+              static_cast<uint64_t>(bytes_sent), error.AsCString());
   }
 
   if (error_ptr)
@@ -613,10 +609,10 @@ ConnectionFileDescriptor::BytesAvailable
           (void)bytes_read;
           switch (c) {
           case 'q':
-            if (log)
-              log->Printf("%p ConnectionFileDescriptor::BytesAvailable() "
-                          "got data: %c from the command channel.",
-                          static_cast<void *>(this), c);
+            LLDB_LOGF(log,
+                      "%p ConnectionFileDescriptor::BytesAvailable() "
+                      "got data: %c from the command channel.",
+                      static_cast<void *>(this), c);
             return eConnectionStatusEndOfFile;
           case 'i':
             // Interrupt the current read

Modified: lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp Wed Jul 24 10:56:10 2019
@@ -91,9 +91,8 @@ bool ConnectionGenericFile::IsConnected(
 lldb::ConnectionStatus ConnectionGenericFile::Connect(llvm::StringRef path,
                                                       Status *error_ptr) {
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
-  if (log)
-    log->Printf("%p ConnectionGenericFile::Connect (url = '%s')",
-                static_cast<void *>(this), path.str().c_str());
+  LLDB_LOGF(log, "%p ConnectionGenericFile::Connect (url = '%s')",
+            static_cast<void *>(this), path.str().c_str());
 
   if (!path.consume_front("file://")) {
     if (error_ptr)
@@ -134,9 +133,8 @@ lldb::ConnectionStatus ConnectionGeneric
 
 lldb::ConnectionStatus ConnectionGenericFile::Disconnect(Status *error_ptr) {
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
-  if (log)
-    log->Printf("%p ConnectionGenericFile::Disconnect ()",
-                static_cast<void *>(this));
+  LLDB_LOGF(log, "%p ConnectionGenericFile::Disconnect ()",
+            static_cast<void *>(this));
 
   if (!IsConnected())
     return eConnectionStatusSuccess;
@@ -248,10 +246,11 @@ finish:
   IncrementFilePointer(return_info.GetBytes());
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
   if (log) {
-    log->Printf("%p ConnectionGenericFile::Read()  handle = %p, dst = %p, "
-                "dst_len = %zu) => %zu, error = %s",
-                this, m_file, dst, dst_len, return_info.GetBytes(),
-                return_info.GetError().AsCString());
+    LLDB_LOGF(log,
+              "%p ConnectionGenericFile::Read()  handle = %p, dst = %p, "
+              "dst_len = %zu) => %zu, error = %s",
+              this, m_file, dst, dst_len, return_info.GetBytes(),
+              return_info.GetError().AsCString());
   }
 
   return return_info.GetBytes();
@@ -298,10 +297,11 @@ finish:
   IncrementFilePointer(return_info.GetBytes());
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
   if (log) {
-    log->Printf("%p ConnectionGenericFile::Write()  handle = %p, src = %p, "
-                "src_len = %zu) => %zu, error = %s",
-                this, m_file, src, src_len, return_info.GetBytes(),
-                return_info.GetError().AsCString());
+    LLDB_LOGF(log,
+              "%p ConnectionGenericFile::Write()  handle = %p, src = %p, "
+              "src_len = %zu) => %zu, error = %s",
+              this, m_file, src, src_len, return_info.GetBytes(),
+              return_info.GetError().AsCString());
   }
   return return_info.GetBytes();
 }

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Wed Jul 24 10:56:10 2019
@@ -1628,8 +1628,7 @@ bool CommandInterpreter::HandleCommand(c
   llvm::PrettyStackTraceFormat stack_trace("HandleCommand(command = \"%s\")",
                                    command_line);
 
-  if (log)
-    log->Printf("Processing command: %s", command_line);
+  LLDB_LOGF(log, "Processing command: %s", command_line);
 
   static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
   Timer scoped_timer(func_cat, "Handling command: %s.", command_line);
@@ -1735,13 +1734,13 @@ bool CommandInterpreter::HandleCommand(c
   // "br s -n main", command_string is now "breakpoint set -n main".
   if (log) {
     llvm::StringRef command_name = cmd_obj ? cmd_obj->GetCommandName() : "<not found>";
-    log->Printf("HandleCommand, cmd_obj : '%s'", command_name.str().c_str());
-    log->Printf("HandleCommand, (revised) command_string: '%s'",
-                command_string.c_str());
+    LLDB_LOGF(log, "HandleCommand, cmd_obj : '%s'", command_name.str().c_str());
+    LLDB_LOGF(log, "HandleCommand, (revised) command_string: '%s'",
+              command_string.c_str());
     const bool wants_raw_input =
         (cmd_obj != nullptr) ? cmd_obj->WantsRawCommandString() : false;
-    log->Printf("HandleCommand, wants_raw_input:'%s'",
-                wants_raw_input ? "True" : "False");
+    LLDB_LOGF(log, "HandleCommand, wants_raw_input:'%s'",
+              wants_raw_input ? "True" : "False");
   }
 
   // Phase 2.
@@ -1771,17 +1770,15 @@ bool CommandInterpreter::HandleCommand(c
     if (pos != 0 && pos != std::string::npos)
       remainder.erase(0, pos);
 
-    if (log)
-      log->Printf(
-          "HandleCommand, command line after removing command name(s): '%s'",
-          remainder.c_str());
+    LLDB_LOGF(
+        log, "HandleCommand, command line after removing command name(s): '%s'",
+        remainder.c_str());
 
     cmd_obj->Execute(remainder.c_str(), result);
   }
 
-  if (log)
-    log->Printf("HandleCommand, command %s",
-                (result.Succeeded() ? "succeeded" : "did not succeed"));
+  LLDB_LOGF(log, "HandleCommand, command %s",
+            (result.Succeeded() ? "succeeded" : "did not succeed"));
 
   return result.Succeeded();
 }

Modified: lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp Wed Jul 24 10:56:10 2019
@@ -1710,9 +1710,8 @@ bool ABIMacOSX_arm64::PrepareTrivialCall
   for (size_t i = 0; i < args.size(); ++i) {
     const RegisterInfo *reg_info = reg_ctx->GetRegisterInfo(
         eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1 + i);
-    if (log)
-      log->Printf("About to write arg%d (0x%" PRIx64 ") into %s",
-                  static_cast<int>(i + 1), args[i], reg_info->name);
+    LLDB_LOGF(log, "About to write arg%d (0x%" PRIx64 ") into %s",
+              static_cast<int>(i + 1), args[i], reg_info->name);
     if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
       return false;
   }

Modified: lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp Wed Jul 24 10:56:10 2019
@@ -1706,9 +1706,8 @@ bool ABISysV_arm64::PrepareTrivialCall(T
   for (size_t i = 0; i < args.size(); ++i) {
     const RegisterInfo *reg_info = reg_ctx->GetRegisterInfo(
         eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1 + i);
-    if (log)
-      log->Printf("About to write arg%d (0x%" PRIx64 ") into %s",
-                  static_cast<int>(i + 1), args[i], reg_info->name);
+    LLDB_LOGF(log, "About to write arg%d (0x%" PRIx64 ") into %s",
+              static_cast<int>(i + 1), args[i], reg_info->name);
     if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
       return false;
   }

Modified: lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp Wed Jul 24 10:56:10 2019
@@ -600,9 +600,8 @@ bool ABISysV_mips::PrepareTrivialCall(Th
 
     reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric,
                                         LLDB_REGNUM_GENERIC_ARG1 + i);
-    if (log)
-      log->Printf("About to write arg%zd (0x%" PRIx64 ") into %s", i + 1,
-                  args[i], reg_info->name);
+    LLDB_LOGF(log, "About to write arg%zd (0x%" PRIx64 ") into %s", i + 1,
+              args[i], reg_info->name);
 
     if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
       return false;
@@ -630,9 +629,8 @@ bool ABISysV_mips::PrepareTrivialCall(Th
     size_t i = 4;
     for (; ai != ae; ++ai) {
       reg_value.SetUInt32(*ai);
-      if (log)
-        log->Printf("About to write arg%zd (0x%" PRIx64 ") at  0x%" PRIx64 "",
-                    i + 1, args[i], arg_pos);
+      LLDB_LOGF(log, "About to write arg%zd (0x%" PRIx64 ") at  0x%" PRIx64 "",
+                i + 1, args[i], arg_pos);
 
       if (reg_ctx
               ->WriteRegisterValueToMemory(reg_info, arg_pos,
@@ -654,8 +652,7 @@ bool ABISysV_mips::PrepareTrivialCall(Th
   const RegisterInfo *r25_info = reg_ctx->GetRegisterInfoByName("r25", 0);
   const RegisterInfo *r0_info = reg_ctx->GetRegisterInfoByName("zero", 0);
 
-  if (log)
-    log->Printf("Writing R0: 0x%" PRIx64, (uint64_t)0);
+  LLDB_LOGF(log, "Writing R0: 0x%" PRIx64, (uint64_t)0);
 
   /* Write r0 with 0, in case we are stopped in syscall,
    * such setting prevents automatic decrement of the PC.
@@ -664,29 +661,25 @@ bool ABISysV_mips::PrepareTrivialCall(Th
   if (!reg_ctx->WriteRegisterFromUnsigned(r0_info, (uint64_t)0))
     return false;
 
-  if (log)
-    log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
+  LLDB_LOGF(log, "Writing SP: 0x%" PRIx64, (uint64_t)sp);
 
   // Set "sp" to the requested value
   if (!reg_ctx->WriteRegisterFromUnsigned(sp_reg_info, sp))
     return false;
 
-  if (log)
-    log->Printf("Writing RA: 0x%" PRIx64, (uint64_t)return_addr);
+  LLDB_LOGF(log, "Writing RA: 0x%" PRIx64, (uint64_t)return_addr);
 
   // Set "ra" to the return address
   if (!reg_ctx->WriteRegisterFromUnsigned(ra_reg_info, return_addr))
     return false;
 
-  if (log)
-    log->Printf("Writing PC: 0x%" PRIx64, (uint64_t)func_addr);
+  LLDB_LOGF(log, "Writing PC: 0x%" PRIx64, (uint64_t)func_addr);
 
   // Set pc to the address of the called function.
   if (!reg_ctx->WriteRegisterFromUnsigned(pc_reg_info, func_addr))
     return false;
 
-  if (log)
-    log->Printf("Writing r25: 0x%" PRIx64, (uint64_t)func_addr);
+  LLDB_LOGF(log, "Writing r25: 0x%" PRIx64, (uint64_t)func_addr);
 
   // All callers of position independent functions must place the address of
   // the called function in t9 (r25)

Modified: lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp Wed Jul 24 10:56:10 2019
@@ -589,18 +589,16 @@ bool ABISysV_mips64::PrepareTrivialCall(
   for (size_t i = 0; i < args.size(); ++i) {
     reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric,
                                         LLDB_REGNUM_GENERIC_ARG1 + i);
-    if (log)
-      log->Printf("About to write arg%zd (0x%" PRIx64 ") into %s", i + 1,
-                  args[i], reg_info->name);
+    LLDB_LOGF(log, "About to write arg%zd (0x%" PRIx64 ") into %s", i + 1,
+              args[i], reg_info->name);
     if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
       return false;
   }
 
   // First, align the SP
 
-  if (log)
-    log->Printf("16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
-                (uint64_t)sp, (uint64_t)(sp & ~0xfull));
+  LLDB_LOGF(log, "16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
+            (uint64_t)sp, (uint64_t)(sp & ~0xfull));
 
   sp &= ~(0xfull); // 16-byte alignment
 
@@ -614,8 +612,7 @@ bool ABISysV_mips64::PrepareTrivialCall(
   const RegisterInfo *r25_info = reg_ctx->GetRegisterInfoByName("r25", 0);
   const RegisterInfo *r0_info = reg_ctx->GetRegisterInfoByName("zero", 0);
 
-  if (log)
-    log->Printf("Writing R0: 0x%" PRIx64, (uint64_t)0);
+  LLDB_LOGF(log, "Writing R0: 0x%" PRIx64, (uint64_t)0);
 
   /* Write r0 with 0, in case we are stopped in syscall,
    * such setting prevents automatic decrement of the PC.
@@ -624,29 +621,25 @@ bool ABISysV_mips64::PrepareTrivialCall(
   if (!reg_ctx->WriteRegisterFromUnsigned(r0_info, (uint64_t)0))
     return false;
 
-  if (log)
-    log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
+  LLDB_LOGF(log, "Writing SP: 0x%" PRIx64, (uint64_t)sp);
 
   // Set "sp" to the requested value
   if (!reg_ctx->WriteRegisterFromUnsigned(sp_reg_info, sp))
     return false;
 
-  if (log)
-    log->Printf("Writing RA: 0x%" PRIx64, (uint64_t)return_addr);
+  LLDB_LOGF(log, "Writing RA: 0x%" PRIx64, (uint64_t)return_addr);
 
   // Set "ra" to the return address
   if (!reg_ctx->WriteRegisterFromUnsigned(ra_reg_info, return_addr))
     return false;
 
-  if (log)
-    log->Printf("Writing PC: 0x%" PRIx64, (uint64_t)func_addr);
+  LLDB_LOGF(log, "Writing PC: 0x%" PRIx64, (uint64_t)func_addr);
 
   // Set pc to the address of the called function.
   if (!reg_ctx->WriteRegisterFromUnsigned(pc_reg_info, func_addr))
     return false;
 
-  if (log)
-    log->Printf("Writing r25: 0x%" PRIx64, (uint64_t)func_addr);
+  LLDB_LOGF(log, "Writing r25: 0x%" PRIx64, (uint64_t)func_addr);
 
   // All callers of position independent functions must place the address of
   // the called function in t9 (r25)

Modified: lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp Wed Jul 24 10:56:10 2019
@@ -255,18 +255,16 @@ bool ABISysV_ppc::PrepareTrivialCall(Thr
   for (size_t i = 0; i < args.size(); ++i) {
     reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric,
                                         LLDB_REGNUM_GENERIC_ARG1 + i);
-    if (log)
-      log->Printf("About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
-                  static_cast<uint64_t>(i + 1), args[i], reg_info->name);
+    LLDB_LOGF(log, "About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
+              static_cast<uint64_t>(i + 1), args[i], reg_info->name);
     if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
       return false;
   }
 
   // First, align the SP
 
-  if (log)
-    log->Printf("16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
-                (uint64_t)sp, (uint64_t)(sp & ~0xfull));
+  LLDB_LOGF(log, "16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
+            (uint64_t)sp, (uint64_t)(sp & ~0xfull));
 
   sp &= ~(0xfull); // 16-byte alignment
 
@@ -281,10 +279,10 @@ bool ABISysV_ppc::PrepareTrivialCall(Thr
 
   RegisterValue reg_value;
 
-  if (log)
-    log->Printf("Pushing the return address onto the stack: 0x%" PRIx64
-                ": 0x%" PRIx64,
-                (uint64_t)sp, (uint64_t)return_addr);
+  LLDB_LOGF(log,
+            "Pushing the return address onto the stack: 0x%" PRIx64
+            ": 0x%" PRIx64,
+            (uint64_t)sp, (uint64_t)return_addr);
 
   // Save return address onto the stack
   if (!process_sp->WritePointerToMemory(sp, return_addr, error))
@@ -292,16 +290,14 @@ bool ABISysV_ppc::PrepareTrivialCall(Thr
 
   // %r1 is set to the actual stack value.
 
-  if (log)
-    log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
+  LLDB_LOGF(log, "Writing SP: 0x%" PRIx64, (uint64_t)sp);
 
   if (!reg_ctx->WriteRegisterFromUnsigned(sp_reg_info, sp))
     return false;
 
   // %pc is set to the address of the called function.
 
-  if (log)
-    log->Printf("Writing IP: 0x%" PRIx64, (uint64_t)func_addr);
+  LLDB_LOGF(log, "Writing IP: 0x%" PRIx64, (uint64_t)func_addr);
 
   if (!reg_ctx->WriteRegisterFromUnsigned(pc_reg_info, func_addr))
     return false;

Modified: lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp Wed Jul 24 10:56:10 2019
@@ -106,18 +106,16 @@ bool ABISysV_ppc64::PrepareTrivialCall(T
   for (size_t i = 0; i < args.size(); ++i) {
     reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric,
                                         LLDB_REGNUM_GENERIC_ARG1 + i);
-    if (log)
-      log->Printf("About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
-                  static_cast<uint64_t>(i + 1), args[i], reg_info->name);
+    LLDB_LOGF(log, "About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
+              static_cast<uint64_t>(i + 1), args[i], reg_info->name);
     if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
       return false;
   }
 
   // First, align the SP
 
-  if (log)
-    log->Printf("16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
-                (uint64_t)sp, (uint64_t)(sp & ~0xfull));
+  LLDB_LOGF(log, "16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
+            (uint64_t)sp, (uint64_t)(sp & ~0xfull));
 
   sp &= ~(0xfull); // 16-byte alignment
 
@@ -136,22 +134,20 @@ bool ABISysV_ppc64::PrepareTrivialCall(T
   const RegisterInfo *r12_reg_info = reg_ctx->GetRegisterInfoAtIndex(12);
 
   // Save return address onto the stack.
-  if (log)
-    log->Printf("Pushing the return address onto the stack: 0x%" PRIx64
-                "(+16): 0x%" PRIx64,
-                (uint64_t)sp, (uint64_t)return_addr);
+  LLDB_LOGF(log,
+            "Pushing the return address onto the stack: 0x%" PRIx64
+            "(+16): 0x%" PRIx64,
+            (uint64_t)sp, (uint64_t)return_addr);
   if (!process_sp->WritePointerToMemory(sp + 16, return_addr, error))
     return false;
 
   // Write the return address to link register.
-  if (log)
-    log->Printf("Writing LR: 0x%" PRIx64, (uint64_t)return_addr);
+  LLDB_LOGF(log, "Writing LR: 0x%" PRIx64, (uint64_t)return_addr);
   if (!reg_ctx->WriteRegisterFromUnsigned(lr_reg_info, return_addr))
     return false;
 
   // Write target address to %r12 register.
-  if (log)
-    log->Printf("Writing R12: 0x%" PRIx64, (uint64_t)func_addr);
+  LLDB_LOGF(log, "Writing R12: 0x%" PRIx64, (uint64_t)func_addr);
   if (!reg_ctx->WriteRegisterFromUnsigned(r12_reg_info, func_addr))
     return false;
 
@@ -165,10 +161,9 @@ bool ABISysV_ppc64::PrepareTrivialCall(T
   else
     stack_offset = 40;
 
-  if (log)
-    log->Printf("Writing R2 (TOC) at SP(0x%" PRIx64 ")+%d: 0x%" PRIx64,
-                (uint64_t)(sp + stack_offset), (int)stack_offset,
-                (uint64_t)reg_value);
+  LLDB_LOGF(log, "Writing R2 (TOC) at SP(0x%" PRIx64 ")+%d: 0x%" PRIx64,
+            (uint64_t)(sp + stack_offset), (int)stack_offset,
+            (uint64_t)reg_value);
   if (!process_sp->WritePointerToMemory(sp + stack_offset, reg_value, error))
     return false;
 
@@ -176,23 +171,20 @@ bool ABISysV_ppc64::PrepareTrivialCall(T
   reg_value = reg_ctx->ReadRegisterAsUnsigned(sp_reg_info, 0);
 
   // Save current SP onto the stack.
-  if (log)
-    log->Printf("Writing SP at SP(0x%" PRIx64 ")+0: 0x%" PRIx64, (uint64_t)sp,
-                (uint64_t)reg_value);
+  LLDB_LOGF(log, "Writing SP at SP(0x%" PRIx64 ")+0: 0x%" PRIx64, (uint64_t)sp,
+            (uint64_t)reg_value);
   if (!process_sp->WritePointerToMemory(sp, reg_value, error))
     return false;
 
   // %r1 is set to the actual stack value.
-  if (log)
-    log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
+  LLDB_LOGF(log, "Writing SP: 0x%" PRIx64, (uint64_t)sp);
 
   if (!reg_ctx->WriteRegisterFromUnsigned(sp_reg_info, sp))
     return false;
 
   // %pc is set to the address of the called function.
 
-  if (log)
-    log->Printf("Writing IP: 0x%" PRIx64, (uint64_t)func_addr);
+  LLDB_LOGF(log, "Writing IP: 0x%" PRIx64, (uint64_t)func_addr);
 
   if (!reg_ctx->WriteRegisterFromUnsigned(pc_reg_info, func_addr))
     return false;

Modified: lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp Wed Jul 24 10:56:10 2019
@@ -252,16 +252,14 @@ bool ABISysV_s390x::PrepareTrivialCall(T
     if (i < 5) {
       const RegisterInfo *reg_info = reg_ctx->GetRegisterInfo(
           eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1 + i);
-      if (log)
-        log->Printf("About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
-                    static_cast<uint64_t>(i + 1), args[i], reg_info->name);
+      LLDB_LOGF(log, "About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
+                static_cast<uint64_t>(i + 1), args[i], reg_info->name);
       if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
         return false;
     } else {
       Status error;
-      if (log)
-        log->Printf("About to write arg%" PRIu64 " (0x%" PRIx64 ") onto stack",
-                    static_cast<uint64_t>(i + 1), args[i]);
+      LLDB_LOGF(log, "About to write arg%" PRIu64 " (0x%" PRIx64 ") onto stack",
+                static_cast<uint64_t>(i + 1), args[i]);
       if (!process_sp->WritePointerToMemory(arg_pos, args[i], error))
         return false;
       arg_pos += 8;
@@ -270,24 +268,21 @@ bool ABISysV_s390x::PrepareTrivialCall(T
 
   // %r14 is set to the return address
 
-  if (log)
-    log->Printf("Writing RA: 0x%" PRIx64, (uint64_t)return_addr);
+  LLDB_LOGF(log, "Writing RA: 0x%" PRIx64, (uint64_t)return_addr);
 
   if (!reg_ctx->WriteRegisterFromUnsigned(ra_reg_info, return_addr))
     return false;
 
   // %r15 is set to the actual stack value.
 
-  if (log)
-    log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
+  LLDB_LOGF(log, "Writing SP: 0x%" PRIx64, (uint64_t)sp);
 
   if (!reg_ctx->WriteRegisterFromUnsigned(sp_reg_info, sp))
     return false;
 
   // %pc is set to the address of the called function.
 
-  if (log)
-    log->Printf("Writing PC: 0x%" PRIx64, (uint64_t)func_addr);
+  LLDB_LOGF(log, "Writing PC: 0x%" PRIx64, (uint64_t)func_addr);
 
   if (!reg_ctx->WriteRegisterFromUnsigned(pc_reg_info, func_addr))
     return false;

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=366936&r1=366935&r2=366936&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 Wed Jul 24 10:56:10 2019
@@ -270,18 +270,16 @@ bool ABISysV_x86_64::PrepareTrivialCall(
   for (size_t i = 0; i < args.size(); ++i) {
     reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric,
                                         LLDB_REGNUM_GENERIC_ARG1 + i);
-    if (log)
-      log->Printf("About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
-                  static_cast<uint64_t>(i + 1), args[i], reg_info->name);
+    LLDB_LOGF(log, "About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
+              static_cast<uint64_t>(i + 1), args[i], reg_info->name);
     if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
       return false;
   }
 
   // First, align the SP
 
-  if (log)
-    log->Printf("16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
-                (uint64_t)sp, (uint64_t)(sp & ~0xfull));
+  LLDB_LOGF(log, "16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
+            (uint64_t)sp, (uint64_t)(sp & ~0xfull));
 
   sp &= ~(0xfull); // 16-byte alignment
 
@@ -295,10 +293,10 @@ bool ABISysV_x86_64::PrepareTrivialCall(
   ProcessSP process_sp(thread.GetProcess());
 
   RegisterValue reg_value;
-  if (log)
-    log->Printf("Pushing the return address onto the stack: 0x%" PRIx64
-                ": 0x%" PRIx64,
-                (uint64_t)sp, (uint64_t)return_addr);
+  LLDB_LOGF(log,
+            "Pushing the return address onto the stack: 0x%" PRIx64
+            ": 0x%" PRIx64,
+            (uint64_t)sp, (uint64_t)return_addr);
 
   // Save return address onto the stack
   if (!process_sp->WritePointerToMemory(sp, return_addr, error))
@@ -306,16 +304,14 @@ bool ABISysV_x86_64::PrepareTrivialCall(
 
   // %rsp is set to the actual stack value.
 
-  if (log)
-    log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
+  LLDB_LOGF(log, "Writing SP: 0x%" PRIx64, (uint64_t)sp);
 
   if (!reg_ctx->WriteRegisterFromUnsigned(sp_reg_info, sp))
     return false;
 
   // %rip is set to the address of the called function.
 
-  if (log)
-    log->Printf("Writing IP: 0x%" PRIx64, (uint64_t)func_addr);
+  LLDB_LOGF(log, "Writing IP: 0x%" PRIx64, (uint64_t)func_addr);
 
   if (!reg_ctx->WriteRegisterFromUnsigned(pc_reg_info, func_addr))
     return false;

Modified: lldb/trunk/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp Wed Jul 24 10:56:10 2019
@@ -1129,18 +1129,16 @@ bool ABIWindows_x86_64::PrepareTrivialCa
   for (size_t i = 0; i < args.size(); ++i) {
     reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric,
                                         LLDB_REGNUM_GENERIC_ARG1 + i);
-    if (log)
-      log->Printf("About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
-                  static_cast<uint64_t>(i + 1), args[i], reg_info->name);
+    LLDB_LOGF(log, "About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
+              static_cast<uint64_t>(i + 1), args[i], reg_info->name);
     if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
       return false;
   }
 
   // First, align the SP
 
-  if (log)
-    log->Printf("16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
-                (uint64_t)sp, (uint64_t)(sp & ~0xfull));
+  LLDB_LOGF(log, "16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
+            (uint64_t)sp, (uint64_t)(sp & ~0xfull));
 
   sp &= ~(0xfull); // 16-byte alignment
 
@@ -1154,10 +1152,10 @@ bool ABIWindows_x86_64::PrepareTrivialCa
   ProcessSP process_sp(thread.GetProcess());
 
   RegisterValue reg_value;
-  if (log)
-    log->Printf("Pushing the return address onto the stack: 0x%" PRIx64
-                ": 0x%" PRIx64,
-                (uint64_t)sp, (uint64_t)return_addr);
+  LLDB_LOGF(log,
+            "Pushing the return address onto the stack: 0x%" PRIx64
+            ": 0x%" PRIx64,
+            (uint64_t)sp, (uint64_t)return_addr);
 
   // Save return address onto the stack
   if (!process_sp->WritePointerToMemory(sp, return_addr, error))
@@ -1165,16 +1163,14 @@ bool ABIWindows_x86_64::PrepareTrivialCa
 
   // %rsp is set to the actual stack value.
 
-  if (log)
-    log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
+  LLDB_LOGF(log, "Writing SP: 0x%" PRIx64, (uint64_t)sp);
 
   if (!reg_ctx->WriteRegisterFromUnsigned(sp_reg_info, sp))
     return false;
 
   // %rip is set to the address of the called function.
 
-  if (log)
-    log->Printf("Writing IP: 0x%" PRIx64, (uint64_t)func_addr);
+  LLDB_LOGF(log, "Writing IP: 0x%" PRIx64, (uint64_t)func_addr);
 
   if (!reg_ctx->WriteRegisterFromUnsigned(pc_reg_info, func_addr))
     return false;

Modified: lldb/trunk/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Architecture/Mips/ArchitectureMips.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Architecture/Mips/ArchitectureMips.cpp (original)
+++ lldb/trunk/source/Plugins/Architecture/Mips/ArchitectureMips.cpp Wed Jul 24 10:56:10 2019
@@ -127,10 +127,10 @@ lldb::addr_t ArchitectureMips::GetBreaka
 
   // Adjust the breakable address
   uint64_t breakable_addr = addr - insn->GetOpcode().GetByteSize();
-  if (log)
-    log->Printf("Target::%s Breakpoint at 0x%8.8" PRIx64
-      " is adjusted to 0x%8.8" PRIx64 " due to delay slot\n",
-      __FUNCTION__, addr, breakable_addr);
+  LLDB_LOGF(log,
+            "Target::%s Breakpoint at 0x%8.8" PRIx64
+            " is adjusted to 0x%8.8" PRIx64 " due to delay slot\n",
+            __FUNCTION__, addr, breakable_addr);
 
   return breakable_addr;
 }

Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Wed Jul 24 10:56:10 2019
@@ -430,10 +430,10 @@ DynamicLoaderDarwinKernel::CheckForKerne
     return UUID();
   }
 
-  if (log)
-    log->Printf("DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress: "
-                "looking for kernel binary at 0x%" PRIx64,
-                addr);
+  LLDB_LOGF(log,
+            "DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress: "
+            "looking for kernel binary at 0x%" PRIx64,
+            addr);
 
   llvm::MachO::mach_header header;
 
@@ -455,11 +455,11 @@ DynamicLoaderDarwinKernel::CheckForKerne
 
     ObjectFile *exe_objfile = memory_module_sp->GetObjectFile();
     if (exe_objfile == nullptr) {
-      if (log)
-        log->Printf("DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress "
-                    "found a binary at 0x%" PRIx64
-                    " but could not create an object file from memory",
-                    addr);
+      LLDB_LOGF(log,
+                "DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress "
+                "found a binary at 0x%" PRIx64
+                " but could not create an object file from memory",
+                addr);
       return UUID();
     }
 
@@ -478,7 +478,8 @@ DynamicLoaderDarwinKernel::CheckForKerne
         } else {
           uuid_str = "and no LC_UUID found in load commands ";
         }
-        log->Printf(
+        LLDB_LOGF(
+            log,
             "DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress: "
             "kernel binary image found at 0x%" PRIx64 " with arch '%s' %s",
             addr, kernel_arch.GetTriple().str().c_str(), uuid_str.c_str());
@@ -680,11 +681,12 @@ bool DynamicLoaderDarwinKernel::KextImag
   if (m_uuid.IsValid()) {
     if (m_uuid != memory_module_sp->GetUUID()) {
       if (log) {
-        log->Printf("KextImageInfo::ReadMemoryModule the kernel said to find "
-                    "uuid %s at 0x%" PRIx64
-                    " but instead we found uuid %s, throwing it away",
-                    m_uuid.GetAsString().c_str(), m_load_address,
-                    memory_module_sp->GetUUID().GetAsString().c_str());
+        LLDB_LOGF(log,
+                  "KextImageInfo::ReadMemoryModule the kernel said to find "
+                  "uuid %s at 0x%" PRIx64
+                  " but instead we found uuid %s, throwing it away",
+                  m_uuid.GetAsString().c_str(), m_load_address,
+                  memory_module_sp->GetUUID().GetAsString().c_str());
       }
       return false;
     }
@@ -700,8 +702,9 @@ bool DynamicLoaderDarwinKernel::KextImag
   if (is_kernel) {
     if (log) {
       // This is unusual and probably not intended
-      log->Printf("KextImageInfo::ReadMemoryModule read the kernel binary out "
-                  "of memory");
+      LLDB_LOGF(log,
+                "KextImageInfo::ReadMemoryModule read the kernel binary out "
+                "of memory");
     }
     if (memory_module_sp->GetArchitecture().IsValid()) {
       process->GetTarget().SetArchitecture(memory_module_sp->GetArchitecture());
@@ -747,10 +750,10 @@ bool DynamicLoaderDarwinKernel::KextImag
   if (m_uuid.IsValid() == false) {
     if (ReadMemoryModule(process) == false) {
       Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
-      if (log)
-        log->Printf("Unable to read '%s' from memory at address 0x%" PRIx64
-                    " to get the segment load addresses.",
-                    m_name.c_str(), m_load_address);
+      LLDB_LOGF(log,
+                "Unable to read '%s' from memory at address 0x%" PRIx64
+                " to get the segment load addresses.",
+                m_name.c_str(), m_load_address);
       return false;
     }
   }
@@ -1054,8 +1057,7 @@ bool DynamicLoaderDarwinKernel::Breakpoi
                                               user_id_t break_id,
                                               user_id_t break_loc_id) {
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
-  if (log)
-    log->Printf("DynamicLoaderDarwinKernel::BreakpointHit (...)\n");
+  LLDB_LOGF(log, "DynamicLoaderDarwinKernel::BreakpointHit (...)\n");
 
   ReadAllKextSummaries();
 
@@ -1153,9 +1155,9 @@ bool DynamicLoaderDarwinKernel::ParseKex
     const Address &kext_summary_addr, uint32_t count) {
   KextImageInfo::collection kext_summaries;
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
-  if (log)
-    log->Printf("Kexts-changed breakpoint hit, there are %d kexts currently.\n",
-                count);
+  LLDB_LOGF(log,
+            "Kexts-changed breakpoint hit, there are %d kexts currently.\n",
+            count);
 
   std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
@@ -1248,15 +1250,17 @@ bool DynamicLoaderDarwinKernel::ParseKex
 
   if (log) {
     if (load_kexts) {
-      log->Printf("DynamicLoaderDarwinKernel::ParseKextSummaries: %d kexts "
-                  "added, %d kexts removed",
-                  number_of_new_kexts_being_added,
-                  number_of_old_kexts_being_removed);
+      LLDB_LOGF(log,
+                "DynamicLoaderDarwinKernel::ParseKextSummaries: %d kexts "
+                "added, %d kexts removed",
+                number_of_new_kexts_being_added,
+                number_of_old_kexts_being_removed);
     } else {
-      log->Printf(
-          "DynamicLoaderDarwinKernel::ParseKextSummaries kext loading is "
-          "disabled, else would have %d kexts added, %d kexts removed",
-          number_of_new_kexts_being_added, number_of_old_kexts_being_removed);
+      LLDB_LOGF(log,
+                "DynamicLoaderDarwinKernel::ParseKextSummaries kext loading is "
+                "disabled, else would have %d kexts added, %d kexts removed",
+                number_of_new_kexts_being_added,
+                number_of_old_kexts_being_removed);
     }
   }
 
@@ -1430,11 +1434,12 @@ void DynamicLoaderDarwinKernel::PutToLog
     return;
 
   std::lock_guard<std::recursive_mutex> guard(m_mutex);
-  log->Printf("gLoadedKextSummaries = 0x%16.16" PRIx64
-              " { version=%u, entry_size=%u, entry_count=%u }",
-              m_kext_summary_header_addr.GetFileAddress(),
-              m_kext_summary_header.version, m_kext_summary_header.entry_size,
-              m_kext_summary_header.entry_count);
+  LLDB_LOGF(log,
+            "gLoadedKextSummaries = 0x%16.16" PRIx64
+            " { version=%u, entry_size=%u, entry_count=%u }",
+            m_kext_summary_header_addr.GetFileAddress(),
+            m_kext_summary_header.version, m_kext_summary_header.entry_size,
+            m_kext_summary_header.entry_count);
 
   size_t i;
   const size_t count = m_known_kexts.size();
@@ -1509,8 +1514,7 @@ DynamicLoaderDarwinKernel::GetStepThroug
                                                         bool stop_others) {
   ThreadPlanSP thread_plan_sp;
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
-  if (log)
-    log->Printf("Could not find symbol for step through.");
+  LLDB_LOGF(log, "Could not find symbol for step through.");
   return thread_plan_sp;
 }
 

Modified: lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp Wed Jul 24 10:56:10 2019
@@ -277,8 +277,7 @@ bool DynamicLoaderHexagonDYLD::SetRendez
 
   // Do not try to set the breakpoint if we don't know where to put it
   if (break_addr == LLDB_INVALID_ADDRESS) {
-    if (log)
-      log->Printf("Unable to locate _rtld_debug_state breakpoint address");
+    LLDB_LOGF(log, "Unable to locate _rtld_debug_state breakpoint address");
 
     return false;
   }
@@ -301,7 +300,7 @@ bool DynamicLoaderHexagonDYLD::SetRendez
                .GetID() == m_dyld_bid);
 
     if (log && dyld_break == nullptr)
-      log->Printf("Failed to create _rtld_debug_state breakpoint");
+      LLDB_LOGF(log, "Failed to create _rtld_debug_state breakpoint");
 
     // check we have successfully set bp
     return (dyld_break != nullptr);
@@ -316,8 +315,7 @@ bool DynamicLoaderHexagonDYLD::Rendezvou
     user_id_t break_loc_id) {
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
 
-  if (log)
-    log->Printf("Rendezvous breakpoint hit!");
+  LLDB_LOGF(log, "Rendezvous breakpoint hit!");
 
   DynamicLoaderHexagonDYLD *dyld_instance = nullptr;
   dyld_instance = static_cast<DynamicLoaderHexagonDYLD *>(baton);
@@ -333,11 +331,9 @@ bool DynamicLoaderHexagonDYLD::Rendezvou
     if (structAddr != LLDB_INVALID_ADDRESS) {
       dyld_instance->m_rendezvous.SetRendezvousAddress(structAddr);
 
-      if (log)
-        log->Printf("Found _rtld_debug structure @ 0x%08" PRIx64, structAddr);
+      LLDB_LOGF(log, "Found _rtld_debug structure @ 0x%08" PRIx64, structAddr);
     } else {
-      if (log)
-        log->Printf("Unable to resolve the _rtld_debug structure");
+      LLDB_LOGF(log, "Unable to resolve the _rtld_debug structure");
     }
   }
 
@@ -375,11 +371,11 @@ void DynamicLoaderHexagonDYLD::RefreshMo
       }
 
       if (log) {
-        log->Printf("Target is loading '%s'", I->path.c_str());
+        LLDB_LOGF(log, "Target is loading '%s'", I->path.c_str());
         if (!module_sp.get())
-          log->Printf("LLDB failed to load '%s'", I->path.c_str());
+          LLDB_LOGF(log, "LLDB failed to load '%s'", I->path.c_str());
         else
-          log->Printf("LLDB successfully loaded '%s'", I->path.c_str());
+          LLDB_LOGF(log, "LLDB successfully loaded '%s'", I->path.c_str());
       }
     }
     m_process->GetTarget().ModulesDidLoad(new_modules);
@@ -400,8 +396,7 @@ void DynamicLoaderHexagonDYLD::RefreshMo
         UnloadSections(module_sp);
       }
 
-      if (log)
-        log->Printf("Target is unloading '%s'", I->path.c_str());
+      LLDB_LOGF(log, "Target is unloading '%s'", I->path.c_str());
     }
     loaded_modules.Remove(old_modules);
     m_process->GetTarget().ModulesDidUnload(old_modules, false);
@@ -472,10 +467,10 @@ void DynamicLoaderHexagonDYLD::LoadAllCu
 
   if (!m_rendezvous.Resolve()) {
     Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
-    if (log)
-      log->Printf(
-          "DynamicLoaderHexagonDYLD::%s unable to resolve rendezvous address",
-          __FUNCTION__);
+    LLDB_LOGF(
+        log,
+        "DynamicLoaderHexagonDYLD::%s unable to resolve rendezvous address",
+        __FUNCTION__);
     return;
   }
 
@@ -493,10 +488,10 @@ void DynamicLoaderHexagonDYLD::LoadAllCu
       module_list.Append(module_sp);
     } else {
       Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
-      if (log)
-        log->Printf("DynamicLoaderHexagonDYLD::%s failed loading module %s at "
-                    "0x%" PRIx64,
-                    __FUNCTION__, module_path, I->base_addr);
+      LLDB_LOGF(log,
+                "DynamicLoaderHexagonDYLD::%s failed loading module %s at "
+                "0x%" PRIx64,
+                __FUNCTION__, module_path, I->base_addr);
     }
   }
 
@@ -604,12 +599,11 @@ DynamicLoaderHexagonDYLD::GetThreadLocal
 
   Module *mod = module.get();
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
-  if (log)
-    log->Printf("DynamicLoaderHexagonDYLD::Performed TLS lookup: "
-                "module=%s, link_map=0x%" PRIx64 ", tp=0x%" PRIx64
-                ", modid=%i, tls_block=0x%" PRIx64,
-                mod->GetObjectName().AsCString(""), link_map, tp, modid,
-                tls_block);
+  LLDB_LOGF(log,
+            "DynamicLoaderHexagonDYLD::Performed TLS lookup: "
+            "module=%s, link_map=0x%" PRIx64 ", tp=0x%" PRIx64
+            ", modid=%i, tls_block=0x%" PRIx64,
+            mod->GetObjectName().AsCString(""), link_map, tp, modid, tls_block);
 
   if (tls_block == LLDB_INVALID_ADDRESS)
     return LLDB_INVALID_ADDRESS;

Modified: lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp Wed Jul 24 10:56:10 2019
@@ -339,16 +339,16 @@ void HexagonDYLDRendezvous::DumpToLog(Lo
     return;
 
   log->PutCString("HexagonDYLDRendezvous:");
-  log->Printf("   Address: %" PRIx64, GetRendezvousAddress());
-  log->Printf("   Version: %" PRIu64, GetVersion());
-  log->Printf("   Link   : %" PRIx64, GetLinkMapAddress());
-  log->Printf("   Break  : %" PRIx64, GetBreakAddress());
-  log->Printf("   LDBase : %" PRIx64, GetLDBase());
-  log->Printf("   State  : %s",
-              (state == eConsistent)
-                  ? "consistent"
-                  : (state == eAdd) ? "add" : (state == eDelete) ? "delete"
-                                                                 : "unknown");
+  LLDB_LOGF(log, "   Address: %" PRIx64, GetRendezvousAddress());
+  LLDB_LOGF(log, "   Version: %" PRIu64, GetVersion());
+  LLDB_LOGF(log, "   Link   : %" PRIx64, GetLinkMapAddress());
+  LLDB_LOGF(log, "   Break  : %" PRIx64, GetBreakAddress());
+  LLDB_LOGF(log, "   LDBase : %" PRIx64, GetLDBase());
+  LLDB_LOGF(log, "   State  : %s",
+            (state == eConsistent)
+                ? "consistent"
+                : (state == eAdd) ? "add"
+                                  : (state == eDelete) ? "delete" : "unknown");
 
   iterator I = begin();
   iterator E = end();
@@ -357,11 +357,11 @@ void HexagonDYLDRendezvous::DumpToLog(Lo
     log->PutCString("HexagonDYLDRendezvous SOEntries:");
 
   for (int i = 1; I != E; ++I, ++i) {
-    log->Printf("\n   SOEntry [%d] %s", i, I->path.c_str());
-    log->Printf("      Base : %" PRIx64, I->base_addr);
-    log->Printf("      Path : %" PRIx64, I->path_addr);
-    log->Printf("      Dyn  : %" PRIx64, I->dyn_addr);
-    log->Printf("      Next : %" PRIx64, I->next);
-    log->Printf("      Prev : %" PRIx64, I->prev);
+    LLDB_LOGF(log, "\n   SOEntry [%d] %s", i, I->path.c_str());
+    LLDB_LOGF(log, "      Base : %" PRIx64, I->base_addr);
+    LLDB_LOGF(log, "      Path : %" PRIx64, I->path_addr);
+    LLDB_LOGF(log, "      Dyn  : %" PRIx64, I->dyn_addr);
+    LLDB_LOGF(log, "      Next : %" PRIx64, I->next);
+    LLDB_LOGF(log, "      Prev : %" PRIx64, I->prev);
   }
 }

Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp Wed Jul 24 10:56:10 2019
@@ -135,9 +135,8 @@ void DynamicLoaderDarwin::UnloadImages(
 
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
   Target &target = m_process->GetTarget();
-  if (log)
-    log->Printf("Removing %" PRId64 " modules.",
-                (uint64_t)solib_addresses.size());
+  LLDB_LOGF(log, "Removing %" PRId64 " modules.",
+            (uint64_t)solib_addresses.size());
 
   ModuleList unloaded_module_list;
 
@@ -147,8 +146,7 @@ void DynamicLoaderDarwin::UnloadImages(
       if (header.GetOffset() == 0) {
         ModuleSP module_to_remove(header.GetModule());
         if (module_to_remove.get()) {
-          if (log)
-            log->Printf("Removing module at address 0x%" PRIx64, solib_addr);
+          LLDB_LOGF(log, "Removing module at address 0x%" PRIx64, solib_addr);
           // remove the sections from the Target
           UnloadSections(module_to_remove);
           // add this to the list of modules to remove
@@ -537,9 +535,8 @@ void DynamicLoaderDarwin::UpdateSpecialB
     ModuleSP exe_module_sp(FindTargetModuleForImageInfo(image_infos[exe_idx],
                                                         can_create, nullptr));
     if (exe_module_sp) {
-      if (log)
-        log->Printf("Found executable module: %s",
-                    exe_module_sp->GetFileSpec().GetPath().c_str());
+      LLDB_LOGF(log, "Found executable module: %s",
+                exe_module_sp->GetFileSpec().GetPath().c_str());
       target.GetImages().AppendIfNeeded(exe_module_sp);
       UpdateImageLoadAddress(exe_module_sp.get(), image_infos[exe_idx]);
       if (exe_module_sp.get() != target.GetExecutableModulePointer()) {
@@ -553,9 +550,8 @@ void DynamicLoaderDarwin::UpdateSpecialB
     ModuleSP dyld_sp = FindTargetModuleForImageInfo(image_infos[dyld_idx],
                                                     can_create, nullptr);
     if (dyld_sp.get()) {
-      if (log)
-        log->Printf("Found dyld module: %s",
-                    dyld_sp->GetFileSpec().GetPath().c_str());
+      LLDB_LOGF(log, "Found dyld module: %s",
+                dyld_sp->GetFileSpec().GetPath().c_str());
       target.GetImages().AppendIfNeeded(dyld_sp);
       UpdateImageLoadAddress(dyld_sp.get(), image_infos[dyld_idx]);
       SetDYLDModule(dyld_sp);
@@ -598,8 +594,8 @@ bool DynamicLoaderDarwin::AddModulesUsin
 
   for (uint32_t idx = 0; idx < image_infos.size(); ++idx) {
     if (log) {
-      log->Printf("Adding new image at address=0x%16.16" PRIx64 ".",
-                  image_infos[idx].address);
+      LLDB_LOGF(log, "Adding new image at address=0x%16.16" PRIx64 ".",
+                image_infos[idx].address);
       image_infos[idx].PutToLog(log);
     }
 
@@ -704,13 +700,14 @@ void DynamicLoaderDarwin::Segment::PutTo
                                             lldb::addr_t slide) const {
   if (log) {
     if (slide == 0)
-      log->Printf("\t\t%16s [0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ")",
-                  name.AsCString(""), vmaddr + slide, vmaddr + slide + vmsize);
+      LLDB_LOGF(log, "\t\t%16s [0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ")",
+                name.AsCString(""), vmaddr + slide, vmaddr + slide + vmsize);
     else
-      log->Printf("\t\t%16s [0x%16.16" PRIx64 " - 0x%16.16" PRIx64
-                  ") slide = 0x%" PRIx64,
-                  name.AsCString(""), vmaddr + slide, vmaddr + slide + vmsize,
-                  slide);
+      LLDB_LOGF(log,
+                "\t\t%16s [0x%16.16" PRIx64 " - 0x%16.16" PRIx64
+                ") slide = 0x%" PRIx64,
+                name.AsCString(""), vmaddr + slide, vmaddr + slide + vmsize,
+                slide);
   }
 }
 
@@ -820,9 +817,9 @@ DynamicLoaderDarwin::GetStepThroughTramp
                 addr_t load_addr =
                     addr_range.GetBaseAddress().GetLoadAddress(target_sp.get());
 
-                log->Printf("Found a trampoline target symbol at 0x%" PRIx64
-                            ".",
-                            load_addr);
+                LLDB_LOGF(log,
+                          "Found a trampoline target symbol at 0x%" PRIx64 ".",
+                          load_addr);
               }
             }
           }
@@ -847,7 +844,8 @@ DynamicLoaderDarwin::GetStepThroughTramp
                     if (log) {
                       lldb::addr_t load_addr =
                           actual_symbol_addr.GetLoadAddress(target_sp.get());
-                      log->Printf(
+                      LLDB_LOGF(
+                          log,
                           "Found a re-exported symbol: %s at 0x%" PRIx64 ".",
                           actual_symbol->GetName().GetCString(), load_addr);
                     }
@@ -874,8 +872,9 @@ DynamicLoaderDarwin::GetStepThroughTramp
                 addr_t load_addr =
                     addr_range.GetBaseAddress().GetLoadAddress(target_sp.get());
 
-                log->Printf("Found an indirect target symbol at 0x%" PRIx64 ".",
-                            load_addr);
+                LLDB_LOGF(log,
+                          "Found an indirect target symbol at 0x%" PRIx64 ".",
+                          load_addr);
               }
             }
           }
@@ -890,13 +889,13 @@ DynamicLoaderDarwin::GetStepThroughTramp
       if (actual_symbol) {
         Address target_addr(actual_symbol->GetAddress());
         if (target_addr.IsValid()) {
-          if (log)
-            log->Printf(
-                "Found a re-exported symbol: %s pointing to: %s at 0x%" PRIx64
-                ".",
-                current_symbol->GetName().GetCString(),
-                actual_symbol->GetName().GetCString(),
-                target_addr.GetLoadAddress(target_sp.get()));
+          LLDB_LOGF(
+              log,
+              "Found a re-exported symbol: %s pointing to: %s at 0x%" PRIx64
+              ".",
+              current_symbol->GetName().GetCString(),
+              actual_symbol->GetName().GetCString(),
+              target_addr.GetLoadAddress(target_sp.get()));
           addresses.push_back(target_addr.GetLoadAddress(target_sp.get()));
         }
       }
@@ -915,10 +914,10 @@ DynamicLoaderDarwin::GetStepThroughTramp
               &symbol_address, error);
           if (error.Success()) {
             load_addrs.push_back(resolved_addr);
-            if (log)
-              log->Printf("ResolveIndirectFunction found resolved target for "
-                          "%s at 0x%" PRIx64 ".",
-                          symbol->GetName().GetCString(), resolved_addr);
+            LLDB_LOGF(log,
+                      "ResolveIndirectFunction found resolved target for "
+                      "%s at 0x%" PRIx64 ".",
+                      symbol->GetName().GetCString(), resolved_addr);
           }
         } else {
           load_addrs.push_back(address.GetLoadAddress(target_sp.get()));
@@ -928,8 +927,7 @@ DynamicLoaderDarwin::GetStepThroughTramp
           thread, load_addrs, stop_others);
     }
   } else {
-    if (log)
-      log->Printf("Could not find symbol for step through.");
+    LLDB_LOGF(log, "Could not find symbol for step through.");
   }
 
   return thread_plan_sp;
@@ -1109,11 +1107,11 @@ bool DynamicLoaderDarwin::UseDYLDSPI(Pro
 
   if (log) {
     if (use_new_spi_interface)
-      log->Printf(
-          "DynamicLoaderDarwin::UseDYLDSPI: Use new DynamicLoader plugin");
+      LLDB_LOGF(
+          log, "DynamicLoaderDarwin::UseDYLDSPI: Use new DynamicLoader plugin");
     else
-      log->Printf(
-          "DynamicLoaderDarwin::UseDYLDSPI: Use old DynamicLoader plugin");
+      LLDB_LOGF(
+          log, "DynamicLoaderDarwin::UseDYLDSPI: Use old DynamicLoader plugin");
   }
   return use_new_spi_interface;
 }

Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp Wed Jul 24 10:56:10 2019
@@ -173,9 +173,8 @@ void DynamicLoaderMacOS::DoInitialImageF
           ->GetAsArray()) {
     if (JSONImageInformationIntoImageInfo(all_image_info_json_sp,
                                           image_infos)) {
-      if (log)
-        log->Printf("Initial module fetch:  Adding %" PRId64 " modules.\n",
-                    (uint64_t)image_infos.size());
+      LLDB_LOGF(log, "Initial module fetch:  Adding %" PRId64 " modules.\n",
+                (uint64_t)image_infos.size());
 
       UpdateSpecialBinariesFromNewImageInfos(image_infos);
       AddModulesUsingImageInfos(image_infos);
@@ -310,8 +309,8 @@ void DynamicLoaderMacOS::AddBinaries(
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
   ImageInfo::collection image_infos;
 
-  if (log)
-    log->Printf("Adding %" PRId64 " modules.", (uint64_t)load_addresses.size());
+  LLDB_LOGF(log, "Adding %" PRId64 " modules.",
+            (uint64_t)load_addresses.size());
   StructuredData::ObjectSP binaries_info_sp =
       m_process->GetLoadedDynamicLibrariesInfos(load_addresses);
   if (binaries_info_sp.get() && binaries_info_sp->GetAsDictionary() &&

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=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Wed Jul 24 10:56:10 2019
@@ -525,8 +525,7 @@ bool DynamicLoaderMacOSXDYLD::AddModules
     lldb::addr_t image_infos_addr, uint32_t image_infos_count) {
   ImageInfo::collection image_infos;
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
-  if (log)
-    log->Printf("Adding %d modules.\n", image_infos_count);
+  LLDB_LOGF(log, "Adding %d modules.\n", image_infos_count);
 
   std::lock_guard<std::recursive_mutex> guard(m_mutex);
   std::lock_guard<std::recursive_mutex> baseclass_guard(GetMutex());
@@ -581,14 +580,13 @@ bool DynamicLoaderMacOSXDYLD::RemoveModu
     return false;
   }
 
-  if (log)
-    log->Printf("Removing %d modules.", image_infos_count);
+  LLDB_LOGF(log, "Removing %d modules.", image_infos_count);
 
   ModuleList unloaded_module_list;
   for (uint32_t idx = 0; idx < image_infos.size(); ++idx) {
     if (log) {
-      log->Printf("Removing module at address=0x%16.16" PRIx64 ".",
-                  image_infos[idx].address);
+      LLDB_LOGF(log, "Removing module at address=0x%16.16" PRIx64 ".",
+                image_infos[idx].address);
       image_infos[idx].PutToLog(log);
     }
 
@@ -617,7 +615,7 @@ bool DynamicLoaderMacOSXDYLD::RemoveModu
           unloaded_module_list.AppendIfNeeded(unload_image_module_sp);
         } else {
           if (log) {
-            log->Printf("Could not find module for unloading info entry:");
+            LLDB_LOGF(log, "Could not find module for unloading info entry:");
             image_infos[idx].PutToLog(log);
           }
         }
@@ -631,7 +629,7 @@ bool DynamicLoaderMacOSXDYLD::RemoveModu
 
     if (pos == end) {
       if (log) {
-        log->Printf("Could not find image_info entry for unloading image:");
+        LLDB_LOGF(log, "Could not find image_info entry for unloading image:");
         image_infos[idx].PutToLog(log);
       }
     }
@@ -736,7 +734,7 @@ bool DynamicLoaderMacOSXDYLD::Initialize
         if (log) {
           StreamString s;
           module_sp->GetDescription(&s);
-          log->Printf("Unloading pre-run module: %s.", s.GetData());
+          LLDB_LOGF(log, "Unloading pre-run module: %s.", s.GetData());
         }
         not_loaded_modules.Append(module_sp);
       }
@@ -975,12 +973,13 @@ void DynamicLoaderMacOSXDYLD::PutToLog(L
 
   std::lock_guard<std::recursive_mutex> guard(m_mutex);
   std::lock_guard<std::recursive_mutex> baseclass_guard(GetMutex());
-  log->Printf(
-      "dyld_all_image_infos = { version=%d, count=%d, addr=0x%8.8" PRIx64
-      ", notify=0x%8.8" PRIx64 " }",
-      m_dyld_all_image_infos.version, m_dyld_all_image_infos.dylib_info_count,
-      (uint64_t)m_dyld_all_image_infos.dylib_info_addr,
-      (uint64_t)m_dyld_all_image_infos.notification);
+  LLDB_LOGF(log,
+            "dyld_all_image_infos = { version=%d, count=%d, addr=0x%8.8" PRIx64
+            ", notify=0x%8.8" PRIx64 " }",
+            m_dyld_all_image_infos.version,
+            m_dyld_all_image_infos.dylib_info_count,
+            (uint64_t)m_dyld_all_image_infos.dylib_info_addr,
+            (uint64_t)m_dyld_all_image_infos.notification);
   size_t i;
   const size_t count = m_dyld_image_infos.size();
   if (count > 0) {

Modified: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp Wed Jul 24 10:56:10 2019
@@ -33,16 +33,14 @@ static addr_t ResolveRendezvousAddress(P
   Status error;
 
   if (!process) {
-    if (log)
-      log->Printf("%s null process provided", __FUNCTION__);
+    LLDB_LOGF(log, "%s null process provided", __FUNCTION__);
     return LLDB_INVALID_ADDRESS;
   }
 
   // Try to get it from our process.  This might be a remote process and might
   // grab it via some remote-specific mechanism.
   info_location = process->GetImageInfoAddress();
-  if (log)
-    log->Printf("%s info_location = 0x%" PRIx64, __FUNCTION__, info_location);
+  LLDB_LOGF(log, "%s info_location = 0x%" PRIx64, __FUNCTION__, info_location);
 
   // If the process fails to return an address, fall back to seeing if the
   // local object file can help us find it.
@@ -54,42 +52,38 @@ static addr_t ResolveRendezvousAddress(P
 
       if (addr.IsValid()) {
         info_location = addr.GetLoadAddress(target);
-        if (log)
-          log->Printf(
-              "%s resolved via direct object file approach to 0x%" PRIx64,
-              __FUNCTION__, info_location);
+        LLDB_LOGF(log,
+                  "%s resolved via direct object file approach to 0x%" PRIx64,
+                  __FUNCTION__, info_location);
       } else {
-        if (log)
-          log->Printf("%s FAILED - direct object file approach did not yield a "
-                      "valid address",
-                      __FUNCTION__);
+        LLDB_LOGF(log,
+                  "%s FAILED - direct object file approach did not yield a "
+                  "valid address",
+                  __FUNCTION__);
       }
     }
   }
 
   if (info_location == LLDB_INVALID_ADDRESS) {
-    if (log)
-      log->Printf("%s FAILED - invalid info address", __FUNCTION__);
+    LLDB_LOGF(log, "%s FAILED - invalid info address", __FUNCTION__);
     return LLDB_INVALID_ADDRESS;
   }
 
-  if (log)
-    log->Printf("%s reading pointer (%" PRIu32 " bytes) from 0x%" PRIx64,
-                __FUNCTION__, process->GetAddressByteSize(), info_location);
+  LLDB_LOGF(log, "%s reading pointer (%" PRIu32 " bytes) from 0x%" PRIx64,
+            __FUNCTION__, process->GetAddressByteSize(), info_location);
 
   info_addr = process->ReadPointerFromMemory(info_location, error);
   if (error.Fail()) {
-    if (log)
-      log->Printf("%s FAILED - could not read from the info location: %s",
-                  __FUNCTION__, error.AsCString());
+    LLDB_LOGF(log, "%s FAILED - could not read from the info location: %s",
+              __FUNCTION__, error.AsCString());
     return LLDB_INVALID_ADDRESS;
   }
 
   if (info_addr == 0) {
-    if (log)
-      log->Printf("%s FAILED - the rendezvous address contained at 0x%" PRIx64
-                  " returned a null value",
-                  __FUNCTION__, info_location);
+    LLDB_LOGF(log,
+              "%s FAILED - the rendezvous address contained at 0x%" PRIx64
+              " returned a null value",
+              __FUNCTION__, info_location);
     return LLDB_INVALID_ADDRESS;
   }
 
@@ -109,14 +103,13 @@ DYLDRendezvous::DYLDRendezvous(Process *
     Module *exe_mod = m_process->GetTarget().GetExecutableModulePointer();
     if (exe_mod) {
       m_exe_file_spec = exe_mod->GetPlatformFileSpec();
-      if (log)
-        log->Printf("DYLDRendezvous::%s exe module executable path set: '%s'",
-                    __FUNCTION__, m_exe_file_spec.GetCString());
+      LLDB_LOGF(log, "DYLDRendezvous::%s exe module executable path set: '%s'",
+                __FUNCTION__, m_exe_file_spec.GetCString());
     } else {
-      if (log)
-        log->Printf("DYLDRendezvous::%s cannot cache exe module path: null "
-                    "executable module pointer",
-                    __FUNCTION__);
+      LLDB_LOGF(log,
+                "DYLDRendezvous::%s cannot cache exe module path: null "
+                "executable module pointer",
+                __FUNCTION__);
     }
   }
 }
@@ -133,17 +126,16 @@ bool DYLDRendezvous::Resolve() {
 
   address_size = m_process->GetAddressByteSize();
   padding = address_size - word_size;
-  if (log)
-    log->Printf("DYLDRendezvous::%s address size: %" PRIu64
-                ", padding %" PRIu64,
-                __FUNCTION__, uint64_t(address_size), uint64_t(padding));
+  LLDB_LOGF(log,
+            "DYLDRendezvous::%s address size: %" PRIu64 ", padding %" PRIu64,
+            __FUNCTION__, uint64_t(address_size), uint64_t(padding));
 
   if (m_rendezvous_addr == LLDB_INVALID_ADDRESS)
     cursor = info_addr = ResolveRendezvousAddress(m_process);
   else
     cursor = info_addr = m_rendezvous_addr;
-  if (log)
-    log->Printf("DYLDRendezvous::%s cursor = 0x%" PRIx64, __FUNCTION__, cursor);
+  LLDB_LOGF(log, "DYLDRendezvous::%s cursor = 0x%" PRIx64, __FUNCTION__,
+            cursor);
 
   if (cursor == LLDB_INVALID_ADDRESS)
     return false;
@@ -569,16 +561,16 @@ void DYLDRendezvous::DumpToLog(Log *log)
     return;
 
   log->PutCString("DYLDRendezvous:");
-  log->Printf("   Address: %" PRIx64, GetRendezvousAddress());
-  log->Printf("   Version: %" PRIu64, GetVersion());
-  log->Printf("   Link   : %" PRIx64, GetLinkMapAddress());
-  log->Printf("   Break  : %" PRIx64, GetBreakAddress());
-  log->Printf("   LDBase : %" PRIx64, GetLDBase());
-  log->Printf("   State  : %s",
-              (state == eConsistent)
-                  ? "consistent"
-                  : (state == eAdd) ? "add" : (state == eDelete) ? "delete"
-                                                                 : "unknown");
+  LLDB_LOGF(log, "   Address: %" PRIx64, GetRendezvousAddress());
+  LLDB_LOGF(log, "   Version: %" PRIu64, GetVersion());
+  LLDB_LOGF(log, "   Link   : %" PRIx64, GetLinkMapAddress());
+  LLDB_LOGF(log, "   Break  : %" PRIx64, GetBreakAddress());
+  LLDB_LOGF(log, "   LDBase : %" PRIx64, GetLDBase());
+  LLDB_LOGF(log, "   State  : %s",
+            (state == eConsistent)
+                ? "consistent"
+                : (state == eAdd) ? "add"
+                                  : (state == eDelete) ? "delete" : "unknown");
 
   iterator I = begin();
   iterator E = end();
@@ -587,11 +579,11 @@ void DYLDRendezvous::DumpToLog(Log *log)
     log->PutCString("DYLDRendezvous SOEntries:");
 
   for (int i = 1; I != E; ++I, ++i) {
-    log->Printf("\n   SOEntry [%d] %s", i, I->file_spec.GetCString());
-    log->Printf("      Base : %" PRIx64, I->base_addr);
-    log->Printf("      Path : %" PRIx64, I->path_addr);
-    log->Printf("      Dyn  : %" PRIx64, I->dyn_addr);
-    log->Printf("      Next : %" PRIx64, I->next);
-    log->Printf("      Prev : %" PRIx64, I->prev);
+    LLDB_LOGF(log, "\n   SOEntry [%d] %s", i, I->file_spec.GetCString());
+    LLDB_LOGF(log, "      Base : %" PRIx64, I->base_addr);
+    LLDB_LOGF(log, "      Path : %" PRIx64, I->path_addr);
+    LLDB_LOGF(log, "      Dyn  : %" PRIx64, I->dyn_addr);
+    LLDB_LOGF(log, "      Next : %" PRIx64, I->next);
+    LLDB_LOGF(log, "      Prev : %" PRIx64, I->prev);
   }
 }

Modified: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp Wed Jul 24 10:56:10 2019
@@ -85,15 +85,13 @@ DynamicLoaderPOSIXDYLD::~DynamicLoaderPO
 
 void DynamicLoaderPOSIXDYLD::DidAttach() {
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
-  if (log)
-    log->Printf("DynamicLoaderPOSIXDYLD::%s() pid %" PRIu64, __FUNCTION__,
-                m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
+  LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s() pid %" PRIu64, __FUNCTION__,
+            m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
   m_auxv = llvm::make_unique<AuxVector>(m_process->GetAuxvData());
 
-  if (log)
-    log->Printf("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64 " reloaded auxv data",
-                __FUNCTION__,
-                m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
+  LLDB_LOGF(
+      log, "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64 " reloaded auxv data",
+      __FUNCTION__, m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
 
   // ask the process if it can load any of its own modules
   m_process->LoadModules();
@@ -103,14 +101,14 @@ void DynamicLoaderPOSIXDYLD::DidAttach()
 
   // find the main process load offset
   addr_t load_offset = ComputeLoadOffset();
-  if (log)
-    log->Printf("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
-                " executable '%s', load_offset 0x%" PRIx64,
-                __FUNCTION__,
-                m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID,
-                executable_sp ? executable_sp->GetFileSpec().GetPath().c_str()
-                              : "<null executable>",
-                load_offset);
+  LLDB_LOGF(log,
+            "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
+            " executable '%s', load_offset 0x%" PRIx64,
+            __FUNCTION__,
+            m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID,
+            executable_sp ? executable_sp->GetFileSpec().GetPath().c_str()
+                          : "<null executable>",
+            load_offset);
 
   EvalSpecialModulesStatus();
 
@@ -137,12 +135,12 @@ void DynamicLoaderPOSIXDYLD::DidAttach()
     ModuleList module_list;
 
     module_list.Append(executable_sp);
-    if (log)
-      log->Printf("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
-                  " added executable '%s' to module load list",
-                  __FUNCTION__,
-                  m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID,
-                  executable_sp->GetFileSpec().GetPath().c_str());
+    LLDB_LOGF(log,
+              "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
+              " added executable '%s' to module load list",
+              __FUNCTION__,
+              m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID,
+              executable_sp->GetFileSpec().GetPath().c_str());
 
     UpdateLoadedSections(executable_sp, LLDB_INVALID_ADDRESS, load_offset,
                          true);
@@ -151,14 +149,15 @@ void DynamicLoaderPOSIXDYLD::DidAttach()
 
     m_process->GetTarget().ModulesDidLoad(module_list);
     if (log) {
-      log->Printf("DynamicLoaderPOSIXDYLD::%s told the target about the "
-                  "modules that loaded:",
-                  __FUNCTION__);
+      LLDB_LOGF(log,
+                "DynamicLoaderPOSIXDYLD::%s told the target about the "
+                "modules that loaded:",
+                __FUNCTION__);
       for (auto module_sp : module_list.Modules()) {
-        log->Printf("-- [module] %s (pid %" PRIu64 ")",
-                    module_sp ? module_sp->GetFileSpec().GetPath().c_str()
-                              : "<null>",
-                    m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
+        LLDB_LOGF(log, "-- [module] %s (pid %" PRIu64 ")",
+                  module_sp ? module_sp->GetFileSpec().GetPath().c_str()
+                            : "<null>",
+                  m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
       }
     }
   }
@@ -174,8 +173,7 @@ void DynamicLoaderPOSIXDYLD::DidAttach()
 
 void DynamicLoaderPOSIXDYLD::DidLaunch() {
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
-  if (log)
-    log->Printf("DynamicLoaderPOSIXDYLD::%s()", __FUNCTION__);
+  LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s()", __FUNCTION__);
 
   ModuleSP executable;
   addr_t load_offset;
@@ -191,9 +189,8 @@ void DynamicLoaderPOSIXDYLD::DidLaunch()
     module_list.Append(executable);
     UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, load_offset, true);
 
-    if (log)
-      log->Printf("DynamicLoaderPOSIXDYLD::%s about to call ProbeEntry()",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s about to call ProbeEntry()",
+              __FUNCTION__);
 
     if (!SetRendezvousBreakpoint()) {
       // If we cannot establish rendezvous breakpoint right now we'll try again
@@ -227,22 +224,20 @@ void DynamicLoaderPOSIXDYLD::ProbeEntry(
 
   const addr_t entry = GetEntryPoint();
   if (entry == LLDB_INVALID_ADDRESS) {
-    if (log)
-      log->Printf(
-          "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
-          " GetEntryPoint() returned no address, not setting entry breakpoint",
-          __FUNCTION__,
-          m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
+    LLDB_LOGF(
+        log,
+        "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
+        " GetEntryPoint() returned no address, not setting entry breakpoint",
+        __FUNCTION__, m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
     return;
   }
 
-  if (log)
-    log->Printf("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
-                " GetEntryPoint() returned address 0x%" PRIx64
-                ", setting entry breakpoint",
-                __FUNCTION__,
-                m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID,
-                entry);
+  LLDB_LOGF(log,
+            "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
+            " GetEntryPoint() returned address 0x%" PRIx64
+            ", setting entry breakpoint",
+            __FUNCTION__,
+            m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID, entry);
 
   if (m_process) {
     Breakpoint *const entry_break =
@@ -271,11 +266,10 @@ bool DynamicLoaderPOSIXDYLD::EntryBreakp
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
   DynamicLoaderPOSIXDYLD *const dyld_instance =
       static_cast<DynamicLoaderPOSIXDYLD *>(baton);
-  if (log)
-    log->Printf("DynamicLoaderPOSIXDYLD::%s called for pid %" PRIu64,
-                __FUNCTION__,
-                dyld_instance->m_process ? dyld_instance->m_process->GetID()
-                                         : LLDB_INVALID_PROCESS_ID);
+  LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s called for pid %" PRIu64,
+            __FUNCTION__,
+            dyld_instance->m_process ? dyld_instance->m_process->GetID()
+                                     : LLDB_INVALID_PROCESS_ID);
 
   // Disable the breakpoint --- if a stop happens right after this, which we've
   // seen on occasion, we don't want the breakpoint stepping thread-plan logic
@@ -287,22 +281,22 @@ bool DynamicLoaderPOSIXDYLD::EntryBreakp
     BreakpointSP breakpoint_sp =
         dyld_instance->m_process->GetTarget().GetBreakpointByID(break_id);
     if (breakpoint_sp) {
-      if (log)
-        log->Printf("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
-                    " disabling breakpoint id %" PRIu64,
-                    __FUNCTION__, dyld_instance->m_process->GetID(), break_id);
+      LLDB_LOGF(log,
+                "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
+                " disabling breakpoint id %" PRIu64,
+                __FUNCTION__, dyld_instance->m_process->GetID(), break_id);
       breakpoint_sp->SetEnabled(false);
     } else {
-      if (log)
-        log->Printf("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
-                    " failed to find breakpoint for breakpoint id %" PRIu64,
-                    __FUNCTION__, dyld_instance->m_process->GetID(), break_id);
+      LLDB_LOGF(log,
+                "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
+                " failed to find breakpoint for breakpoint id %" PRIu64,
+                __FUNCTION__, dyld_instance->m_process->GetID(), break_id);
     }
   } else {
-    if (log)
-      log->Printf("DynamicLoaderPOSIXDYLD::%s breakpoint id %" PRIu64
-                  " no Process instance!  Cannot disable breakpoint",
-                  __FUNCTION__, break_id);
+    LLDB_LOGF(log,
+              "DynamicLoaderPOSIXDYLD::%s breakpoint id %" PRIu64
+              " no Process instance!  Cannot disable breakpoint",
+              __FUNCTION__, break_id);
   }
 
   dyld_instance->LoadAllCurrentModules();
@@ -393,23 +387,22 @@ bool DynamicLoaderPOSIXDYLD::RendezvousB
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
   DynamicLoaderPOSIXDYLD *const dyld_instance =
       static_cast<DynamicLoaderPOSIXDYLD *>(baton);
-  if (log)
-    log->Printf("DynamicLoaderPOSIXDYLD::%s called for pid %" PRIu64,
-                __FUNCTION__,
-                dyld_instance->m_process ? dyld_instance->m_process->GetID()
-                                         : LLDB_INVALID_PROCESS_ID);
+  LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s called for pid %" PRIu64,
+            __FUNCTION__,
+            dyld_instance->m_process ? dyld_instance->m_process->GetID()
+                                     : LLDB_INVALID_PROCESS_ID);
 
   dyld_instance->RefreshModules();
 
   // Return true to stop the target, false to just let the target run.
   const bool stop_when_images_change = dyld_instance->GetStopWhenImagesChange();
-  if (log)
-    log->Printf("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
-                " stop_when_images_change=%s",
-                __FUNCTION__,
-                dyld_instance->m_process ? dyld_instance->m_process->GetID()
-                                         : LLDB_INVALID_PROCESS_ID,
-                stop_when_images_change ? "true" : "false");
+  LLDB_LOGF(log,
+            "DynamicLoaderPOSIXDYLD::%s pid %" PRIu64
+            " stop_when_images_change=%s",
+            __FUNCTION__,
+            dyld_instance->m_process ? dyld_instance->m_process->GetID()
+                                     : LLDB_INVALID_PROCESS_ID,
+            stop_when_images_change ? "true" : "false");
   return stop_when_images_change;
 }
 
@@ -562,10 +555,10 @@ void DynamicLoaderPOSIXDYLD::LoadAllCurr
   LoadVDSO();
 
   if (!m_rendezvous.Resolve()) {
-    if (log)
-      log->Printf("DynamicLoaderPOSIXDYLD::%s unable to resolve POSIX DYLD "
-                  "rendezvous address",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "DynamicLoaderPOSIXDYLD::%s unable to resolve POSIX DYLD "
+              "rendezvous address",
+              __FUNCTION__);
     return;
   }
 
@@ -589,10 +582,10 @@ void DynamicLoaderPOSIXDYLD::LoadAllCurr
       module_list.Append(module_sp);
     } else {
       Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
-      if (log)
-        log->Printf(
-            "DynamicLoaderPOSIXDYLD::%s failed loading module %s at 0x%" PRIx64,
-            __FUNCTION__, I->file_spec.GetCString(), I->base_addr);
+      LLDB_LOGF(
+          log,
+          "DynamicLoaderPOSIXDYLD::%s failed loading module %s at 0x%" PRIx64,
+          __FUNCTION__, I->file_spec.GetCString(), I->base_addr);
     }
   }
 
@@ -697,12 +690,12 @@ DynamicLoaderPOSIXDYLD::GetThreadLocalDa
   addr_t tls_block = ReadPointer(dtv_slot + metadata.tls_offset);
 
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
-  if (log)
-    log->Printf("DynamicLoaderPOSIXDYLD::Performed TLS lookup: "
-                "module=%s, link_map=0x%" PRIx64 ", tp=0x%" PRIx64
-                ", modid=%" PRId64 ", tls_block=0x%" PRIx64 "\n",
-                module_sp->GetObjectName().AsCString(""), link_map, tp,
-                (int64_t)modid, tls_block);
+  LLDB_LOGF(log,
+            "DynamicLoaderPOSIXDYLD::Performed TLS lookup: "
+            "module=%s, link_map=0x%" PRIx64 ", tp=0x%" PRIx64
+            ", modid=%" PRId64 ", tls_block=0x%" PRIx64 "\n",
+            module_sp->GetObjectName().AsCString(""), link_map, tp,
+            (int64_t)modid, tls_block);
 
   if (tls_block == LLDB_INVALID_ADDRESS)
     return LLDB_INVALID_ADDRESS;
@@ -722,18 +715,17 @@ void DynamicLoaderPOSIXDYLD::ResolveExec
 
   ProcessInstanceInfo process_info;
   if (!m_process->GetProcessInfo(process_info)) {
-    if (log)
-      log->Printf("DynamicLoaderPOSIXDYLD::%s - failed to get process info for "
-                  "pid %" PRIu64,
-                  __FUNCTION__, m_process->GetID());
+    LLDB_LOGF(log,
+              "DynamicLoaderPOSIXDYLD::%s - failed to get process info for "
+              "pid %" PRIu64,
+              __FUNCTION__, m_process->GetID());
     return;
   }
 
-  if (log)
-    log->Printf("DynamicLoaderPOSIXDYLD::%s - got executable by pid %" PRIu64
-                ": %s",
-                __FUNCTION__, m_process->GetID(),
-                process_info.GetExecutableFile().GetPath().c_str());
+  LLDB_LOGF(
+      log, "DynamicLoaderPOSIXDYLD::%s - got executable by pid %" PRIu64 ": %s",
+      __FUNCTION__, m_process->GetID(),
+      process_info.GetExecutableFile().GetPath().c_str());
 
   ModuleSpec module_spec(process_info.GetExecutableFile(),
                          process_info.GetArchitecture());
@@ -748,10 +740,10 @@ void DynamicLoaderPOSIXDYLD::ResolveExec
     StreamString stream;
     module_spec.Dump(stream);
 
-    if (log)
-      log->Printf("DynamicLoaderPOSIXDYLD::%s - failed to resolve executable "
-                  "with module spec \"%s\": %s",
-                  __FUNCTION__, stream.GetData(), error.AsCString());
+    LLDB_LOGF(log,
+              "DynamicLoaderPOSIXDYLD::%s - failed to resolve executable "
+              "with module spec \"%s\": %s",
+              __FUNCTION__, stream.GetData(), error.AsCString());
     return;
   }
 

Modified: lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp Wed Jul 24 10:56:10 2019
@@ -122,38 +122,36 @@ lldb::addr_t DynamicLoaderWindowsDYLD::G
 
 void DynamicLoaderWindowsDYLD::DidAttach() {
     Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
-  if (log)
-    log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+    LLDB_LOGF(log, "DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
 
-  ModuleSP executable = GetTargetExecutable();
+    ModuleSP executable = GetTargetExecutable();
 
-  if (!executable.get())
-    return;
+    if (!executable.get())
+      return;
 
-  // Try to fetch the load address of the file from the process, since there
-  // could be randomization of the load address.
-  lldb::addr_t load_addr = GetLoadAddress(executable);
-  if (load_addr == LLDB_INVALID_ADDRESS)
-    return;
-
-  // Request the process base address.
-  lldb::addr_t image_base = m_process->GetImageInfoAddress();
-  if (image_base == load_addr)
-    return;
-
-  // Rebase the process's modules if there is a mismatch.
-  UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, load_addr, false);
-
-  ModuleList module_list;
-  module_list.Append(executable);
-  m_process->GetTarget().ModulesDidLoad(module_list);
-  m_process->LoadModules();
+    // Try to fetch the load address of the file from the process, since there
+    // could be randomization of the load address.
+    lldb::addr_t load_addr = GetLoadAddress(executable);
+    if (load_addr == LLDB_INVALID_ADDRESS)
+      return;
+
+    // Request the process base address.
+    lldb::addr_t image_base = m_process->GetImageInfoAddress();
+    if (image_base == load_addr)
+      return;
+
+    // Rebase the process's modules if there is a mismatch.
+    UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, load_addr, false);
+
+    ModuleList module_list;
+    module_list.Append(executable);
+    m_process->GetTarget().ModulesDidLoad(module_list);
+    m_process->LoadModules();
 }
 
 void DynamicLoaderWindowsDYLD::DidLaunch() {
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
-  if (log)
-    log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+  LLDB_LOGF(log, "DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
 
   ModuleSP executable = GetTargetExecutable();
   if (!executable.get())

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp Wed Jul 24 10:56:10 2019
@@ -92,7 +92,7 @@ void ASTDumper::ToLog(Log *log, const ch
   while (end) {
     *end = '\0';
 
-    log->Printf("%s%s", prefix, str);
+    LLDB_LOGF(log, "%s%s", prefix, str);
 
     *end = '\n';
 
@@ -100,7 +100,7 @@ void ASTDumper::ToLog(Log *log, const ch
     end = strchr(str, '\n');
   }
 
-  log->Printf("%s%s", prefix, str);
+  LLDB_LOGF(log, "%s%s", prefix, str);
 
   free(alloc);
 }

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp Wed Jul 24 10:56:10 2019
@@ -58,13 +58,13 @@ void ASTResultSynthesizer::TransformTopL
   if (NamedDecl *named_decl = dyn_cast<NamedDecl>(D)) {
     if (log && log->GetVerbose()) {
       if (named_decl->getIdentifier())
-        log->Printf("TransformTopLevelDecl(%s)",
-                    named_decl->getIdentifier()->getNameStart());
+        LLDB_LOGF(log, "TransformTopLevelDecl(%s)",
+                  named_decl->getIdentifier()->getNameStart());
       else if (ObjCMethodDecl *method_decl = dyn_cast<ObjCMethodDecl>(D))
-        log->Printf("TransformTopLevelDecl(%s)",
-                    method_decl->getSelector().getAsString().c_str());
+        LLDB_LOGF(log, "TransformTopLevelDecl(%s)",
+                  method_decl->getSelector().getAsString().c_str());
       else
-        log->Printf("TransformTopLevelDecl(<complex>)");
+        LLDB_LOGF(log, "TransformTopLevelDecl(<complex>)");
     }
 
     if (m_top_level) {
@@ -130,7 +130,7 @@ bool ASTResultSynthesizer::SynthesizeFun
 
     os.flush();
 
-    log->Printf("Untransformed function AST:\n%s", s.c_str());
+    LLDB_LOGF(log, "Untransformed function AST:\n%s", s.c_str());
   }
 
   Stmt *function_body = function_decl->getBody();
@@ -146,7 +146,7 @@ bool ASTResultSynthesizer::SynthesizeFun
 
     os.flush();
 
-    log->Printf("Transformed function AST:\n%s", s.c_str());
+    LLDB_LOGF(log, "Transformed function AST:\n%s", s.c_str());
   }
 
   return ret;
@@ -170,7 +170,7 @@ bool ASTResultSynthesizer::SynthesizeObj
 
     os.flush();
 
-    log->Printf("Untransformed method AST:\n%s", s.c_str());
+    LLDB_LOGF(log, "Untransformed method AST:\n%s", s.c_str());
   }
 
   Stmt *method_body = MethodDecl->getBody();
@@ -190,7 +190,7 @@ bool ASTResultSynthesizer::SynthesizeObj
 
     os.flush();
 
-    log->Printf("Transformed method AST:\n%s", s.c_str());
+    LLDB_LOGF(log, "Transformed method AST:\n%s", s.c_str());
   }
 
   return ret;
@@ -308,8 +308,8 @@ bool ASTResultSynthesizer::SynthesizeBod
   if (log) {
     std::string s = expr_qual_type.getAsString();
 
-    log->Printf("Last statement is an %s with type: %s",
-                (is_lvalue ? "lvalue" : "rvalue"), s.c_str());
+    LLDB_LOGF(log, "Last statement is an %s with type: %s",
+              (is_lvalue ? "lvalue" : "rvalue"), s.c_str());
   }
 
   clang::VarDecl *result_decl = nullptr;
@@ -422,8 +422,7 @@ void ASTResultSynthesizer::MaybeRecordPe
 
   ConstString name_cs(name.str().c_str());
 
-  if (log)
-    log->Printf("Recording persistent type %s\n", name_cs.GetCString());
+  LLDB_LOGF(log, "Recording persistent type %s\n", name_cs.GetCString());
 
   m_decls.push_back(D);
 }
@@ -443,8 +442,7 @@ void ASTResultSynthesizer::RecordPersist
 
   ConstString name_cs(name.str().c_str());
 
-  if (log)
-    log->Printf("Recording persistent decl %s\n", name_cs.GetCString());
+  LLDB_LOGF(log, "Recording persistent decl %s\n", name_cs.GetCString());
 
   m_decls.push_back(D);
 }
@@ -467,7 +465,7 @@ void ASTResultSynthesizer::CommitPersist
         decl->dump(ss);
         ss.flush();
 
-        log->Printf("Couldn't commit persistent  decl: %s\n", s.c_str());
+        LLDB_LOGF(log, "Couldn't commit persistent  decl: %s\n", s.c_str());
       }
 
       continue;

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp Wed Jul 24 10:56:10 2019
@@ -273,13 +273,13 @@ void ClangASTSource::CompleteType(TagDec
   unsigned int current_id = invocation_id++;
 
   if (log) {
-    log->Printf("    CompleteTagDecl[%u] on (ASTContext*)%p Completing "
-                "(TagDecl*)%p named %s",
-                current_id, static_cast<void *>(m_ast_context),
-                static_cast<void *>(tag_decl),
-                tag_decl->getName().str().c_str());
+    LLDB_LOGF(log,
+              "    CompleteTagDecl[%u] on (ASTContext*)%p Completing "
+              "(TagDecl*)%p named %s",
+              current_id, static_cast<void *>(m_ast_context),
+              static_cast<void *>(tag_decl), tag_decl->getName().str().c_str());
 
-    log->Printf("      CTD[%u] Before:", current_id);
+    LLDB_LOGF(log, "      CTD[%u] Before:", current_id);
     ASTDumper dumper((Decl *)tag_decl);
     dumper.ToLog(log, "      [CTD] ");
   }
@@ -301,10 +301,10 @@ void ClangASTSource::CompleteType(TagDec
     // We couldn't complete the type.  Maybe there's a definition somewhere
     // else that can be completed.
 
-    if (log)
-      log->Printf("      CTD[%u] Type could not be completed in the module in "
-                  "which it was first found.",
-                  current_id);
+    LLDB_LOGF(log,
+              "      CTD[%u] Type could not be completed in the module in "
+              "which it was first found.",
+              current_id);
 
     bool found = false;
 
@@ -316,9 +316,9 @@ void ClangASTSource::CompleteType(TagDec
           m_ast_importer_sp->GetNamespaceMap(namespace_context);
 
       if (log && log->GetVerbose())
-        log->Printf("      CTD[%u] Inspecting namespace map %p (%d entries)",
-                    current_id, static_cast<void *>(namespace_map.get()),
-                    static_cast<int>(namespace_map->size()));
+        LLDB_LOGF(log, "      CTD[%u] Inspecting namespace map %p (%d entries)",
+                  current_id, static_cast<void *>(namespace_map.get()),
+                  static_cast<int>(namespace_map->size()));
 
       if (!namespace_map)
         return;
@@ -326,10 +326,9 @@ void ClangASTSource::CompleteType(TagDec
       for (ClangASTImporter::NamespaceMap::iterator i = namespace_map->begin(),
                                                     e = namespace_map->end();
            i != e && !found; ++i) {
-        if (log)
-          log->Printf("      CTD[%u] Searching namespace %s in module %s",
-                      current_id, i->second.GetName().AsCString(),
-                      i->first->GetFileSpec().GetFilename().GetCString());
+        LLDB_LOGF(log, "      CTD[%u] Searching namespace %s in module %s",
+                  current_id, i->second.GetName().AsCString(),
+                  i->first->GetFileSpec().GetFilename().GetCString());
 
         TypeList types;
 
@@ -409,7 +408,7 @@ void ClangASTSource::CompleteType(TagDec
   }
 
   if (log) {
-    log->Printf("      [CTD] After:");
+    LLDB_LOGF(log, "      [CTD] After:");
     ASTDumper dumper((Decl *)tag_decl);
     dumper.ToLog(log, "      [CTD] ");
   }
@@ -419,11 +418,12 @@ void ClangASTSource::CompleteType(clang:
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
   if (log) {
-    log->Printf("    [CompleteObjCInterfaceDecl] on (ASTContext*)%p Completing "
-                "an ObjCInterfaceDecl named %s",
-                static_cast<void *>(m_ast_context),
-                interface_decl->getName().str().c_str());
-    log->Printf("      [COID] Before:");
+    LLDB_LOGF(log,
+              "    [CompleteObjCInterfaceDecl] on (ASTContext*)%p Completing "
+              "an ObjCInterfaceDecl named %s",
+              static_cast<void *>(m_ast_context),
+              interface_decl->getName().str().c_str());
+    LLDB_LOGF(log, "      [COID] Before:");
     ASTDumper dumper((Decl *)interface_decl);
     dumper.ToLog(log, "      [COID] ");
   }
@@ -467,7 +467,7 @@ void ClangASTSource::CompleteType(clang:
     CompleteType(interface_decl->getSuperClass());
 
   if (log) {
-    log->Printf("      [COID] After:");
+    LLDB_LOGF(log, "      [COID] After:");
     ASTDumper dumper((Decl *)interface_decl);
     dumper.ToLog(log, "      [COID] ");
   }
@@ -554,20 +554,22 @@ void ClangASTSource::FindExternalLexical
 
   if (log) {
     if (const NamedDecl *context_named_decl = dyn_cast<NamedDecl>(context_decl))
-      log->Printf(
+      LLDB_LOGF(
+          log,
           "FindExternalLexicalDecls[%u] on (ASTContext*)%p in '%s' (%sDecl*)%p",
           current_id, static_cast<void *>(m_ast_context),
           context_named_decl->getNameAsString().c_str(),
           context_decl->getDeclKindName(),
           static_cast<const void *>(context_decl));
     else if (context_decl)
-      log->Printf(
-          "FindExternalLexicalDecls[%u] on (ASTContext*)%p in (%sDecl*)%p",
+      LLDB_LOGF(
+          log, "FindExternalLexicalDecls[%u] on (ASTContext*)%p in (%sDecl*)%p",
           current_id, static_cast<void *>(m_ast_context),
           context_decl->getDeclKindName(),
           static_cast<const void *>(context_decl));
     else
-      log->Printf(
+      LLDB_LOGF(
+          log,
           "FindExternalLexicalDecls[%u] on (ASTContext*)%p in a NULL context",
           current_id, static_cast<const void *>(m_ast_context));
   }
@@ -580,9 +582,9 @@ void ClangASTSource::FindExternalLexical
     return;
 
   if (log) {
-    log->Printf("  FELD[%u] Original decl (ASTContext*)%p (Decl*)%p:",
-                current_id, static_cast<void *>(original_ctx),
-                static_cast<void *>(original_decl));
+    LLDB_LOGF(
+        log, "  FELD[%u] Original decl (ASTContext*)%p (Decl*)%p:", current_id,
+        static_cast<void *>(original_ctx), static_cast<void *>(original_decl));
     ASTDumper(original_decl).ToLog(log, "    ");
   }
 
@@ -626,13 +628,13 @@ void ClangASTSource::FindExternalLexical
         ASTDumper ast_dumper(decl);
         if (const NamedDecl *context_named_decl =
                 dyn_cast<NamedDecl>(context_decl))
-          log->Printf("  FELD[%d] Adding [to %sDecl %s] lexical %sDecl %s",
-                      current_id, context_named_decl->getDeclKindName(),
-                      context_named_decl->getNameAsString().c_str(),
-                      decl->getDeclKindName(), ast_dumper.GetCString());
+          LLDB_LOGF(log, "  FELD[%d] Adding [to %sDecl %s] lexical %sDecl %s",
+                    current_id, context_named_decl->getDeclKindName(),
+                    context_named_decl->getNameAsString().c_str(),
+                    decl->getDeclKindName(), ast_dumper.GetCString());
         else
-          log->Printf("  FELD[%d] Adding lexical %sDecl %s", current_id,
-                      decl->getDeclKindName(), ast_dumper.GetCString());
+          LLDB_LOGF(log, "  FELD[%d] Adding lexical %sDecl %s", current_id,
+                    decl->getDeclKindName(), ast_dumper.GetCString());
       }
 
       Decl *copied_decl = CopyDecl(decl);
@@ -678,22 +680,25 @@ void ClangASTSource::FindExternalVisible
 
   if (log) {
     if (!context.m_decl_context)
-      log->Printf("ClangASTSource::FindExternalVisibleDecls[%u] on "
-                  "(ASTContext*)%p for '%s' in a NULL DeclContext",
-                  current_id, static_cast<void *>(m_ast_context),
-                  name.GetCString());
+      LLDB_LOGF(log,
+                "ClangASTSource::FindExternalVisibleDecls[%u] on "
+                "(ASTContext*)%p for '%s' in a NULL DeclContext",
+                current_id, static_cast<void *>(m_ast_context),
+                name.GetCString());
     else if (const NamedDecl *context_named_decl =
                  dyn_cast<NamedDecl>(context.m_decl_context))
-      log->Printf("ClangASTSource::FindExternalVisibleDecls[%u] on "
-                  "(ASTContext*)%p for '%s' in '%s'",
-                  current_id, static_cast<void *>(m_ast_context),
-                  name.GetCString(),
-                  context_named_decl->getNameAsString().c_str());
+      LLDB_LOGF(log,
+                "ClangASTSource::FindExternalVisibleDecls[%u] on "
+                "(ASTContext*)%p for '%s' in '%s'",
+                current_id, static_cast<void *>(m_ast_context),
+                name.GetCString(),
+                context_named_decl->getNameAsString().c_str());
     else
-      log->Printf("ClangASTSource::FindExternalVisibleDecls[%u] on "
-                  "(ASTContext*)%p for '%s' in a '%s'",
-                  current_id, static_cast<void *>(m_ast_context),
-                  name.GetCString(), context.m_decl_context->getDeclKindName());
+      LLDB_LOGF(log,
+                "ClangASTSource::FindExternalVisibleDecls[%u] on "
+                "(ASTContext*)%p for '%s' in a '%s'",
+                current_id, static_cast<void *>(m_ast_context),
+                name.GetCString(), context.m_decl_context->getDeclKindName());
   }
 
   if (HasMerger() && !isa<TranslationUnitDecl>(context.m_decl_context)
@@ -723,9 +728,9 @@ void ClangASTSource::FindExternalVisible
         m_ast_importer_sp->GetNamespaceMap(namespace_context) : nullptr;
 
     if (log && log->GetVerbose())
-      log->Printf("  CAS::FEVD[%u] Inspecting namespace map %p (%d entries)",
-                  current_id, static_cast<void *>(namespace_map.get()),
-                  static_cast<int>(namespace_map->size()));
+      LLDB_LOGF(log, "  CAS::FEVD[%u] Inspecting namespace map %p (%d entries)",
+                current_id, static_cast<void *>(namespace_map.get()),
+                static_cast<int>(namespace_map->size()));
 
     if (!namespace_map)
       return;
@@ -733,10 +738,9 @@ void ClangASTSource::FindExternalVisible
     for (ClangASTImporter::NamespaceMap::iterator i = namespace_map->begin(),
                                                   e = namespace_map->end();
          i != e; ++i) {
-      if (log)
-        log->Printf("  CAS::FEVD[%u] Searching namespace %s in module %s",
-                    current_id, i->second.GetName().AsCString(),
-                    i->first->GetFileSpec().GetFilename().GetCString());
+      LLDB_LOGF(log, "  CAS::FEVD[%u] Searching namespace %s in module %s",
+                current_id, i->second.GetName().AsCString(),
+                i->first->GetFileSpec().GetFilename().GetCString());
 
       FindExternalVisibleDecls(context, i->first, i->second, current_id);
     }
@@ -748,8 +752,7 @@ void ClangASTSource::FindExternalVisible
   } else {
     CompilerDeclContext namespace_decl;
 
-    if (log)
-      log->Printf("  CAS::FEVD[%u] Searching the root namespace", current_id);
+    LLDB_LOGF(log, "  CAS::FEVD[%u] Searching the root namespace", current_id);
 
     FindExternalVisibleDecls(context, lldb::ModuleSP(), namespace_decl,
                              current_id);
@@ -757,10 +760,10 @@ void ClangASTSource::FindExternalVisible
 
   if (!context.m_namespace_map->empty()) {
     if (log && log->GetVerbose())
-      log->Printf("  CAS::FEVD[%u] Registering namespace map %p (%d entries)",
-                  current_id,
-                  static_cast<void *>(context.m_namespace_map.get()),
-                  static_cast<int>(context.m_namespace_map->size()));
+      LLDB_LOGF(log,
+                "  CAS::FEVD[%u] Registering namespace map %p (%d entries)",
+                current_id, static_cast<void *>(context.m_namespace_map.get()),
+                static_cast<int>(context.m_namespace_map->size()));
 
     NamespaceDecl *clang_namespace_decl =
         AddNamespace(context, context.m_namespace_map);
@@ -818,10 +821,9 @@ void ClangASTSource::FindExternalVisible
             std::pair<lldb::ModuleSP, CompilerDeclContext>(
                 module_sp, found_namespace_decl));
 
-        if (log)
-          log->Printf("  CAS::FEVD[%u] Found namespace %s in module %s",
-                      current_id, name.GetCString(),
-                      module_sp->GetFileSpec().GetFilename().GetCString());
+        LLDB_LOGF(log, "  CAS::FEVD[%u] Found namespace %s in module %s",
+                  current_id, name.GetCString(),
+                  module_sp->GetFileSpec().GetFilename().GetCString());
       }
     }
   } else if (!HasMerger()) {
@@ -849,10 +851,9 @@ void ClangASTSource::FindExternalVisible
             std::pair<lldb::ModuleSP, CompilerDeclContext>(
                 image, found_namespace_decl));
 
-        if (log)
-          log->Printf("  CAS::FEVD[%u] Found namespace %s in module %s",
-                      current_id, name.GetCString(),
-                      image->GetFileSpec().GetFilename().GetCString());
+        LLDB_LOGF(log, "  CAS::FEVD[%u] Found namespace %s in module %s",
+                  current_id, name.GetCString(),
+                  image->GetFileSpec().GetFilename().GetCString());
       }
     }
   }
@@ -878,9 +879,9 @@ void ClangASTSource::FindExternalVisible
         if (log) {
           const char *name_string = type_sp->GetName().GetCString();
 
-          log->Printf("  CAS::FEVD[%u] Matching type found for \"%s\": %s",
-                      current_id, name.GetCString(),
-                      (name_string ? name_string : "<anonymous>"));
+          LLDB_LOGF(log, "  CAS::FEVD[%u] Matching type found for \"%s\": %s",
+                    current_id, name.GetCString(),
+                    (name_string ? name_string : "<anonymous>"));
         }
 
         CompilerType full_type = type_sp->GetFullCompilerType();
@@ -888,8 +889,8 @@ void ClangASTSource::FindExternalVisible
         CompilerType copied_clang_type(GuardedCopyType(full_type));
 
         if (!copied_clang_type) {
-          if (log)
-            log->Printf("  CAS::FEVD[%u] - Couldn't export a type", current_id);
+          LLDB_LOGF(log, "  CAS::FEVD[%u] - Couldn't export a type",
+                    current_id);
 
           continue;
         }
@@ -915,9 +916,10 @@ void ClangASTSource::FindExternalVisible
             break;
 
           if (log) {
-            log->Printf("  CAS::FEVD[%u] Matching entity found for \"%s\" in "
-                        "the modules",
-                        current_id, name.GetCString());
+            LLDB_LOGF(log,
+                      "  CAS::FEVD[%u] Matching entity found for \"%s\" in "
+                      "the modules",
+                      current_id, name.GetCString());
           }
 
           clang::NamedDecl *const decl_from_modules = decls[0];
@@ -930,10 +932,10 @@ void ClangASTSource::FindExternalVisible
                 copied_decl ? dyn_cast<clang::NamedDecl>(copied_decl) : nullptr;
 
             if (!copied_named_decl) {
-              if (log)
-                log->Printf(
-                    "  CAS::FEVD[%u] - Couldn't export a type from the modules",
-                    current_id);
+              LLDB_LOGF(
+                  log,
+                  "  CAS::FEVD[%u] - Couldn't export a type from the modules",
+                  current_id);
 
               break;
             }
@@ -975,7 +977,8 @@ void ClangASTSource::FindExternalVisible
           break;
 
         if (log) {
-          log->Printf(
+          LLDB_LOGF(
+              log,
               "  CAS::FEVD[%u] Matching type found for \"%s\" in the runtime",
               current_id, name.GetCString());
         }
@@ -985,10 +988,9 @@ void ClangASTSource::FindExternalVisible
             copied_decl ? dyn_cast<clang::NamedDecl>(copied_decl) : nullptr;
 
         if (!copied_named_decl) {
-          if (log)
-            log->Printf(
-                "  CAS::FEVD[%u] - Couldn't export a type from the runtime",
-                current_id);
+          LLDB_LOGF(log,
+                    "  CAS::FEVD[%u] - Couldn't export a type from the runtime",
+                    current_id);
 
           break;
         }
@@ -1126,8 +1128,8 @@ bool ClangASTSource::FindObjCMethodDecls
 
     if (log) {
       ASTDumper dumper((Decl *)copied_method_decl);
-      log->Printf("  CAS::FOMD[%d] found (%s) %s", current_id, log_info,
-                  dumper.GetCString());
+      LLDB_LOGF(log, "  CAS::FOMD[%d] found (%s) %s", current_id, log_info,
+                dumper.GetCString());
     }
 
     context.AddNamedDecl(copied_method_decl);
@@ -1205,12 +1207,12 @@ void ClangASTSource::FindObjCMethodDecls
 
   ConstString selector_name(ss.GetString());
 
-  if (log)
-    log->Printf("ClangASTSource::FindObjCMethodDecls[%d] on (ASTContext*)%p "
-                "for selector [%s %s]",
-                current_id, static_cast<void *>(m_ast_context),
-                interface_decl->getNameAsString().c_str(),
-                selector_name.AsCString());
+  LLDB_LOGF(log,
+            "ClangASTSource::FindObjCMethodDecls[%d] on (ASTContext*)%p "
+            "for selector [%s %s]",
+            current_id, static_cast<void *>(m_ast_context),
+            interface_decl->getNameAsString().c_str(),
+            selector_name.AsCString());
   SymbolContextList sc_list;
 
   const bool include_symbols = false;
@@ -1331,8 +1333,8 @@ void ClangASTSource::FindObjCMethodDecls
 
         if (log) {
           ASTDumper dumper((Decl *)copied_method_decl);
-          log->Printf("  CAS::FOMD[%d] found (in symbols) %s", current_id,
-                      dumper.GetCString());
+          LLDB_LOGF(log, "  CAS::FOMD[%d] found (in symbols) %s", current_id,
+                    dumper.GetCString());
         }
 
         context.AddNamedDecl(copied_method_decl);
@@ -1360,11 +1362,11 @@ void ClangASTSource::FindObjCMethodDecls
     if (complete_interface_decl == interface_decl)
       break; // already checked this one
 
-    if (log)
-      log->Printf("CAS::FOPD[%d] trying origin "
-                  "(ObjCInterfaceDecl*)%p/(ASTContext*)%p...",
-                  current_id, static_cast<void *>(complete_interface_decl),
-                  static_cast<void *>(&complete_iface_decl->getASTContext()));
+    LLDB_LOGF(log,
+              "CAS::FOPD[%d] trying origin "
+              "(ObjCInterfaceDecl*)%p/(ASTContext*)%p...",
+              current_id, static_cast<void *>(complete_interface_decl),
+              static_cast<void *>(&complete_iface_decl->getASTContext()));
 
     FindObjCMethodDeclsWithOrigin(current_id, context, complete_interface_decl,
                                   "in debug info");
@@ -1462,8 +1464,8 @@ static bool FindObjCPropertyAndIvarDecls
     if (parser_property_decl.IsValid()) {
       if (log) {
         ASTDumper dumper((Decl *)parser_property_decl.decl);
-        log->Printf("  CAS::FOPD[%d] found %s", current_id,
-                    dumper.GetCString());
+        LLDB_LOGF(log, "  CAS::FOPD[%d] found %s", current_id,
+                  dumper.GetCString());
       }
 
       context.AddNamedDecl(parser_property_decl.decl);
@@ -1480,8 +1482,8 @@ static bool FindObjCPropertyAndIvarDecls
     if (parser_ivar_decl.IsValid()) {
       if (log) {
         ASTDumper dumper((Decl *)parser_ivar_decl.decl);
-        log->Printf("  CAS::FOPD[%d] found %s", current_id,
-                    dumper.GetCString());
+        LLDB_LOGF(log, "  CAS::FOPD[%d] found %s", current_id,
+                  dumper.GetCString());
       }
 
       context.AddNamedDecl(parser_ivar_decl.decl);
@@ -1505,23 +1507,23 @@ void ClangASTSource::FindObjCPropertyAnd
 
   ConstString class_name(parser_iface_decl->getNameAsString().c_str());
 
-  if (log)
-    log->Printf("ClangASTSource::FindObjCPropertyAndIvarDecls[%d] on "
-                "(ASTContext*)%p for '%s.%s'",
-                current_id, static_cast<void *>(m_ast_context),
-                parser_iface_decl->getNameAsString().c_str(),
-                context.m_decl_name.getAsString().c_str());
+  LLDB_LOGF(log,
+            "ClangASTSource::FindObjCPropertyAndIvarDecls[%d] on "
+            "(ASTContext*)%p for '%s.%s'",
+            current_id, static_cast<void *>(m_ast_context),
+            parser_iface_decl->getNameAsString().c_str(),
+            context.m_decl_name.getAsString().c_str());
 
   if (FindObjCPropertyAndIvarDeclsWithOrigin(
           current_id, context, *this, origin_iface_decl))
     return;
 
-  if (log)
-    log->Printf("CAS::FOPD[%d] couldn't find the property on origin "
-                "(ObjCInterfaceDecl*)%p/(ASTContext*)%p, searching "
-                "elsewhere...",
-                current_id, static_cast<const void *>(origin_iface_decl.decl),
-                static_cast<void *>(&origin_iface_decl->getASTContext()));
+  LLDB_LOGF(log,
+            "CAS::FOPD[%d] couldn't find the property on origin "
+            "(ObjCInterfaceDecl*)%p/(ASTContext*)%p, searching "
+            "elsewhere...",
+            current_id, static_cast<const void *>(origin_iface_decl.decl),
+            static_cast<void *>(&origin_iface_decl->getASTContext()));
 
   SymbolContext null_sc;
   TypeList type_list;
@@ -1542,12 +1544,11 @@ void ClangASTSource::FindObjCPropertyAnd
     if (complete_iface_decl.decl == origin_iface_decl.decl)
       break; // already checked this one
 
-    if (log)
-      log->Printf("CAS::FOPD[%d] trying origin "
-                  "(ObjCInterfaceDecl*)%p/(ASTContext*)%p...",
-                  current_id,
-                  static_cast<const void *>(complete_iface_decl.decl),
-                  static_cast<void *>(&complete_iface_decl->getASTContext()));
+    LLDB_LOGF(log,
+              "CAS::FOPD[%d] trying origin "
+              "(ObjCInterfaceDecl*)%p/(ASTContext*)%p...",
+              current_id, static_cast<const void *>(complete_iface_decl.decl),
+              static_cast<void *>(&complete_iface_decl->getASTContext()));
 
     FindObjCPropertyAndIvarDeclsWithOrigin(current_id, context, *this,
                                            complete_iface_decl);
@@ -1578,13 +1579,12 @@ void ClangASTSource::FindObjCPropertyAnd
     if (!interface_decl_from_modules.IsValid())
       break;
 
-    if (log)
-      log->Printf(
-          "CAS::FOPD[%d] trying module "
-          "(ObjCInterfaceDecl*)%p/(ASTContext*)%p...",
-          current_id,
-          static_cast<const void *>(interface_decl_from_modules.decl),
-          static_cast<void *>(&interface_decl_from_modules->getASTContext()));
+    LLDB_LOGF(
+        log,
+        "CAS::FOPD[%d] trying module "
+        "(ObjCInterfaceDecl*)%p/(ASTContext*)%p...",
+        current_id, static_cast<const void *>(interface_decl_from_modules.decl),
+        static_cast<void *>(&interface_decl_from_modules->getASTContext()));
 
     if (FindObjCPropertyAndIvarDeclsWithOrigin(current_id, context, *this,
                                                interface_decl_from_modules))
@@ -1623,13 +1623,12 @@ void ClangASTSource::FindObjCPropertyAnd
     if (!interface_decl_from_runtime.IsValid())
       break;
 
-    if (log)
-      log->Printf(
-          "CAS::FOPD[%d] trying runtime "
-          "(ObjCInterfaceDecl*)%p/(ASTContext*)%p...",
-          current_id,
-          static_cast<const void *>(interface_decl_from_runtime.decl),
-          static_cast<void *>(&interface_decl_from_runtime->getASTContext()));
+    LLDB_LOGF(
+        log,
+        "CAS::FOPD[%d] trying runtime "
+        "(ObjCInterfaceDecl*)%p/(ASTContext*)%p...",
+        current_id, static_cast<const void *>(interface_decl_from_runtime.decl),
+        static_cast<void *>(&interface_decl_from_runtime->getASTContext()));
 
     if (FindObjCPropertyAndIvarDeclsWithOrigin(
             current_id, context, *this, interface_decl_from_runtime))
@@ -1729,12 +1728,12 @@ bool ClangASTSource::layoutRecordType(co
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
-  if (log)
-    log->Printf("LayoutRecordType[%u] on (ASTContext*)%p for (RecordDecl*)%p "
-                "[name = '%s']",
-                current_id, static_cast<void *>(m_ast_context),
-                static_cast<const void *>(record),
-                record->getNameAsString().c_str());
+  LLDB_LOGF(log,
+            "LayoutRecordType[%u] on (ASTContext*)%p for (RecordDecl*)%p "
+            "[name = '%s']",
+            current_id, static_cast<void *>(m_ast_context),
+            static_cast<const void *>(record),
+            record->getNameAsString().c_str());
 
   DeclFromParser<const RecordDecl> parser_record(record);
   DeclFromUser<const RecordDecl> origin_record(
@@ -1798,24 +1797,25 @@ bool ClangASTSource::layoutRecordType(co
               m_ast_context->getCharWidth();
 
   if (log) {
-    log->Printf("LRT[%u] returned:", current_id);
-    log->Printf("LRT[%u]   Original = (RecordDecl*)%p", current_id,
-                static_cast<const void *>(origin_record.decl));
-    log->Printf("LRT[%u]   Size = %" PRId64, current_id, size);
-    log->Printf("LRT[%u]   Alignment = %" PRId64, current_id, alignment);
-    log->Printf("LRT[%u]   Fields:", current_id);
+    LLDB_LOGF(log, "LRT[%u] returned:", current_id);
+    LLDB_LOGF(log, "LRT[%u]   Original = (RecordDecl*)%p", current_id,
+              static_cast<const void *>(origin_record.decl));
+    LLDB_LOGF(log, "LRT[%u]   Size = %" PRId64, current_id, size);
+    LLDB_LOGF(log, "LRT[%u]   Alignment = %" PRId64, current_id, alignment);
+    LLDB_LOGF(log, "LRT[%u]   Fields:", current_id);
     for (RecordDecl::field_iterator fi = record->field_begin(),
                                     fe = record->field_end();
          fi != fe; ++fi) {
-      log->Printf("LRT[%u]     (FieldDecl*)%p, Name = '%s', Offset = %" PRId64
-                  " bits",
-                  current_id, static_cast<void *>(*fi),
-                  fi->getNameAsString().c_str(), field_offsets[*fi]);
+      LLDB_LOGF(log,
+                "LRT[%u]     (FieldDecl*)%p, Name = '%s', Offset = %" PRId64
+                " bits",
+                current_id, static_cast<void *>(*fi),
+                fi->getNameAsString().c_str(), field_offsets[*fi]);
     }
     DeclFromParser<const CXXRecordDecl> parser_cxx_record =
         DynCast<const CXXRecordDecl>(parser_record);
     if (parser_cxx_record.IsValid()) {
-      log->Printf("LRT[%u]   Bases:", current_id);
+      LLDB_LOGF(log, "LRT[%u]   Bases:", current_id);
       for (CXXRecordDecl::base_class_const_iterator
                bi = parser_cxx_record->bases_begin(),
                be = parser_cxx_record->bases_end();
@@ -1828,7 +1828,8 @@ bool ClangASTSource::layoutRecordType(co
         DeclFromParser<CXXRecordDecl> base_cxx_record =
             DynCast<CXXRecordDecl>(base_record);
 
-        log->Printf(
+        LLDB_LOGF(
+            log,
             "LRT[%u]     %s(CXXRecordDecl*)%p, Name = '%s', Offset = %" PRId64
             " chars",
             current_id, (is_virtual ? "Virtual " : ""),
@@ -1839,7 +1840,7 @@ bool ClangASTSource::layoutRecordType(co
                  : base_offsets[base_cxx_record.decl].getQuantity()));
       }
     } else {
-      log->Printf("LRD[%u]   Not a CXXRecord, so no bases", current_id);
+      LLDB_LOGF(log, "LRD[%u]   Not a CXXRecord, so no bases", current_id);
     }
   }
 
@@ -1856,16 +1857,18 @@ void ClangASTSource::CompleteNamespaceMa
 
   if (log) {
     if (parent_map && parent_map->size())
-      log->Printf("CompleteNamespaceMap[%u] on (ASTContext*)%p Searching for "
-                  "namespace %s in namespace %s",
-                  current_id, static_cast<void *>(m_ast_context),
-                  name.GetCString(),
-                  parent_map->begin()->second.GetName().AsCString());
+      LLDB_LOGF(log,
+                "CompleteNamespaceMap[%u] on (ASTContext*)%p Searching for "
+                "namespace %s in namespace %s",
+                current_id, static_cast<void *>(m_ast_context),
+                name.GetCString(),
+                parent_map->begin()->second.GetName().AsCString());
     else
-      log->Printf("CompleteNamespaceMap[%u] on (ASTContext*)%p Searching for "
-                  "namespace %s",
-                  current_id, static_cast<void *>(m_ast_context),
-                  name.GetCString());
+      LLDB_LOGF(log,
+                "CompleteNamespaceMap[%u] on (ASTContext*)%p Searching for "
+                "namespace %s",
+                current_id, static_cast<void *>(m_ast_context),
+                name.GetCString());
   }
 
   if (parent_map) {
@@ -1891,10 +1894,9 @@ void ClangASTSource::CompleteNamespaceMa
       namespace_map->push_back(std::pair<lldb::ModuleSP, CompilerDeclContext>(
           module_sp, found_namespace_decl));
 
-      if (log)
-        log->Printf("  CMN[%u] Found namespace %s in module %s", current_id,
-                    name.GetCString(),
-                    module_sp->GetFileSpec().GetFilename().GetCString());
+      LLDB_LOGF(log, "  CMN[%u] Found namespace %s in module %s", current_id,
+                name.GetCString(),
+                module_sp->GetFileSpec().GetFilename().GetCString());
     }
   } else {
     const ModuleList &target_images = m_target->GetImages();
@@ -1924,10 +1926,9 @@ void ClangASTSource::CompleteNamespaceMa
       namespace_map->push_back(std::pair<lldb::ModuleSP, CompilerDeclContext>(
           image, found_namespace_decl));
 
-      if (log)
-        log->Printf("  CMN[%u] Found namespace %s in module %s", current_id,
-                    name.GetCString(),
-                    image->GetFileSpec().GetFilename().GetCString());
+      LLDB_LOGF(log, "  CMN[%u] Found namespace %s in module %s", current_id,
+                name.GetCString(),
+                image->GetFileSpec().GetFilename().GetCString());
     }
   }
 }
@@ -2162,8 +2163,7 @@ clang::NamedDecl *NameSearchContext::Add
   } else {
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
-    if (log)
-      log->Printf("Function type wasn't a FunctionProtoType");
+    LLDB_LOGF(log, "Function type wasn't a FunctionProtoType");
   }
 
   // If this is an operator (e.g. operator new or operator==), only insert the

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp Wed Jul 24 10:56:10 2019
@@ -383,8 +383,7 @@ bool ClangExpressionDeclMap::AddPersiste
   TypeFromUser user_type = DeportType(*context, *ast, parser_type);
 
   if (!user_type.GetOpaqueQualType()) {
-    if (log)
-      log->Printf("Persistent variable's type wasn't copied successfully");
+    LLDB_LOGF(log, "Persistent variable's type wasn't copied successfully");
     return false;
   }
 
@@ -423,8 +422,7 @@ bool ClangExpressionDeclMap::AddPersiste
     var->m_flags |= ClangExpressionVariable::EVKeepInTarget;
   }
 
-  if (log)
-    log->Printf("Created persistent variable with flags 0x%hx", var->m_flags);
+  LLDB_LOGF(log, "Created persistent variable with flags 0x%hx", var->m_flags);
 
   var->EnableParserVars(GetParserID());
 
@@ -466,10 +464,9 @@ bool ClangExpressionDeclMap::AddValueToS
   if (!var)
     return false;
 
-  if (log)
-    log->Printf("Adding value for (NamedDecl*)%p [%s - %s] to the structure",
-                static_cast<const void *>(decl), name.GetCString(),
-                var->GetName().GetCString());
+  LLDB_LOGF(log, "Adding value for (NamedDecl*)%p [%s - %s] to the structure",
+            static_cast<const void *>(decl), name.GetCString(),
+            var->GetName().GetCString());
 
   // We know entity->m_parser_vars is valid because we used a parser variable
   // to find it
@@ -483,9 +480,8 @@ bool ClangExpressionDeclMap::AddValueToS
           llvm::cast<ClangExpressionVariable>(var)->GetJITVars(GetParserID())) {
     // We already laid this out; do not touch
 
-    if (log)
-      log->Printf("Already placed at 0x%llx",
-                  (unsigned long long)jit_vars->m_offset);
+    LLDB_LOGF(log, "Already placed at 0x%llx",
+              (unsigned long long)jit_vars->m_offset);
   }
 
   llvm::cast<ClangExpressionVariable>(var)->EnableJITVars(GetParserID());
@@ -520,8 +516,7 @@ bool ClangExpressionDeclMap::AddValueToS
     if (!err.Success())
       return false;
 
-    if (log)
-      log->Printf("Placed at 0x%llx", (unsigned long long)offset);
+    LLDB_LOGF(log, "Placed at 0x%llx", (unsigned long long)offset);
 
     jit_vars->m_offset =
         offset; // TODO DoStructLayout() should not change this.
@@ -787,7 +782,7 @@ void ClangExpressionDeclMap::FindExterna
 
   if (GetImportInProgress()) {
     if (log && log->GetVerbose())
-      log->Printf("Ignoring a query during an import");
+      LLDB_LOGF(log, "Ignoring a query during an import");
     return;
   }
 
@@ -796,20 +791,23 @@ void ClangExpressionDeclMap::FindExterna
 
   if (log) {
     if (!context.m_decl_context)
-      log->Printf("ClangExpressionDeclMap::FindExternalVisibleDecls[%u] for "
-                  "'%s' in a NULL DeclContext",
-                  current_id, name.GetCString());
+      LLDB_LOGF(log,
+                "ClangExpressionDeclMap::FindExternalVisibleDecls[%u] for "
+                "'%s' in a NULL DeclContext",
+                current_id, name.GetCString());
     else if (const NamedDecl *context_named_decl =
                  dyn_cast<NamedDecl>(context.m_decl_context))
-      log->Printf("ClangExpressionDeclMap::FindExternalVisibleDecls[%u] for "
-                  "'%s' in '%s'",
-                  current_id, name.GetCString(),
-                  context_named_decl->getNameAsString().c_str());
+      LLDB_LOGF(log,
+                "ClangExpressionDeclMap::FindExternalVisibleDecls[%u] for "
+                "'%s' in '%s'",
+                current_id, name.GetCString(),
+                context_named_decl->getNameAsString().c_str());
     else
-      log->Printf("ClangExpressionDeclMap::FindExternalVisibleDecls[%u] for "
-                  "'%s' in a '%s'",
-                  current_id, name.GetCString(),
-                  context.m_decl_context->getDeclKindName());
+      LLDB_LOGF(log,
+                "ClangExpressionDeclMap::FindExternalVisibleDecls[%u] for "
+                "'%s' in a '%s'",
+                current_id, name.GetCString(),
+                context.m_decl_context->getDeclKindName());
   }
 
   if (const NamespaceDecl *namespace_context =
@@ -930,9 +928,8 @@ void ClangExpressionDeclMap::FindExterna
         MaybeRegisterFunctionBody(parser_function_decl);
       }
 
-      if (log)
-        log->Printf("  CEDM::FEVD[%u] Found persistent decl %s", current_id,
-                    name.GetCString());
+      LLDB_LOGF(log, "  CEDM::FEVD[%u] Found persistent decl %s", current_id,
+                name.GetCString());
 
       context.AddNamedDecl(parser_named_decl);
     } while (false);
@@ -987,8 +984,8 @@ void ClangExpressionDeclMap::FindExterna
 
         if (log) {
           ASTDumper ast_dumper(class_qual_type);
-          log->Printf("  CEDM::FEVD[%u] Adding type for $__lldb_class: %s",
-                      current_id, ast_dumper.GetCString());
+          LLDB_LOGF(log, "  CEDM::FEVD[%u] Adding type for $__lldb_class: %s",
+                    current_id, ast_dumper.GetCString());
         }
 
         AddThisType(context, class_user_type, current_id);
@@ -1032,8 +1029,8 @@ void ClangExpressionDeclMap::FindExterna
           if (pointee_type.IsValid()) {
             if (log) {
               ASTDumper ast_dumper(pointee_type);
-              log->Printf("  FEVD[%u] Adding type for $__lldb_class: %s",
-                          current_id, ast_dumper.GetCString());
+              LLDB_LOGF(log, "  FEVD[%u] Adding type for $__lldb_class: %s",
+                        current_id, ast_dumper.GetCString());
             }
 
             AddThisType(context, pointee_type, current_id);
@@ -1104,8 +1101,8 @@ void ClangExpressionDeclMap::FindExterna
 
         if (log) {
           ASTDumper ast_dumper(interface_type);
-          log->Printf("  FEVD[%u] Adding type for $__lldb_objc_class: %s",
-                      current_id, ast_dumper.GetCString());
+          LLDB_LOGF(log, "  FEVD[%u] Adding type for $__lldb_objc_class: %s",
+                    current_id, ast_dumper.GetCString());
         }
 
         AddOneType(context, class_user_type, current_id);
@@ -1165,8 +1162,9 @@ void ClangExpressionDeclMap::FindExterna
 
             if (log) {
               ASTDumper ast_dumper(self_type->GetFullCompilerType());
-              log->Printf("  FEVD[%u] Adding type for $__lldb_objc_class: %s",
-                          current_id, ast_dumper.GetCString());
+              LLDB_LOGF(log,
+                        "  FEVD[%u] Adding type for $__lldb_objc_class: %s",
+                        current_id, ast_dumper.GetCString());
             }
 
             TypeFromUser class_user_type(self_clang_type);
@@ -1230,9 +1228,8 @@ void ClangExpressionDeclMap::FindExterna
               reg_name));
 
       if (reg_info) {
-        if (log)
-          log->Printf("  CEDM::FEVD[%u] Found register %s", current_id,
-                      reg_info->name);
+        LLDB_LOGF(log, "  CEDM::FEVD[%u] Found register %s", current_id,
+                  reg_info->name);
 
         AddOneRegister(context, reg_info, current_id);
       }
@@ -1519,9 +1516,10 @@ void ClangExpressionDeclMap::FindExterna
 
           if (llvm::isa<clang::FunctionDecl>(decl_from_modules)) {
             if (log) {
-              log->Printf("  CAS::FEVD[%u] Matching function found for "
-                          "\"%s\" in the modules",
-                          current_id, name.GetCString());
+              LLDB_LOGF(log,
+                        "  CAS::FEVD[%u] Matching function found for "
+                        "\"%s\" in the modules",
+                        current_id, name.GetCString());
             }
 
             clang::Decl *copied_decl = CopyDecl(decl_from_modules);
@@ -1530,10 +1528,10 @@ void ClangExpressionDeclMap::FindExterna
                             : nullptr;
 
             if (!copied_function_decl) {
-              if (log)
-                log->Printf("  CAS::FEVD[%u] - Couldn't export a function "
-                            "declaration from the modules",
-                            current_id);
+              LLDB_LOGF(log,
+                        "  CAS::FEVD[%u] - Couldn't export a function "
+                        "declaration from the modules",
+                        current_id);
 
               break;
             }
@@ -1546,9 +1544,10 @@ void ClangExpressionDeclMap::FindExterna
             context.m_found.function = true;
           } else if (llvm::isa<clang::VarDecl>(decl_from_modules)) {
             if (log) {
-              log->Printf("  CAS::FEVD[%u] Matching variable found for "
-                          "\"%s\" in the modules",
-                          current_id, name.GetCString());
+              LLDB_LOGF(log,
+                        "  CAS::FEVD[%u] Matching variable found for "
+                        "\"%s\" in the modules",
+                        current_id, name.GetCString());
             }
 
             clang::Decl *copied_decl = CopyDecl(decl_from_modules);
@@ -1557,10 +1556,10 @@ void ClangExpressionDeclMap::FindExterna
                             : nullptr;
 
             if (!copied_var_decl) {
-              if (log)
-                log->Printf("  CAS::FEVD[%u] - Couldn't export a variable "
-                            "declaration from the modules",
-                            current_id);
+              LLDB_LOGF(log,
+                        "  CAS::FEVD[%u] - Couldn't export a variable "
+                        "declaration from the modules",
+                        current_id);
 
               break;
             }
@@ -1655,8 +1654,7 @@ bool ClangExpressionDeclMap::GetVariable
                            const_value_extractor.GetByteSize());
       var_location.SetValueType(Value::eValueTypeHostAddress);
     } else {
-      if (log)
-        log->Printf("Error evaluating constant variable: %s", err.AsCString());
+      LLDB_LOGF(log, "Error evaluating constant variable: %s", err.AsCString());
       return false;
     }
   }
@@ -1664,9 +1662,8 @@ bool ClangExpressionDeclMap::GetVariable
   CompilerType type_to_use = GuardedCopyType(var_clang_type);
 
   if (!type_to_use) {
-    if (log)
-      log->Printf(
-          "Couldn't copy a variable's type into the parser's AST context");
+    LLDB_LOGF(log,
+              "Couldn't copy a variable's type into the parser's AST context");
 
     return false;
   }
@@ -1759,9 +1756,10 @@ void ClangExpressionDeclMap::AddOneVaria
   if (log) {
     ASTDumper orig_dumper(ut.GetOpaqueQualType());
     ASTDumper ast_dumper(var_decl);
-    log->Printf("  CEDM::FEVD[%u] Found variable %s, returned %s (original %s)",
-                current_id, decl_name.c_str(), ast_dumper.GetCString(),
-                orig_dumper.GetCString());
+    LLDB_LOGF(log,
+              "  CEDM::FEVD[%u] Found variable %s, returned %s (original %s)",
+              current_id, decl_name.c_str(), ast_dumper.GetCString(),
+              orig_dumper.GetCString());
   }
 }
 
@@ -1776,9 +1774,8 @@ void ClangExpressionDeclMap::AddOneVaria
   TypeFromParser parser_type(GuardedCopyType(user_type));
 
   if (!parser_type.GetOpaqueQualType()) {
-    if (log)
-      log->Printf("  CEDM::FEVD[%u] Couldn't import type for pvar %s",
-                  current_id, pvar_sp->GetName().GetCString());
+    LLDB_LOGF(log, "  CEDM::FEVD[%u] Couldn't import type for pvar %s",
+              current_id, pvar_sp->GetName().GetCString());
     return;
   }
 
@@ -1797,8 +1794,8 @@ void ClangExpressionDeclMap::AddOneVaria
 
   if (log) {
     ASTDumper ast_dumper(var_decl);
-    log->Printf("  CEDM::FEVD[%u] Added pvar %s, returned %s", current_id,
-                pvar_sp->GetName().GetCString(), ast_dumper.GetCString());
+    LLDB_LOGF(log, "  CEDM::FEVD[%u] Added pvar %s, returned %s", current_id,
+              pvar_sp->GetName().GetCString(), ast_dumper.GetCString());
   }
 }
 
@@ -1856,8 +1853,8 @@ void ClangExpressionDeclMap::AddOneGener
   if (log) {
     ASTDumper ast_dumper(var_decl);
 
-    log->Printf("  CEDM::FEVD[%u] Found variable %s, returned %s", current_id,
-                decl_name.c_str(), ast_dumper.GetCString());
+    LLDB_LOGF(log, "  CEDM::FEVD[%u] Found variable %s, returned %s",
+              current_id, decl_name.c_str(), ast_dumper.GetCString());
   }
 }
 
@@ -1882,15 +1879,14 @@ bool ClangExpressionDeclMap::ResolveUnkn
       const VarDecl *var_decl = dyn_cast<VarDecl>(named_decl);
 
       if (!var_decl) {
-        if (log)
-          log->Printf("Entity of unknown type does not have a VarDecl");
+        LLDB_LOGF(log, "Entity of unknown type does not have a VarDecl");
         return false;
       }
 
       if (log) {
         ASTDumper ast_dumper(const_cast<VarDecl *>(var_decl));
-        log->Printf("Variable of unknown type now has Decl %s",
-                    ast_dumper.GetCString());
+        LLDB_LOGF(log, "Variable of unknown type now has Decl %s",
+                  ast_dumper.GetCString());
       }
 
       QualType var_type = var_decl->getType();
@@ -1914,9 +1910,8 @@ bool ClangExpressionDeclMap::ResolveUnkn
       }
 
       if (!copied_type) {
-        if (log)
-          log->Printf("ClangExpressionDeclMap::ResolveUnknownType - Couldn't "
-                      "import the type for a variable");
+        LLDB_LOGF(log, "ClangExpressionDeclMap::ResolveUnknownType - Couldn't "
+                       "import the type for a variable");
 
         return (bool)lldb::ExpressionVariableSP();
       }
@@ -1947,9 +1942,8 @@ void ClangExpressionDeclMap::AddOneRegis
           m_ast_context, reg_info->encoding, reg_info->byte_size * 8);
 
   if (!clang_type) {
-    if (log)
-      log->Printf("  Tried to add a type for %s, but couldn't get one",
-                  context.m_decl_name.getAsString().c_str());
+    LLDB_LOGF(log, "  Tried to add a type for %s, but couldn't get one",
+              context.m_decl_name.getAsString().c_str());
     return;
   }
 
@@ -1977,9 +1971,9 @@ void ClangExpressionDeclMap::AddOneRegis
 
   if (log) {
     ASTDumper ast_dumper(var_decl);
-    log->Printf("  CEDM::FEVD[%d] Added register %s, returned %s", current_id,
-                context.m_decl_name.getAsString().c_str(),
-                ast_dumper.GetCString());
+    LLDB_LOGF(log, "  CEDM::FEVD[%d] Added register %s, returned %s",
+              current_id, context.m_decl_name.getAsString().c_str(),
+              ast_dumper.GetCString());
   }
 }
 
@@ -2049,19 +2043,20 @@ void ClangExpressionDeclMap::AddOneFunct
 
               function->DumpSymbolContext(&ss);
 
-              log->Printf("  CEDM::FEVD[%u] Imported decl for function %s "
-                          "(description %s), returned %s",
-                          current_id,
-                          copied_function_decl->getNameAsString().c_str(),
-                          ss.GetData(), ast_dumper.GetCString());
+              LLDB_LOGF(log,
+                        "  CEDM::FEVD[%u] Imported decl for function %s "
+                        "(description %s), returned %s",
+                        current_id,
+                        copied_function_decl->getNameAsString().c_str(),
+                        ss.GetData(), ast_dumper.GetCString());
             }
 
             context.AddNamedDecl(copied_function_decl);
             return;
           } else {
             if (log) {
-              log->Printf("  Failed to import the function decl for '%s'",
-                          src_function_decl->getName().str().c_str());
+              LLDB_LOGF(log, "  Failed to import the function decl for '%s'",
+                        src_function_decl->getName().str().c_str());
             }
           }
         }
@@ -2090,7 +2085,8 @@ void ClangExpressionDeclMap::AddOneFunct
 
       if (!function_decl) {
         if (log) {
-          log->Printf(
+          LLDB_LOGF(
+              log,
               "  Failed to create a function decl for '%s' {0x%8.8" PRIx64 "}",
               function_type->GetName().GetCString(), function_type->GetID());
         }
@@ -2100,10 +2096,11 @@ void ClangExpressionDeclMap::AddOneFunct
     } else {
       // We failed to copy the type we found
       if (log) {
-        log->Printf("  Failed to import the function type '%s' {0x%8.8" PRIx64
-                    "} into the expression parser AST contenxt",
-                    function_type->GetName().GetCString(),
-                    function_type->GetID());
+        LLDB_LOGF(log,
+                  "  Failed to import the function type '%s' {0x%8.8" PRIx64
+                  "} into the expression parser AST contenxt",
+                  function_type->GetName().GetCString(),
+                  function_type->GetID());
       }
 
       return;
@@ -2162,7 +2159,8 @@ void ClangExpressionDeclMap::AddOneFunct
                      m_parser_vars->m_exe_ctx.GetBestExecutionContextScope(),
                      Address::DumpStyleResolvedDescription);
 
-    log->Printf(
+    LLDB_LOGF(
+        log,
         "  CEDM::FEVD[%u] Found %s function %s (description %s), returned %s",
         current_id, (function ? "specific" : "generic"), decl_name.c_str(),
         ss.GetData(), function_str.c_str());
@@ -2178,7 +2176,8 @@ void ClangExpressionDeclMap::AddThisType
 
   if (!copied_clang_type) {
     if (log)
-      log->Printf(
+      LLDB_LOGF(
+          log,
           "ClangExpressionDeclMap::AddThisType - Couldn't import the type");
 
     return;
@@ -2211,9 +2210,10 @@ void ClangExpressionDeclMap::AddThisType
       ASTDumper method_ast_dumper((clang::Decl *)method_decl);
       ASTDumper type_ast_dumper(copied_clang_type);
 
-      log->Printf("  CEDM::AddThisType Added function $__lldb_expr "
-                  "(description %s) for this type %s",
-                  method_ast_dumper.GetCString(), type_ast_dumper.GetCString());
+      LLDB_LOGF(log,
+                "  CEDM::AddThisType Added function $__lldb_expr "
+                "(description %s) for this type %s",
+                method_ast_dumper.GetCString(), type_ast_dumper.GetCString());
     }
   }
 
@@ -2252,8 +2252,8 @@ void ClangExpressionDeclMap::AddOneType(
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
     if (log)
-      log->Printf(
-          "ClangExpressionDeclMap::AddOneType - Couldn't import the type");
+      LLDB_LOGF(
+          log, "ClangExpressionDeclMap::AddOneType - Couldn't import the type");
 
     return;
   }

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Wed Jul 24 10:56:10 2019
@@ -331,9 +331,8 @@ ClangExpressionParser::ClangExpressionPa
 
   if (process_sp && frame_lang != lldb::eLanguageTypeUnknown) {
     lang_rt = process_sp->GetLanguageRuntime(frame_lang);
-    if (log)
-      log->Printf("Frame has language of type %s",
-                  Language::GetNameForLanguageType(frame_lang));
+    LLDB_LOGF(log, "Frame has language of type %s",
+              Language::GetNameForLanguageType(frame_lang));
   }
 
   // 2. Configure the compiler with a set of default options that are
@@ -341,9 +340,8 @@ ClangExpressionParser::ClangExpressionPa
   if (target_arch.IsValid()) {
     std::string triple = target_arch.GetTriple().str();
     m_compiler->getTargetOpts().Triple = triple;
-    if (log)
-      log->Printf("Using %s as the target triple",
-                  m_compiler->getTargetOpts().Triple.c_str());
+    LLDB_LOGF(log, "Using %s as the target triple",
+              m_compiler->getTargetOpts().Triple.c_str());
   } else {
     // If we get here we don't have a valid target and just have to guess.
     // Sometimes this will be ok to just use the host target triple (when we
@@ -352,9 +350,8 @@ ClangExpressionParser::ClangExpressionPa
     // the host triple. In such a case the language runtime should expose an
     // overridden options set (3), below.
     m_compiler->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple();
-    if (log)
-      log->Printf("Using default target triple of %s",
-                  m_compiler->getTargetOpts().Triple.c_str());
+    LLDB_LOGF(log, "Using default target triple of %s",
+              m_compiler->getTargetOpts().Triple.c_str());
   }
   // Now add some special fixes for known architectures: Any arm32 iOS
   // environment, but not on arm64
@@ -408,12 +405,13 @@ ClangExpressionParser::ClangExpressionPa
   auto target_info = TargetInfo::CreateTargetInfo(
       m_compiler->getDiagnostics(), m_compiler->getInvocation().TargetOpts);
   if (log) {
-    log->Printf("Using SIMD alignment: %d", target_info->getSimdDefaultAlign());
-    log->Printf("Target datalayout string: '%s'",
-                target_info->getDataLayout().getStringRepresentation().c_str());
-    log->Printf("Target ABI: '%s'", target_info->getABI().str().c_str());
-    log->Printf("Target vector alignment: %d",
-                target_info->getMaxVectorAlign());
+    LLDB_LOGF(log, "Using SIMD alignment: %d",
+              target_info->getSimdDefaultAlign());
+    LLDB_LOGF(log, "Target datalayout string: '%s'",
+              target_info->getDataLayout().getStringRepresentation().c_str());
+    LLDB_LOGF(log, "Target ABI: '%s'", target_info->getABI().str().c_str());
+    LLDB_LOGF(log, "Target vector alignment: %d",
+              target_info->getMaxVectorAlign());
   }
   m_compiler->setTarget(target_info);
 
@@ -1181,9 +1179,8 @@ lldb_private::Status ClangExpressionPars
                                    m_expr.FunctionName());
       return err;
     } else {
-      if (log)
-        log->Printf("Found function %s for %s", function_name.AsCString(),
-                    m_expr.FunctionName());
+      LLDB_LOGF(log, "Found function %s for %s", function_name.AsCString(),
+                m_expr.FunctionName());
     }
   }
 
@@ -1198,9 +1195,8 @@ lldb_private::Status ClangExpressionPars
   LLVMUserExpression::IRPasses custom_passes;
   {
     auto lang = m_expr.Language();
-    if (log)
-      log->Printf("%s - Current expression language is %s\n", __FUNCTION__,
-                  Language::GetNameForLanguageType(lang));
+    LLDB_LOGF(log, "%s - Current expression language is %s\n", __FUNCTION__,
+              Language::GetNameForLanguageType(lang));
     lldb::ProcessSP process_sp = exe_ctx.GetProcessSP();
     if (process_sp && lang != lldb::eLanguageTypeUnknown) {
       auto runtime = process_sp->GetLanguageRuntime(lang);
@@ -1210,10 +1206,10 @@ lldb_private::Status ClangExpressionPars
   }
 
   if (custom_passes.EarlyPasses) {
-    if (log)
-      log->Printf("%s - Running Early IR Passes from LanguageRuntime on "
-                  "expression module '%s'",
-                  __FUNCTION__, m_expr.FunctionName());
+    LLDB_LOGF(log,
+              "%s - Running Early IR Passes from LanguageRuntime on "
+              "expression module '%s'",
+              __FUNCTION__, m_expr.FunctionName());
 
     custom_passes.EarlyPasses->run(*llvm_module_up);
   }
@@ -1298,9 +1294,8 @@ lldb_private::Status ClangExpressionPars
 
           process->SetDynamicCheckers(dynamic_checkers);
 
-          if (log)
-            log->Printf("== [ClangExpressionParser::PrepareForExecution] "
-                        "Finished installing dynamic checkers ==");
+          LLDB_LOGF(log, "== [ClangExpressionParser::PrepareForExecution] "
+                         "Finished installing dynamic checkers ==");
         }
 
         if (auto *checker_funcs = llvm::dyn_cast<ClangDynamicCheckerFunctions>(
@@ -1316,10 +1311,10 @@ lldb_private::Status ClangExpressionPars
           }
 
           if (custom_passes.LatePasses) {
-            if (log)
-              log->Printf("%s - Running Late IR Passes from LanguageRuntime on "
-                          "expression module '%s'",
-                          __FUNCTION__, m_expr.FunctionName());
+            LLDB_LOGF(log,
+                      "%s - Running Late IR Passes from LanguageRuntime on "
+                      "expression module '%s'",
+                      __FUNCTION__, m_expr.FunctionName());
 
             custom_passes.LatePasses->run(*module);
           }

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp Wed Jul 24 10:56:10 2019
@@ -179,8 +179,7 @@ ClangFunctionCaller::CompileFunction(lld
   m_wrapper_function_text.append(");\n}\n");
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
-  if (log)
-    log->Printf("Expression: \n\n%s\n\n", m_wrapper_function_text.c_str());
+  LLDB_LOGF(log, "Expression: \n\n%s\n\n", m_wrapper_function_text.c_str());
 
   // Okay, now compile this expression
 

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangHost.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangHost.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangHost.cpp Wed Jul 24 10:56:10 2019
@@ -30,10 +30,10 @@ static bool VerifyClangPath(const llvm::
   if (FileSystem::Instance().IsDirectory(clang_path))
     return true;
   Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
-  if (log)
-    log->Printf("VerifyClangPath(): "
-                "failed to stat clang resource directory at \"%s\"",
-                clang_path.str().c_str());
+  LLDB_LOGF(log,
+            "VerifyClangPath(): "
+            "failed to stat clang resource directory at \"%s\"",
+            clang_path.str().c_str());
   return false;
 }
 
@@ -67,10 +67,10 @@ static bool DefaultComputeClangResourceD
     llvm::sys::path::native(relative_path);
     llvm::sys::path::append(clang_dir, relative_path);
     if (!verify || VerifyClangPath(clang_dir)) {
-      if (log)
-        log->Printf("DefaultComputeClangResourceDir: Setting ClangResourceDir "
-                    "to \"%s\", verify = %s",
-                    clang_dir.str().str().c_str(), verify ? "true" : "false");
+      LLDB_LOGF(log,
+                "DefaultComputeClangResourceDir: Setting ClangResourceDir "
+                "to \"%s\", verify = %s",
+                clang_dir.str().str().c_str(), verify ? "true" : "false");
       file_spec.GetDirectory().SetString(clang_dir);
       FileSystem::Instance().Resolve(file_spec);
       return true;
@@ -160,9 +160,8 @@ FileSpec lldb_private::GetClangResourceD
       ComputeClangResourceDirectory(lldb_file_spec, g_cached_resource_dir,
                                     true);
     Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
-    if (log)
-      log->Printf("GetClangResourceDir() => '%s'",
-                  g_cached_resource_dir.GetPath().c_str());
+    LLDB_LOGF(log, "GetClangResourceDir() => '%s'",
+              g_cached_resource_dir.GetPath().c_str());
   });
   return g_cached_resource_dir;
 }

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp Wed Jul 24 10:56:10 2019
@@ -90,21 +90,18 @@ ClangUserExpression::~ClangUserExpressio
 void ClangUserExpression::ScanContext(ExecutionContext &exe_ctx, Status &err) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
-  if (log)
-    log->Printf("ClangUserExpression::ScanContext()");
+  LLDB_LOGF(log, "ClangUserExpression::ScanContext()");
 
   m_target = exe_ctx.GetTargetPtr();
 
   if (!(m_allow_cxx || m_allow_objc)) {
-    if (log)
-      log->Printf("  [CUE::SC] Settings inhibit C++ and Objective-C");
+    LLDB_LOGF(log, "  [CUE::SC] Settings inhibit C++ and Objective-C");
     return;
   }
 
   StackFrame *frame = exe_ctx.GetFramePtr();
   if (frame == nullptr) {
-    if (log)
-      log->Printf("  [CUE::SC] Null stack frame");
+    LLDB_LOGF(log, "  [CUE::SC] Null stack frame");
     return;
   }
 
@@ -112,8 +109,7 @@ void ClangUserExpression::ScanContext(Ex
                                                   lldb::eSymbolContextBlock);
 
   if (!sym_ctx.function) {
-    if (log)
-      log->Printf("  [CUE::SC] Null function");
+    LLDB_LOGF(log, "  [CUE::SC] Null function");
     return;
   }
 
@@ -121,16 +117,14 @@ void ClangUserExpression::ScanContext(Ex
   Block *function_block = sym_ctx.GetFunctionBlock();
 
   if (!function_block) {
-    if (log)
-      log->Printf("  [CUE::SC] Null function block");
+    LLDB_LOGF(log, "  [CUE::SC] Null function block");
     return;
   }
 
   CompilerDeclContext decl_context = function_block->GetDeclContext();
 
   if (!decl_context) {
-    if (log)
-      log->Printf("  [CUE::SC] Null decl context");
+    LLDB_LOGF(log, "  [CUE::SC] Null decl context");
     return;
   }
 
@@ -527,8 +521,7 @@ bool ClangUserExpression::Parse(Diagnost
   if (!PrepareForParsing(diagnostic_manager, exe_ctx, /*for_completion*/ false))
     return false;
 
-  if (log)
-    log->Printf("Parsing the following code:\n%s", m_transformed_text.c_str());
+  LLDB_LOGF(log, "Parsing the following code:\n%s", m_transformed_text.c_str());
 
   ////////////////////////////////////
   // Set up the target and compiler
@@ -726,8 +719,7 @@ bool ClangUserExpression::Complete(Execu
   if (!PrepareForParsing(diagnostic_manager, exe_ctx, /*for_completion*/ true))
     return false;
 
-  if (log)
-    log->Printf("Parsing the following code:\n%s", m_transformed_text.c_str());
+  LLDB_LOGF(log, "Parsing the following code:\n%s", m_transformed_text.c_str());
 
   //////////////////////////
   // Parse the expression

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp Wed Jul 24 10:56:10 2019
@@ -320,9 +320,8 @@ protected:
   bool InstrumentInstruction(llvm::Instruction *inst) override {
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
-    if (log)
-      log->Printf("Instrumenting load/store instruction: %s\n",
-                  PrintValue(inst).c_str());
+    LLDB_LOGF(log, "Instrumenting load/store instruction: %s\n",
+              PrintValue(inst).c_str());
 
     if (!m_valid_pointer_check_func)
       m_valid_pointer_check_func =
@@ -483,9 +482,8 @@ protected:
       std::string name_str = called_function->getName().str();
       const char *name_cstr = name_str.c_str();
 
-      if (log)
-        log->Printf("Found call to %s: %s\n", name_cstr,
-                    PrintValue(call_inst).c_str());
+      LLDB_LOGF(log, "Found call to %s: %s\n", name_cstr,
+                PrintValue(call_inst).c_str());
 
       if (name_str.find("objc_msgSend") == std::string::npos)
         return true;
@@ -520,10 +518,9 @@ protected:
         return true;
       }
 
-      if (log)
-        log->Printf(
-            "Function name '%s' contains 'objc_msgSend' but is not handled",
-            name_str.c_str());
+      LLDB_LOGF(log,
+                "Function name '%s' contains 'objc_msgSend' but is not handled",
+                name_str.c_str());
 
       return true;
     }
@@ -548,8 +545,7 @@ bool IRDynamicChecks::runOnModule(llvm::
   llvm::Function *function = M.getFunction(StringRef(m_func_name));
 
   if (!function) {
-    if (log)
-      log->Printf("Couldn't find %s() in the module", m_func_name.c_str());
+    LLDB_LOGF(log, "Couldn't find %s() in the module", m_func_name.c_str());
 
     return false;
   }
@@ -582,7 +578,7 @@ bool IRDynamicChecks::runOnModule(llvm::
 
     oss.flush();
 
-    log->Printf("Module after dynamic checks: \n%s", s.c_str());
+    LLDB_LOGF(log, "Module after dynamic checks: \n%s", s.c_str());
   }
 
   return true;

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp Wed Jul 24 10:56:10 2019
@@ -195,8 +195,7 @@ bool IRForTarget::CreateResultVariable(l
     return true;
   }
 
-  if (log)
-    log->Printf("Result name: \"%s\"", result_name);
+  LLDB_LOGF(log, "Result name: \"%s\"", result_name);
 
   Value *result_value = m_module->getNamedValue(result_name);
 
@@ -211,9 +210,8 @@ bool IRForTarget::CreateResultVariable(l
     return false;
   }
 
-  if (log)
-    log->Printf("Found result in the IR: \"%s\"",
-                PrintValue(result_value, false).c_str());
+  LLDB_LOGF(log, "Found result in the IR: \"%s\"",
+            PrintValue(result_value, false).c_str());
 
   GlobalVariable *result_global = dyn_cast<GlobalVariable>(result_value);
 
@@ -246,7 +244,7 @@ bool IRForTarget::CreateResultVariable(l
     result_decl->print(decl_desc_stream);
     decl_desc_stream.flush();
 
-    log->Printf("Found result decl: \"%s\"", decl_desc_str.c_str());
+    LLDB_LOGF(log, "Found result decl: \"%s\"", decl_desc_str.c_str());
   }
 
   clang::VarDecl *result_var = dyn_cast<clang::VarDecl>(result_decl);
@@ -316,8 +314,7 @@ bool IRForTarget::CreateResultVariable(l
     lldb_private::StreamString type_desc_stream;
     m_result_type.DumpTypeDescription(&type_desc_stream);
 
-    if (log)
-      log->Printf("Result type has unknown size");
+    LLDB_LOGF(log, "Result type has unknown size");
 
     m_error_stream.Printf("Error [IRForTarget]: Size of result type '%s' "
                           "couldn't be determined\n",
@@ -329,15 +326,14 @@ bool IRForTarget::CreateResultVariable(l
     lldb_private::StreamString type_desc_stream;
     m_result_type.DumpTypeDescription(&type_desc_stream);
 
-    log->Printf("Result decl type: \"%s\"", type_desc_stream.GetData());
+    LLDB_LOGF(log, "Result decl type: \"%s\"", type_desc_stream.GetData());
   }
 
   m_result_name = lldb_private::ConstString("$RESULT_NAME");
 
-  if (log)
-    log->Printf("Creating a new result global: \"%s\" with size 0x%" PRIx64,
-                m_result_name.GetCString(),
-                m_result_type.GetByteSize(nullptr).getValueOr(0));
+  LLDB_LOGF(log, "Creating a new result global: \"%s\" with size 0x%" PRIx64,
+            m_result_name.GetCString(),
+            m_result_type.GetByteSize(nullptr).getValueOr(0));
 
   // Construct a new result global and set up its metadata
 
@@ -369,10 +365,9 @@ bool IRForTarget::CreateResultVariable(l
       m_module->getNamedMetadata("clang.global.decl.ptrs");
   named_metadata->addOperand(persistent_global_md);
 
-  if (log)
-    log->Printf("Replacing \"%s\" with \"%s\"",
-                PrintValue(result_global).c_str(),
-                PrintValue(new_result_global).c_str());
+  LLDB_LOGF(log, "Replacing \"%s\" with \"%s\"",
+            PrintValue(result_global).c_str(),
+            PrintValue(new_result_global).c_str());
 
   if (result_global->use_empty()) {
     // We need to synthesize a store for this variable, because otherwise
@@ -385,8 +380,7 @@ bool IRForTarget::CreateResultVariable(l
       return false;
 
     if (!result_global->hasInitializer()) {
-      if (log)
-        log->Printf("Couldn't find initializer for unused variable");
+      LLDB_LOGF(log, "Couldn't find initializer for unused variable");
 
       m_error_stream.Printf("Internal error [IRForTarget]: Result variable "
                             "(%s) has no writes and no initializer\n",
@@ -400,9 +394,8 @@ bool IRForTarget::CreateResultVariable(l
     StoreInst *synthesized_store =
         new StoreInst(initializer, new_result_global, first_entry_instruction);
 
-    if (log)
-      log->Printf("Synthesized result store \"%s\"\n",
-                  PrintValue(synthesized_store).c_str());
+    LLDB_LOGF(log, "Synthesized result store \"%s\"\n",
+              PrintValue(synthesized_store).c_str());
   } else {
     result_global->replaceAllUsesWith(new_result_global);
   }
@@ -438,7 +431,6 @@ bool IRForTarget::RewriteObjCConstString
         m_execution_unit.FindSymbol(g_CFStringCreateWithBytes_str, 
                                     missing_weak);
     if (CFStringCreateWithBytes_addr == LLDB_INVALID_ADDRESS || missing_weak) {
-      if (log)
         log->PutCString("Couldn't find CFStringCreateWithBytes in the target");
 
       m_error_stream.Printf("Error [IRForTarget]: Rewriting an Objective-C "
@@ -448,9 +440,8 @@ bool IRForTarget::RewriteObjCConstString
       return false;
     }
 
-    if (log)
-      log->Printf("Found CFStringCreateWithBytes at 0x%" PRIx64,
-                  CFStringCreateWithBytes_addr);
+    LLDB_LOGF(log, "Found CFStringCreateWithBytes at 0x%" PRIx64,
+              CFStringCreateWithBytes_addr);
 
     // Build the function type:
     //
@@ -622,9 +613,10 @@ bool IRForTarget::RewriteObjCConstString
 
       if (nsstring_struct->getNumOperands() != 4) {
         if (log)
-          log->Printf("NSString variable's initializer structure has an "
-                      "unexpected number of members.  Should be 4, is %d",
-                      nsstring_struct->getNumOperands());
+          LLDB_LOGF(log,
+                    "NSString variable's initializer structure has an "
+                    "unexpected number of members.  Should be 4, is %d",
+                    nsstring_struct->getNumOperands());
 
         m_error_stream.Printf("Internal error [IRForTarget]: The struct for an "
                               "Objective-C constant string is not as "
@@ -728,11 +720,11 @@ bool IRForTarget::RewriteObjCConstString
 
       if (log) {
         if (cstr_array)
-          log->Printf("Found NSString constant %s, which contains \"%s\"",
-                      value_name_cstr, cstr_array->getAsString().str().c_str());
+          LLDB_LOGF(log, "Found NSString constant %s, which contains \"%s\"",
+                    value_name_cstr, cstr_array->getAsString().str().c_str());
         else
-          log->Printf("Found NSString constant %s, which contains \"\"",
-                      value_name_cstr);
+          LLDB_LOGF(log, "Found NSString constant %s, which contains \"\"",
+                    value_name_cstr);
       }
 
       if (!cstr_array)
@@ -851,8 +843,8 @@ bool IRForTarget::RewriteObjCSelector(In
   std::string omvn_initializer_string = omvn_initializer_array->getAsString();
 
   if (log)
-    log->Printf("Found Objective-C selector reference \"%s\"",
-                omvn_initializer_string.c_str());
+    LLDB_LOGF(log, "Found Objective-C selector reference \"%s\"",
+              omvn_initializer_string.c_str());
 
   // Construct a call to sel_registerName
 
@@ -867,8 +859,8 @@ bool IRForTarget::RewriteObjCSelector(In
       return false;
 
     if (log)
-      log->Printf("Found sel_registerName at 0x%" PRIx64,
-                  sel_registerName_addr);
+      LLDB_LOGF(log, "Found sel_registerName at 0x%" PRIx64,
+                sel_registerName_addr);
 
     // Build the function type: struct objc_selector
     // *sel_registerName(uint8_t*)
@@ -1023,8 +1015,8 @@ bool IRForTarget::RewriteObjCClassRefere
   std::string ocn_initializer_string = ocn_initializer_array->getAsString();
 
   if (log)
-    log->Printf("Found Objective-C class reference \"%s\"",
-                ocn_initializer_string.c_str());
+    LLDB_LOGF(log, "Found Objective-C class reference \"%s\"",
+              ocn_initializer_string.c_str());
 
   // Construct a call to objc_getClass
 
@@ -1039,8 +1031,7 @@ bool IRForTarget::RewriteObjCClassRefere
       return false;
 
     if (log)
-      log->Printf("Found objc_getClass at 0x%" PRIx64,
-                  objc_getClass_addr);
+      LLDB_LOGF(log, "Found objc_getClass at 0x%" PRIx64, objc_getClass_addr);
 
     // Build the function type: %struct._objc_class *objc_getClass(i8*)
 
@@ -1181,8 +1172,8 @@ bool IRForTarget::RewritePersistentAlloc
   LoadInst *persistent_load = new LoadInst(persistent_global, "", alloc);
 
   if (log)
-    log->Printf("Replacing \"%s\" with \"%s\"", PrintValue(alloc).c_str(),
-                PrintValue(persistent_load).c_str());
+    LLDB_LOGF(log, "Replacing \"%s\" with \"%s\"", PrintValue(alloc).c_str(),
+              PrintValue(persistent_load).c_str());
 
   alloc->replaceAllUsesWith(persistent_load);
   alloc->eraseFromParent();
@@ -1213,7 +1204,7 @@ bool IRForTarget::RewritePersistentAlloc
       if (alloc_name.startswith("$") && !alloc_name.startswith("$__lldb")) {
         if (alloc_name.find_first_of("0123456789") == 1) {
           if (log)
-            log->Printf("Rejecting a numeric persistent variable.");
+            LLDB_LOGF(log, "Rejecting a numeric persistent variable.");
 
           m_error_stream.Printf("Error [IRForTarget]: Names starting with $0, "
                                 "$1, ... are reserved for use as result "
@@ -1253,8 +1244,8 @@ bool IRForTarget::MaterializeInitializer
       lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
   if (log && log->GetVerbose())
-    log->Printf("  MaterializeInitializer(%p, %s)", (void *)data,
-                PrintValue(initializer).c_str());
+    LLDB_LOGF(log, "  MaterializeInitializer(%p, %s)", (void *)data,
+              PrintValue(initializer).c_str());
 
   Type *initializer_type = initializer->getType();
 
@@ -1317,7 +1308,8 @@ bool IRForTarget::MaybeHandleVariable(Va
       lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
   if (log)
-    log->Printf("MaybeHandleVariable (%s)", PrintValue(llvm_value_ptr).c_str());
+    LLDB_LOGF(log, "MaybeHandleVariable (%s)",
+              PrintValue(llvm_value_ptr).c_str());
 
   if (ConstantExpr *constant_expr = dyn_cast<ConstantExpr>(llvm_value_ptr)) {
     switch (constant_expr->getOpcode()) {
@@ -1344,8 +1336,8 @@ bool IRForTarget::MaybeHandleVariable(Va
         return true;
 
       if (log)
-        log->Printf("Found global variable \"%s\" without metadata",
-                    global_variable->getName().str().c_str());
+        LLDB_LOGF(log, "Found global variable \"%s\" without metadata",
+                  global_variable->getName().str().c_str());
 
       return false;
     }
@@ -1385,13 +1377,14 @@ bool IRForTarget::MaybeHandleVariable(Va
         (compiler_type.GetTypeBitAlign() + 7ull) / 8ull;
 
     if (log) {
-      log->Printf("Type of \"%s\" is [clang \"%s\", llvm \"%s\"] [size %" PRIu64
-                  ", align %" PRIu64 "]",
-                  name.c_str(),
-                  lldb_private::ClangUtil::GetQualType(compiler_type)
-                      .getAsString()
-                      .c_str(),
-                  PrintType(value_type).c_str(), *value_size, value_alignment);
+      LLDB_LOGF(log,
+                "Type of \"%s\" is [clang \"%s\", llvm \"%s\"] [size %" PRIu64
+                ", align %" PRIu64 "]",
+                name.c_str(),
+                lldb_private::ClangUtil::GetQualType(compiler_type)
+                    .getAsString()
+                    .c_str(),
+                PrintType(value_type).c_str(), *value_size, value_alignment);
     }
 
     if (named_decl &&
@@ -1405,7 +1398,7 @@ bool IRForTarget::MaybeHandleVariable(Va
     }
   } else if (dyn_cast<llvm::Function>(llvm_value_ptr)) {
     if (log)
-      log->Printf("Function pointers aren't handled right now");
+      LLDB_LOGF(log, "Function pointers aren't handled right now");
 
     return false;
   }
@@ -1425,13 +1418,14 @@ bool IRForTarget::HandleSymbol(Value *sy
 
   if (symbol_addr == LLDB_INVALID_ADDRESS) {
     if (log)
-      log->Printf("Symbol \"%s\" had no address", name.GetCString());
+      LLDB_LOGF(log, "Symbol \"%s\" had no address", name.GetCString());
 
     return false;
   }
 
   if (log)
-    log->Printf("Found \"%s\" at 0x%" PRIx64, name.GetCString(), symbol_addr);
+    LLDB_LOGF(log, "Found \"%s\" at 0x%" PRIx64, name.GetCString(),
+              symbol_addr);
 
   Type *symbol_type = symbol->getType();
 
@@ -1441,8 +1435,8 @@ bool IRForTarget::HandleSymbol(Value *sy
       ConstantExpr::getIntToPtr(symbol_addr_int, symbol_type);
 
   if (log)
-    log->Printf("Replacing %s with %s", PrintValue(symbol).c_str(),
-                PrintValue(symbol_addr_ptr).c_str());
+    LLDB_LOGF(log, "Replacing %s with %s", PrintValue(symbol).c_str(),
+              PrintValue(symbol_addr_ptr).c_str());
 
   symbol->replaceAllUsesWith(symbol_addr_ptr);
 
@@ -1454,7 +1448,7 @@ bool IRForTarget::MaybeHandleCallArgumen
       lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
   if (log)
-    log->Printf("MaybeHandleCallArguments(%s)", PrintValue(Old).c_str());
+    LLDB_LOGF(log, "MaybeHandleCallArguments(%s)", PrintValue(Old).c_str());
 
   for (unsigned op_index = 0, num_ops = Old->getNumArgOperands();
        op_index < num_ops; ++op_index)
@@ -1494,8 +1488,8 @@ bool IRForTarget::HandleObjCClass(Value
       m_decl_map->GetSymbolAddress(name_cstr, lldb::eSymbolTypeObjCClass);
 
   if (log)
-    log->Printf("Found reference to Objective-C class %s (0x%llx)",
-                name_cstr.AsCString(), (unsigned long long)class_ptr);
+    LLDB_LOGF(log, "Found reference to Objective-C class %s (0x%llx)",
+              name_cstr.AsCString(), (unsigned long long)class_ptr);
 
   if (class_ptr == LLDB_INVALID_ADDRESS)
     return false;
@@ -1594,9 +1588,9 @@ bool IRForTarget::ResolveExternals(Funct
     std::string global_name = global_var.getName().str();
 
     if (log)
-      log->Printf("Examining %s, DeclForGlobalValue returns %p",
-                  global_name.c_str(),
-                  static_cast<void *>(DeclForGlobal(&global_var)));
+      LLDB_LOGF(log, "Examining %s, DeclForGlobalValue returns %p",
+                global_name.c_str(),
+                static_cast<void *>(DeclForGlobal(&global_var)));
 
     if (global_name.find("OBJC_IVAR") == 0) {
       if (!HandleSymbol(&global_var)) {
@@ -1838,7 +1832,7 @@ bool IRForTarget::ReplaceVariables(Funct
   m_decl_map->DoStructLayout();
 
   if (log)
-    log->Printf("Element arrangement:");
+    LLDB_LOGF(log, "Element arrangement:");
 
   uint32_t num_elements;
   uint32_t element_index;
@@ -1913,7 +1907,7 @@ bool IRForTarget::ReplaceVariables(Funct
   }
 
   if (log)
-    log->Printf("Arg: \"%s\"", PrintValue(argument).c_str());
+    LLDB_LOGF(log, "Arg: \"%s\"", PrintValue(argument).c_str());
 
   BasicBlock &entry_block(llvm_function.getEntryBlock());
   Instruction *FirstEntryInstruction(entry_block.getFirstNonPHIOrDbg());
@@ -1951,12 +1945,12 @@ bool IRForTarget::ReplaceVariables(Funct
     }
 
     if (log)
-      log->Printf("  \"%s\" (\"%s\") placed at %" PRIu64, name.GetCString(),
-                  decl->getNameAsString().c_str(), offset);
+      LLDB_LOGF(log, "  \"%s\" (\"%s\") placed at %" PRIu64, name.GetCString(),
+                decl->getNameAsString().c_str(), offset);
 
     if (value) {
       if (log)
-        log->Printf("    Replacing [%s]", PrintValue(value).c_str());
+        LLDB_LOGF(log, "    Replacing [%s]", PrintValue(value).c_str());
 
       FunctionValueCache body_result_maker(
           [this, name, offset_type, offset, argument,
@@ -2006,8 +2000,8 @@ bool IRForTarget::ReplaceVariables(Funct
             body_result_maker.GetValue(instruction->getParent()->getParent()));
       } else {
         if (log)
-          log->Printf("Unhandled non-constant type: \"%s\"",
-                      PrintValue(value).c_str());
+          LLDB_LOGF(log, "Unhandled non-constant type: \"%s\"",
+                    PrintValue(value).c_str());
         return false;
       }
 
@@ -2017,8 +2011,8 @@ bool IRForTarget::ReplaceVariables(Funct
   }
 
   if (log)
-    log->Printf("Total structure [align %" PRId64 ", size %" PRIu64 "]",
-                (int64_t)alignment, (uint64_t)size);
+    LLDB_LOGF(log, "Total structure [align %" PRId64 ", size %" PRIu64 "]",
+              (int64_t)alignment, (uint64_t)size);
 
   return true;
 }
@@ -2062,7 +2056,7 @@ bool IRForTarget::runOnModule(Module &ll
 
     oss.flush();
 
-    log->Printf("Module as passed in to IRForTarget: \n\"%s\"", s.c_str());
+    LLDB_LOGF(log, "Module as passed in to IRForTarget: \n\"%s\"", s.c_str());
   }
 
   Function *const main_function =
@@ -2071,8 +2065,8 @@ bool IRForTarget::runOnModule(Module &ll
 
   if (!m_func_name.IsEmpty() && !main_function) {
     if (log)
-      log->Printf("Couldn't find \"%s()\" in the module",
-                  m_func_name.AsCString());
+      LLDB_LOGF(log, "Couldn't find \"%s()\" in the module",
+                m_func_name.AsCString());
 
     m_error_stream.Printf("Internal error [IRForTarget]: Couldn't find wrapper "
                           "'%s' in the module",
@@ -2084,7 +2078,7 @@ bool IRForTarget::runOnModule(Module &ll
   if (main_function) {
     if (!FixFunctionLinkage(*main_function)) {
       if (log)
-        log->Printf("Couldn't fix the linkage for the function");
+        LLDB_LOGF(log, "Couldn't fix the linkage for the function");
 
       return false;
     }
@@ -2105,7 +2099,7 @@ bool IRForTarget::runOnModule(Module &ll
   if (main_function) {
     if (!CreateResultVariable(*main_function)) {
       if (log)
-        log->Printf("CreateResultVariable() failed");
+        LLDB_LOGF(log, "CreateResultVariable() failed");
 
       // CreateResultVariable() reports its own errors, so we don't do so here
 
@@ -2121,8 +2115,8 @@ bool IRForTarget::runOnModule(Module &ll
 
     oss.flush();
 
-    log->Printf("Module after creating the result variable: \n\"%s\"",
-                s.c_str());
+    LLDB_LOGF(log, "Module after creating the result variable: \n\"%s\"",
+              s.c_str());
   }
 
   for (Module::iterator fi = m_module->begin(), fe = m_module->end(); fi != fe;
@@ -2137,7 +2131,7 @@ bool IRForTarget::runOnModule(Module &ll
     for (bbi = function->begin(); bbi != function->end(); ++bbi) {
       if (!RemoveGuards(*bbi)) {
         if (log)
-          log->Printf("RemoveGuards() failed");
+          LLDB_LOGF(log, "RemoveGuards() failed");
 
         // RemoveGuards() reports its own errors, so we don't do so here
 
@@ -2146,7 +2140,7 @@ bool IRForTarget::runOnModule(Module &ll
 
       if (!RewritePersistentAllocs(*bbi)) {
         if (log)
-          log->Printf("RewritePersistentAllocs() failed");
+          LLDB_LOGF(log, "RewritePersistentAllocs() failed");
 
         // RewritePersistentAllocs() reports its own errors, so we don't do so
         // here
@@ -2156,7 +2150,7 @@ bool IRForTarget::runOnModule(Module &ll
 
       if (!RemoveCXAAtExit(*bbi)) {
         if (log)
-          log->Printf("RemoveCXAAtExit() failed");
+          LLDB_LOGF(log, "RemoveCXAAtExit() failed");
 
         // RemoveCXAAtExit() reports its own errors, so we don't do so here
 
@@ -2171,7 +2165,7 @@ bool IRForTarget::runOnModule(Module &ll
 
   if (!RewriteObjCConstStrings()) {
     if (log)
-      log->Printf("RewriteObjCConstStrings() failed");
+      LLDB_LOGF(log, "RewriteObjCConstStrings() failed");
 
     // RewriteObjCConstStrings() reports its own errors, so we don't do so here
 
@@ -2187,7 +2181,7 @@ bool IRForTarget::runOnModule(Module &ll
          bbi != bbe; ++bbi) {
       if (!RewriteObjCSelectors(*bbi)) {
         if (log)
-          log->Printf("RewriteObjCSelectors() failed");
+          LLDB_LOGF(log, "RewriteObjCSelectors() failed");
 
         // RewriteObjCSelectors() reports its own errors, so we don't do so
         // here
@@ -2197,7 +2191,7 @@ bool IRForTarget::runOnModule(Module &ll
 
       if (!RewriteObjCClassReferences(*bbi)) {
         if (log)
-          log->Printf("RewriteObjCClassReferences() failed");
+          LLDB_LOGF(log, "RewriteObjCClassReferences() failed");
 
         // RewriteObjCClasses() reports its own errors, so we don't do so here
 
@@ -2215,7 +2209,7 @@ bool IRForTarget::runOnModule(Module &ll
          bbi != bbe; ++bbi) {
       if (!ResolveCalls(*bbi)) {
         if (log)
-          log->Printf("ResolveCalls() failed");
+          LLDB_LOGF(log, "ResolveCalls() failed");
 
         // ResolveCalls() reports its own errors, so we don't do so here
 
@@ -2231,7 +2225,7 @@ bool IRForTarget::runOnModule(Module &ll
   if (main_function) {
     if (!ResolveExternals(*main_function)) {
       if (log)
-        log->Printf("ResolveExternals() failed");
+        LLDB_LOGF(log, "ResolveExternals() failed");
 
       // ResolveExternals() reports its own errors, so we don't do so here
 
@@ -2240,7 +2234,7 @@ bool IRForTarget::runOnModule(Module &ll
 
     if (!ReplaceVariables(*main_function)) {
       if (log)
-        log->Printf("ReplaceVariables() failed");
+        LLDB_LOGF(log, "ReplaceVariables() failed");
 
       // ReplaceVariables() reports its own errors, so we don't do so here
 
@@ -2256,7 +2250,7 @@ bool IRForTarget::runOnModule(Module &ll
 
     oss.flush();
 
-    log->Printf("Module after preparing for execution: \n\"%s\"", s.c_str());
+    LLDB_LOGF(log, "Module after preparing for execution: \n\"%s\"", s.c_str());
   }
 
   return true;

Modified: lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp (original)
+++ lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp Wed Jul 24 10:56:10 2019
@@ -177,8 +177,8 @@ void JITLoaderGDB::SetJITBreakpoint(lldb
     return;
 
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_JIT_LOADER));
-  if (log)
-    log->Printf("JITLoaderGDB::%s looking for JIT register hook", __FUNCTION__);
+  LLDB_LOGF(log, "JITLoaderGDB::%s looking for JIT register hook",
+            __FUNCTION__);
 
   addr_t jit_addr = GetSymbolAddress(
       module_list, ConstString("__jit_debug_register_code"), eSymbolTypeAny);
@@ -188,14 +188,12 @@ void JITLoaderGDB::SetJITBreakpoint(lldb
   m_jit_descriptor_addr = GetSymbolAddress(
       module_list, ConstString("__jit_debug_descriptor"), eSymbolTypeData);
   if (m_jit_descriptor_addr == LLDB_INVALID_ADDRESS) {
-    if (log)
-      log->Printf("JITLoaderGDB::%s failed to find JIT descriptor address",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "JITLoaderGDB::%s failed to find JIT descriptor address",
+              __FUNCTION__);
     return;
   }
 
-  if (log)
-    log->Printf("JITLoaderGDB::%s setting JIT breakpoint", __FUNCTION__);
+  LLDB_LOGF(log, "JITLoaderGDB::%s setting JIT breakpoint", __FUNCTION__);
 
   Breakpoint *bp =
       m_process->GetTarget().CreateBreakpoint(jit_addr, true, false).get();
@@ -211,8 +209,7 @@ bool JITLoaderGDB::JITDebugBreakpointHit
                                          user_id_t break_id,
                                          user_id_t break_loc_id) {
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_JIT_LOADER));
-  if (log)
-    log->Printf("JITLoaderGDB::%s hit JIT breakpoint", __FUNCTION__);
+  LLDB_LOGF(log, "JITLoaderGDB::%s hit JIT breakpoint", __FUNCTION__);
   JITLoaderGDB *instance = static_cast<JITLoaderGDB *>(baton);
   return instance->ReadJITDescriptor(false);
 }
@@ -285,9 +282,8 @@ bool JITLoaderGDB::ReadJITDescriptorImpl
   size_t bytes_read = m_process->DoReadMemory(m_jit_descriptor_addr, &jit_desc,
                                               jit_desc_size, error);
   if (bytes_read != jit_desc_size || !error.Success()) {
-    if (log)
-      log->Printf("JITLoaderGDB::%s failed to read JIT descriptor",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "JITLoaderGDB::%s failed to read JIT descriptor",
+              __FUNCTION__);
     return false;
   }
 
@@ -301,9 +297,8 @@ bool JITLoaderGDB::ReadJITDescriptorImpl
   while (jit_relevant_entry != 0) {
     jit_code_entry<ptr_t> jit_entry;
     if (!ReadJITEntry(jit_relevant_entry, m_process, &jit_entry)) {
-      if (log)
-        log->Printf("JITLoaderGDB::%s failed to read JIT entry at 0x%" PRIx64,
-                    __FUNCTION__, jit_relevant_entry);
+      LLDB_LOGF(log, "JITLoaderGDB::%s failed to read JIT entry at 0x%" PRIx64,
+                __FUNCTION__, jit_relevant_entry);
       return false;
     }
 
@@ -312,10 +307,10 @@ bool JITLoaderGDB::ReadJITDescriptorImpl
     ModuleSP module_sp;
 
     if (jit_action == JIT_REGISTER_FN) {
-      if (log)
-        log->Printf("JITLoaderGDB::%s registering JIT entry at 0x%" PRIx64
-                    " (%" PRIu64 " bytes)",
-                    __FUNCTION__, symbolfile_addr, (uint64_t)symbolfile_size);
+      LLDB_LOGF(log,
+                "JITLoaderGDB::%s registering JIT entry at 0x%" PRIx64
+                " (%" PRIu64 " bytes)",
+                __FUNCTION__, symbolfile_addr, (uint64_t)symbolfile_size);
 
       char jit_name[64];
       snprintf(jit_name, 64, "JIT(0x%" PRIx64 ")", symbolfile_addr);
@@ -357,15 +352,14 @@ bool JITLoaderGDB::ReadJITDescriptorImpl
         module_list.Append(module_sp);
         target.ModulesDidLoad(module_list);
       } else {
-        if (log)
-          log->Printf("JITLoaderGDB::%s failed to load module for "
-                      "JIT entry at 0x%" PRIx64,
-                      __FUNCTION__, symbolfile_addr);
+        LLDB_LOGF(log,
+                  "JITLoaderGDB::%s failed to load module for "
+                  "JIT entry at 0x%" PRIx64,
+                  __FUNCTION__, symbolfile_addr);
       }
     } else if (jit_action == JIT_UNREGISTER_FN) {
-      if (log)
-        log->Printf("JITLoaderGDB::%s unregistering JIT entry at 0x%" PRIx64,
-                    __FUNCTION__, symbolfile_addr);
+      LLDB_LOGF(log, "JITLoaderGDB::%s unregistering JIT entry at 0x%" PRIx64,
+                __FUNCTION__, symbolfile_addr);
 
       JITObjectMap::iterator it = m_jit_objects.find(symbolfile_addr);
       if (it != m_jit_objects.end()) {

Modified: lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp Wed Jul 24 10:56:10 2019
@@ -79,11 +79,10 @@ TypeAndOrName ItaniumABILanguageRuntime:
           if (name && strstr(name, vtable_demangled_prefix) == name) {
             Log *log(
                 lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
-            if (log)
-              log->Printf("0x%16.16" PRIx64
-                          ": static-type = '%s' has vtable symbol '%s'\n",
-                          original_ptr, in_value.GetTypeName().GetCString(),
-                          name);
+            LLDB_LOGF(log,
+                      "0x%16.16" PRIx64
+                      ": static-type = '%s' has vtable symbol '%s'\n",
+                      original_ptr, in_value.GetTypeName().GetCString(), name);
             // We are a C++ class, that's good.  Get the class name and look it
             // up:
             const char *class_name = name + strlen(vtable_demangled_prefix);
@@ -116,9 +115,8 @@ TypeAndOrName ItaniumABILanguageRuntime:
 
             lldb::TypeSP type_sp;
             if (num_matches == 0) {
-              if (log)
-                log->Printf("0x%16.16" PRIx64 ": is not dynamic\n",
-                            original_ptr);
+              LLDB_LOGF(log, "0x%16.16" PRIx64 ": is not dynamic\n",
+                        original_ptr);
               return TypeAndOrName();
             }
             if (num_matches == 1) {
@@ -126,13 +124,13 @@ TypeAndOrName ItaniumABILanguageRuntime:
               if (type_sp) {
                 if (ClangASTContext::IsCXXClassType(
                         type_sp->GetForwardCompilerType())) {
-                  if (log)
-                    log->Printf(
-                        "0x%16.16" PRIx64
-                        ": static-type = '%s' has dynamic type: uid={0x%" PRIx64
-                        "}, type-name='%s'\n",
-                        original_ptr, in_value.GetTypeName().AsCString(),
-                        type_sp->GetID(), type_sp->GetName().GetCString());
+                  LLDB_LOGF(
+                      log,
+                      "0x%16.16" PRIx64
+                      ": static-type = '%s' has dynamic type: uid={0x%" PRIx64
+                      "}, type-name='%s'\n",
+                      original_ptr, in_value.GetTypeName().AsCString(),
+                      type_sp->GetID(), type_sp->GetName().GetCString());
                   type_info.SetTypeSP(type_sp);
                 }
               }
@@ -142,13 +140,13 @@ TypeAndOrName ItaniumABILanguageRuntime:
                 for (i = 0; i < num_matches; i++) {
                   type_sp = class_types.GetTypeAtIndex(i);
                   if (type_sp) {
-                    if (log)
-                      log->Printf(
-                          "0x%16.16" PRIx64
-                          ": static-type = '%s' has multiple matching dynamic "
-                          "types: uid={0x%" PRIx64 "}, type-name='%s'\n",
-                          original_ptr, in_value.GetTypeName().AsCString(),
-                          type_sp->GetID(), type_sp->GetName().GetCString());
+                    LLDB_LOGF(
+                        log,
+                        "0x%16.16" PRIx64
+                        ": static-type = '%s' has multiple matching dynamic "
+                        "types: uid={0x%" PRIx64 "}, type-name='%s'\n",
+                        original_ptr, in_value.GetTypeName().AsCString(),
+                        type_sp->GetID(), type_sp->GetName().GetCString());
                   }
                 }
               }
@@ -158,25 +156,24 @@ TypeAndOrName ItaniumABILanguageRuntime:
                 if (type_sp) {
                   if (ClangASTContext::IsCXXClassType(
                           type_sp->GetForwardCompilerType())) {
-                    if (log)
-                      log->Printf(
-                          "0x%16.16" PRIx64 ": static-type = '%s' has multiple "
-                                            "matching dynamic types, picking "
-                                            "this one: uid={0x%" PRIx64
-                          "}, type-name='%s'\n",
-                          original_ptr, in_value.GetTypeName().AsCString(),
-                          type_sp->GetID(), type_sp->GetName().GetCString());
+                    LLDB_LOGF(
+                        log,
+                        "0x%16.16" PRIx64 ": static-type = '%s' has multiple "
+                        "matching dynamic types, picking "
+                        "this one: uid={0x%" PRIx64 "}, type-name='%s'\n",
+                        original_ptr, in_value.GetTypeName().AsCString(),
+                        type_sp->GetID(), type_sp->GetName().GetCString());
                     type_info.SetTypeSP(type_sp);
                   }
                 }
               }
 
               if (log && i == num_matches) {
-                log->Printf(
-                    "0x%16.16" PRIx64
-                    ": static-type = '%s' has multiple matching dynamic "
-                    "types, didn't find a C++ match\n",
-                    original_ptr, in_value.GetTypeName().AsCString());
+                LLDB_LOGF(log,
+                          "0x%16.16" PRIx64
+                          ": static-type = '%s' has multiple matching dynamic "
+                          "types, didn't find a C++ match\n",
+                          original_ptr, in_value.GetTypeName().AsCString());
               }
             }
             if (type_info)

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp Wed Jul 24 10:56:10 2019
@@ -38,12 +38,13 @@ public:
         LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
 
     if (log) {
-      log->Printf("AppleObjCExternalASTSource::FindExternalVisibleDeclsByName[%"
-                  "u] on (ASTContext*)%p Looking for %s in (%sDecl*)%p",
-                  current_id,
-                  static_cast<void *>(&decl_ctx->getParentASTContext()),
-                  name.getAsString().c_str(), decl_ctx->getDeclKindName(),
-                  static_cast<const void *>(decl_ctx));
+      LLDB_LOGF(log,
+                "AppleObjCExternalASTSource::FindExternalVisibleDeclsByName[%"
+                "u] on (ASTContext*)%p Looking for %s in (%sDecl*)%p",
+                current_id,
+                static_cast<void *>(&decl_ctx->getParentASTContext()),
+                name.getAsString().c_str(), decl_ctx->getDeclKindName(),
+                static_cast<const void *>(decl_ctx));
     }
 
     do {
@@ -77,19 +78,20 @@ public:
         LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
 
     if (log) {
-      log->Printf("AppleObjCExternalASTSource::CompleteType[%u] on "
-                  "(ASTContext*)%p Completing (TagDecl*)%p named %s",
-                  current_id, static_cast<void *>(&tag_decl->getASTContext()),
-                  static_cast<void *>(tag_decl),
-                  tag_decl->getName().str().c_str());
+      LLDB_LOGF(log,
+                "AppleObjCExternalASTSource::CompleteType[%u] on "
+                "(ASTContext*)%p Completing (TagDecl*)%p named %s",
+                current_id, static_cast<void *>(&tag_decl->getASTContext()),
+                static_cast<void *>(tag_decl),
+                tag_decl->getName().str().c_str());
 
-      log->Printf("  AOEAS::CT[%u] Before:", current_id);
+      LLDB_LOGF(log, "  AOEAS::CT[%u] Before:", current_id);
       ASTDumper dumper((clang::Decl *)tag_decl);
       dumper.ToLog(log, "    [CT] ");
     }
 
     if (log) {
-      log->Printf("  AOEAS::CT[%u] After:", current_id);
+      LLDB_LOGF(log, "  AOEAS::CT[%u] After:", current_id);
       ASTDumper dumper((clang::Decl *)tag_decl);
       dumper.ToLog(log, "    [CT] ");
     }
@@ -104,14 +106,15 @@ public:
         LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
 
     if (log) {
-      log->Printf("AppleObjCExternalASTSource::CompleteType[%u] on "
-                  "(ASTContext*)%p Completing (ObjCInterfaceDecl*)%p named %s",
-                  current_id,
-                  static_cast<void *>(&interface_decl->getASTContext()),
-                  static_cast<void *>(interface_decl),
-                  interface_decl->getName().str().c_str());
+      LLDB_LOGF(log,
+                "AppleObjCExternalASTSource::CompleteType[%u] on "
+                "(ASTContext*)%p Completing (ObjCInterfaceDecl*)%p named %s",
+                current_id,
+                static_cast<void *>(&interface_decl->getASTContext()),
+                static_cast<void *>(interface_decl),
+                interface_decl->getName().str().c_str());
 
-      log->Printf("  AOEAS::CT[%u] Before:", current_id);
+      LLDB_LOGF(log, "  AOEAS::CT[%u] Before:", current_id);
       ASTDumper dumper((clang::Decl *)interface_decl);
       dumper.ToLog(log, "    [CT] ");
     }
@@ -119,7 +122,7 @@ public:
     m_decl_vendor.FinishDecl(interface_decl);
 
     if (log) {
-      log->Printf("  [CT] After:");
+      LLDB_LOGF(log, "  [CT] After:");
       ASTDumper dumper((clang::Decl *)interface_decl);
       dumper.ToLog(log, "    [CT] ");
     }
@@ -462,8 +465,7 @@ bool AppleObjCDeclVendor::FinishDecl(cla
     clang::ObjCMethodDecl *method_decl =
         method_type.BuildMethod(interface_decl, name, true, m_type_realizer_sp);
 
-    if (log)
-      log->Printf("[  AOTV::FD] Instance method [%s] [%s]", name, types);
+    LLDB_LOGF(log, "[  AOTV::FD] Instance method [%s] [%s]", name, types);
 
     if (method_decl)
       interface_decl->addDecl(method_decl);
@@ -481,8 +483,7 @@ bool AppleObjCDeclVendor::FinishDecl(cla
     clang::ObjCMethodDecl *method_decl = method_type.BuildMethod(
         interface_decl, name, false, m_type_realizer_sp);
 
-    if (log)
-      log->Printf("[  AOTV::FD] Class method [%s] [%s]", name, types);
+    LLDB_LOGF(log, "[  AOTV::FD] Class method [%s] [%s]", name, types);
 
     if (method_decl)
       interface_decl->addDecl(method_decl);
@@ -498,10 +499,9 @@ bool AppleObjCDeclVendor::FinishDecl(cla
 
     const bool for_expression = false;
 
-    if (log)
-      log->Printf(
-          "[  AOTV::FD] Instance variable [%s] [%s], offset at %" PRIx64, name,
-          type, offset_ptr);
+    LLDB_LOGF(log,
+              "[  AOTV::FD] Instance variable [%s] [%s], offset at %" PRIx64,
+              name, type, offset_ptr);
 
     CompilerType ivar_type = m_runtime.GetEncodingToType()->RealizeType(
         m_ast_ctx, type, for_expression);
@@ -527,9 +527,10 @@ bool AppleObjCDeclVendor::FinishDecl(cla
   if (log) {
     ASTDumper method_dumper((clang::Decl *)interface_decl);
 
-    log->Printf("[AppleObjCDeclVendor::FinishDecl] Finishing Objective-C "
-                "interface for %s",
-                descriptor->GetClassName().AsCString());
+    LLDB_LOGF(log,
+              "[AppleObjCDeclVendor::FinishDecl] Finishing Objective-C "
+              "interface for %s",
+              descriptor->GetClassName().AsCString());
   }
 
   if (!descriptor->Describe(superclass_func, instance_method_func,
@@ -539,7 +540,8 @@ bool AppleObjCDeclVendor::FinishDecl(cla
   if (log) {
     ASTDumper method_dumper((clang::Decl *)interface_decl);
 
-    log->Printf(
+    LLDB_LOGF(
+        log,
         "[AppleObjCDeclVendor::FinishDecl] Finished Objective-C interface");
 
     method_dumper.ToLog(log, "  [AOTV::FD] ");
@@ -558,10 +560,9 @@ AppleObjCDeclVendor::FindDecls(ConstStri
   Log *log(GetLogIfAllCategoriesSet(
       LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
 
-  if (log)
-    log->Printf("AppleObjCDeclVendor::FindDecls [%u] ('%s', %s, %u, )",
-                current_id, (const char *)name.AsCString(),
-                append ? "true" : "false", max_matches);
+  LLDB_LOGF(log, "AppleObjCDeclVendor::FindDecls [%u] ('%s', %s, %u, )",
+            current_id, (const char *)name.AsCString(),
+            append ? "true" : "false", max_matches);
 
   if (!append)
     decls.clear();
@@ -595,24 +596,25 @@ AppleObjCDeclVendor::FindDecls(ConstStri
           if (metadata)
             isa_value = metadata->GetISAPtr();
 
-          log->Printf("AOCTV::FT [%u] Found %s (isa 0x%" PRIx64
-                      ") in the ASTContext",
-                      current_id, dumper.GetCString(), isa_value);
+          LLDB_LOGF(log,
+                    "AOCTV::FT [%u] Found %s (isa 0x%" PRIx64
+                    ") in the ASTContext",
+                    current_id, dumper.GetCString(), isa_value);
         }
 
         decls.push_back(result_iface_decl);
         ret++;
         break;
       } else {
-        if (log)
-          log->Printf("AOCTV::FT [%u] There's something in the ASTContext, but "
-                      "it's not something we know about",
-                      current_id);
+        LLDB_LOGF(log,
+                  "AOCTV::FT [%u] There's something in the ASTContext, but "
+                  "it's not something we know about",
+                  current_id);
         break;
       }
     } else if (log) {
-      log->Printf("AOCTV::FT [%u] Couldn't find %s in the ASTContext",
-                  current_id, name.AsCString());
+      LLDB_LOGF(log, "AOCTV::FT [%u] Couldn't find %s in the ASTContext",
+                current_id, name.AsCString());
     }
 
     // It's not.  If it exists, we have to put it into our ASTContext.
@@ -620,8 +622,7 @@ AppleObjCDeclVendor::FindDecls(ConstStri
     ObjCLanguageRuntime::ObjCISA isa = m_runtime.GetISA(name);
 
     if (!isa) {
-      if (log)
-        log->Printf("AOCTV::FT [%u] Couldn't find the isa", current_id);
+      LLDB_LOGF(log, "AOCTV::FT [%u] Couldn't find the isa", current_id);
 
       break;
     }
@@ -629,10 +630,10 @@ AppleObjCDeclVendor::FindDecls(ConstStri
     clang::ObjCInterfaceDecl *iface_decl = GetDeclForISA(isa);
 
     if (!iface_decl) {
-      if (log)
-        log->Printf("AOCTV::FT [%u] Couldn't get the Objective-C interface for "
-                    "isa 0x%" PRIx64,
-                    current_id, (uint64_t)isa);
+      LLDB_LOGF(log,
+                "AOCTV::FT [%u] Couldn't get the Objective-C interface for "
+                "isa 0x%" PRIx64,
+                current_id, (uint64_t)isa);
 
       break;
     }
@@ -641,8 +642,8 @@ AppleObjCDeclVendor::FindDecls(ConstStri
       clang::QualType new_iface_type =
           ast_ctx->getObjCInterfaceType(iface_decl);
       ASTDumper dumper(new_iface_type);
-      log->Printf("AOCTV::FT [%u] Created %s (isa 0x%" PRIx64 ")", current_id,
-                  dumper.GetCString(), (uint64_t)isa);
+      LLDB_LOGF(log, "AOCTV::FT [%u] Created %s (isa 0x%" PRIx64 ")",
+                current_id, dumper.GetCString(), (uint64_t)isa);
     }
 
     decls.push_back(iface_decl);

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp Wed Jul 24 10:56:10 2019
@@ -395,10 +395,11 @@ void AppleObjCRuntimeV1::UpdateISAToDesc
                         new ClassDescriptorV1(isa, process_sp));
 
                     if (log && log->GetVerbose())
-                      log->Printf("AppleObjCRuntimeV1 added (ObjCISA)0x%" PRIx64
-                                  " from _objc_debug_class_hash to "
-                                  "isa->descriptor cache",
-                                  isa);
+                      LLDB_LOGF(log,
+                                "AppleObjCRuntimeV1 added (ObjCISA)0x%" PRIx64
+                                " from _objc_debug_class_hash to "
+                                "isa->descriptor cache",
+                                isa);
 
                     AddClass(isa, descriptor_sp);
                   }
@@ -417,7 +418,8 @@ void AppleObjCRuntimeV1::UpdateISAToDesc
                           new ClassDescriptorV1(isa, process_sp));
 
                       if (log && log->GetVerbose())
-                        log->Printf(
+                        LLDB_LOGF(
+                            log,
                             "AppleObjCRuntimeV1 added (ObjCISA)0x%" PRIx64
                             " from _objc_debug_class_hash to isa->descriptor "
                             "cache",

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Wed Jul 24 10:56:10 2019
@@ -1209,11 +1209,11 @@ AppleObjCRuntimeV2::GetClassDescriptor(V
           objc_class_sp = GetClassDescriptorFromISA(isa);
           if (isa && !objc_class_sp) {
             Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-            if (log)
-              log->Printf("0x%" PRIx64
-                          ": AppleObjCRuntimeV2::GetClassDescriptor() ISA was "
-                          "not in class descriptor cache 0x%" PRIx64,
-                          isa_pointer, isa);
+            LLDB_LOGF(log,
+                      "0x%" PRIx64
+                      ": AppleObjCRuntimeV2::GetClassDescriptor() ISA was "
+                      "not in class descriptor cache 0x%" PRIx64,
+                      isa_pointer, isa);
           }
         }
       }
@@ -1317,8 +1317,7 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
   // Read the total number of classes from the hash table
   const uint32_t num_classes = hash_table.GetCount();
   if (num_classes == 0) {
-    if (log)
-      log->Printf("No dynamic classes found in gdb_objc_realized_classes.");
+    LLDB_LOGF(log, "No dynamic classes found in gdb_objc_realized_classes.");
     return DescriptorMapUpdateResult::Success(0);
   }
 
@@ -1337,17 +1336,16 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
         g_get_dynamic_class_info_body, eLanguageTypeObjC,
         g_get_dynamic_class_info_name, error));
     if (error.Fail()) {
-      if (log)
-        log->Printf(
-            "Failed to get Utility Function for implementation lookup: %s",
-            error.AsCString());
+      LLDB_LOGF(log,
+                "Failed to get Utility Function for implementation lookup: %s",
+                error.AsCString());
       m_get_class_info_code.reset();
     } else {
       diagnostics.Clear();
 
       if (!m_get_class_info_code->Install(diagnostics, exe_ctx)) {
         if (log) {
-          log->Printf("Failed to install implementation lookup");
+          LLDB_LOGF(log, "Failed to install implementation lookup");
           diagnostics.Dump(log);
         }
         m_get_class_info_code.reset();
@@ -1372,17 +1370,16 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
         clang_uint32_t_type, arguments, thread_sp, error);
 
     if (error.Fail()) {
-      if (log)
-        log->Printf(
-            "Failed to make function caller for implementation lookup: %s.",
-            error.AsCString());
+      LLDB_LOGF(log,
+                "Failed to make function caller for implementation lookup: %s.",
+                error.AsCString());
       return DescriptorMapUpdateResult::Fail();
     }
   } else {
     get_class_info_function = m_get_class_info_code->GetFunctionCaller();
     if (!get_class_info_function) {
       if (log) {
-        log->Printf("Failed to get implementation lookup function caller.");
+        LLDB_LOGF(log, "Failed to get implementation lookup function caller.");
         diagnostics.Dump(log);
       }
 
@@ -1399,10 +1396,10 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
       class_infos_byte_size, ePermissionsReadable | ePermissionsWritable, err);
 
   if (class_infos_addr == LLDB_INVALID_ADDRESS) {
-    if (log)
-      log->Printf("unable to allocate %" PRIu32
-                  " bytes in process for shared cache read",
-                  class_infos_byte_size);
+    LLDB_LOGF(log,
+              "unable to allocate %" PRIu32
+              " bytes in process for shared cache read",
+              class_infos_byte_size);
     return DescriptorMapUpdateResult::Fail();
   }
 
@@ -1451,8 +1448,7 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
     if (results == eExpressionCompleted) {
       // The result is the number of ClassInfo structures that were filled in
       num_class_infos = return_value.GetScalar().ULong();
-      if (log)
-        log->Printf("Discovered %u ObjC classes\n", num_class_infos);
+      LLDB_LOGF(log, "Discovered %u ObjC classes\n", num_class_infos);
       if (num_class_infos > 0) {
         // Read the ClassInfo structures
         DataBufferHeap buffer(num_class_infos * class_info_byte_size, 0);
@@ -1468,13 +1464,13 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
       success = true;
     } else {
       if (log) {
-        log->Printf("Error evaluating our find class name function.");
+        LLDB_LOGF(log, "Error evaluating our find class name function.");
         diagnostics.Dump(log);
       }
     }
   } else {
     if (log) {
-      log->Printf("Error writing function arguments.");
+      LLDB_LOGF(log, "Error writing function arguments.");
       diagnostics.Dump(log);
     }
   }
@@ -1507,17 +1503,18 @@ uint32_t AppleObjCRuntimeV2::ParseClassI
 
     if (isa == 0) {
       if (should_log)
-        log->Printf(
-            "AppleObjCRuntimeV2 found NULL isa, ignoring this class info");
+        LLDB_LOGF(
+            log, "AppleObjCRuntimeV2 found NULL isa, ignoring this class info");
       continue;
     }
     // Check if we already know about this ISA, if we do, the info will never
     // change, so we can just skip it.
     if (ISAIsCached(isa)) {
       if (should_log)
-        log->Printf("AppleObjCRuntimeV2 found cached isa=0x%" PRIx64
-                    ", ignoring this class info",
-                    isa);
+        LLDB_LOGF(log,
+                  "AppleObjCRuntimeV2 found cached isa=0x%" PRIx64
+                  ", ignoring this class info",
+                  isa);
       offset += 4;
     } else {
       // Read the 32 bit hash for the class name
@@ -1536,15 +1533,16 @@ uint32_t AppleObjCRuntimeV2::ParseClassI
         AddClass(isa, descriptor_sp, descriptor_sp->GetClassName().AsCString(nullptr));
       num_parsed++;
       if (should_log)
-        log->Printf("AppleObjCRuntimeV2 added isa=0x%" PRIx64
-                    ", hash=0x%8.8x, name=%s",
-                    isa, name_hash,
-                    descriptor_sp->GetClassName().AsCString("<unknown>"));
+        LLDB_LOGF(log,
+                  "AppleObjCRuntimeV2 added isa=0x%" PRIx64
+                  ", hash=0x%8.8x, name=%s",
+                  isa, name_hash,
+                  descriptor_sp->GetClassName().AsCString("<unknown>"));
     }
   }
   if (should_log)
-    log->Printf("AppleObjCRuntimeV2 parsed %" PRIu32 " class infos",
-                num_parsed);
+    LLDB_LOGF(log, "AppleObjCRuntimeV2 parsed %" PRIu32 " class infos",
+              num_parsed);
   return num_parsed;
 }
 
@@ -1646,17 +1644,16 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
             shared_class_expression.c_str(), eLanguageTypeObjC,
             g_get_shared_cache_class_info_name, error));
     if (error.Fail()) {
-      if (log)
-        log->Printf(
-            "Failed to get Utility function for implementation lookup: %s.",
-            error.AsCString());
+      LLDB_LOGF(log,
+                "Failed to get Utility function for implementation lookup: %s.",
+                error.AsCString());
       m_get_shared_cache_class_info_code.reset();
     } else {
       diagnostics.Clear();
 
       if (!m_get_shared_cache_class_info_code->Install(diagnostics, exe_ctx)) {
         if (log) {
-          log->Printf("Failed to install implementation lookup.");
+          LLDB_LOGF(log, "Failed to install implementation lookup.");
           diagnostics.Dump(log);
         }
         m_get_shared_cache_class_info_code.reset();
@@ -1703,10 +1700,10 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
       class_infos_byte_size, ePermissionsReadable | ePermissionsWritable, err);
 
   if (class_infos_addr == LLDB_INVALID_ADDRESS) {
-    if (log)
-      log->Printf("unable to allocate %" PRIu32
-                  " bytes in process for shared cache read",
-                  class_infos_byte_size);
+    LLDB_LOGF(log,
+              "unable to allocate %" PRIu32
+              " bytes in process for shared cache read",
+              class_infos_byte_size);
     return DescriptorMapUpdateResult::Fail();
   }
 
@@ -1757,9 +1754,8 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
     if (results == eExpressionCompleted) {
       // The result is the number of ClassInfo structures that were filled in
       num_class_infos = return_value.GetScalar().ULong();
-      if (log)
-        log->Printf("Discovered %u ObjC classes in shared cache\n",
-                    num_class_infos);
+      LLDB_LOGF(log, "Discovered %u ObjC classes in shared cache\n",
+                num_class_infos);
       assert(num_class_infos <= num_classes);
       if (num_class_infos > 0) {
         if (num_class_infos > num_classes) {
@@ -1786,13 +1782,13 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
       }
     } else {
       if (log) {
-        log->Printf("Error evaluating our find class name function.");
+        LLDB_LOGF(log, "Error evaluating our find class name function.");
         diagnostics.Dump(log);
       }
     }
   } else {
     if (log) {
-      log->Printf("Error writing function arguments.");
+      LLDB_LOGF(log, "Error writing function arguments.");
       diagnostics.Dump(log);
     }
   }
@@ -1827,9 +1823,10 @@ bool AppleObjCRuntimeV2::UpdateISAToDesc
           new ClassDescriptorV2(*this, elt.second, elt.first.AsCString()));
 
       if (log && log->GetVerbose())
-        log->Printf("AppleObjCRuntimeV2 added (ObjCISA)0x%" PRIx64
-                    " (%s) from dynamic table to isa->descriptor cache",
-                    elt.second, elt.first.AsCString());
+        LLDB_LOGF(log,
+                  "AppleObjCRuntimeV2 added (ObjCISA)0x%" PRIx64
+                  " (%s) from dynamic table to isa->descriptor cache",
+                  elt.second, elt.first.AsCString());
 
       AddClass(elt.second, descriptor_sp, elt.first.AsCString());
     }
@@ -1912,14 +1909,14 @@ void AppleObjCRuntimeV2::UpdateISAToDesc
       DescriptorMapUpdateResult shared_cache_update_result =
           UpdateISAToDescriptorMapSharedCache();
 
-      if (log)
-        log->Printf("attempted to read objc class data - results: "
-                    "[dynamic_update]: ran: %s, count: %" PRIu32
-                    " [shared_cache_update]: ran: %s, count: %" PRIu32,
-                    dynamic_update_result.m_update_ran ? "yes" : "no",
-                    dynamic_update_result.m_num_found,
-                    shared_cache_update_result.m_update_ran ? "yes" : "no",
-                    shared_cache_update_result.m_num_found);
+      LLDB_LOGF(log,
+                "attempted to read objc class data - results: "
+                "[dynamic_update]: ran: %s, count: %" PRIu32
+                " [shared_cache_update]: ran: %s, count: %" PRIu32,
+                dynamic_update_result.m_update_ran ? "yes" : "no",
+                dynamic_update_result.m_num_found,
+                shared_cache_update_result.m_update_ran ? "yes" : "no",
+                shared_cache_update_result.m_num_found);
 
       // warn if:
       // - we could not run either expression
@@ -2516,8 +2513,7 @@ bool AppleObjCRuntimeV2::NonPointerISACa
     ObjCISA isa, ObjCISA &ret_isa) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES));
 
-  if (log)
-    log->Printf("AOCRT::NPI Evalulate(isa = 0x%" PRIx64 ")", (uint64_t)isa);
+  LLDB_LOGF(log, "AOCRT::NPI Evalulate(isa = 0x%" PRIx64 ")", (uint64_t)isa);
 
   if ((isa & ~m_objc_debug_isa_class_mask) == 0)
     return false;
@@ -2543,10 +2539,10 @@ bool AppleObjCRuntimeV2::NonPointerISACa
       // read the count again, and update the cache if the count has been
       // updated.
       if (index > m_indexed_isa_cache.size()) {
-        if (log)
-          log->Printf("AOCRT::NPI (index = %" PRIu64
-                      ") exceeds cache (size = %" PRIu64 ")",
-                      (uint64_t)index, (uint64_t)m_indexed_isa_cache.size());
+        LLDB_LOGF(log,
+                  "AOCRT::NPI (index = %" PRIu64
+                  ") exceeds cache (size = %" PRIu64 ")",
+                  (uint64_t)index, (uint64_t)m_indexed_isa_cache.size());
 
         Process *process(m_runtime.GetProcess());
 
@@ -2561,9 +2557,8 @@ bool AppleObjCRuntimeV2::NonPointerISACa
         if (error.Fail())
           return false;
 
-        if (log)
-          log->Printf("AOCRT::NPI (new class count = %" PRIu64 ")",
-                      (uint64_t)objc_indexed_classes_count);
+        LLDB_LOGF(log, "AOCRT::NPI (new class count = %" PRIu64 ")",
+                  (uint64_t)objc_indexed_classes_count);
 
         if (objc_indexed_classes_count > m_indexed_isa_cache.size()) {
           // Read the class entries we don't have.  We should just read all of
@@ -2581,9 +2576,8 @@ bool AppleObjCRuntimeV2::NonPointerISACa
           if (error.Fail() || bytes_read != buffer.GetByteSize())
             return false;
 
-          if (log)
-            log->Printf("AOCRT::NPI (read new classes count = %" PRIu64 ")",
-                        (uint64_t)num_new_classes);
+          LLDB_LOGF(log, "AOCRT::NPI (read new classes count = %" PRIu64 ")",
+                    (uint64_t)num_new_classes);
 
           // Append the new entries to the existing cache.
           DataExtractor data(buffer.GetBytes(), buffer.GetByteSize(),
@@ -2600,9 +2594,8 @@ bool AppleObjCRuntimeV2::NonPointerISACa
       if (index > m_indexed_isa_cache.size())
         return false;
 
-      if (log)
-        log->Printf("AOCRT::NPI Evalulate(ret_isa = 0x%" PRIx64 ")",
-                    (uint64_t)m_indexed_isa_cache[index]);
+      LLDB_LOGF(log, "AOCRT::NPI Evalulate(ret_isa = 0x%" PRIx64 ")",
+                (uint64_t)m_indexed_isa_cache[index]);
 
       ret_isa = m_indexed_isa_cache[index];
       return (ret_isa != 0); // this is a pointer so 0 is not a valid value

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=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp Wed Jul 24 10:56:10 2019
@@ -593,7 +593,7 @@ bool AppleObjCTrampolineHandler::AppleOb
     if (log) {
       StreamString s;
       m_regions.back().Dump(s);
-      log->Printf("Read vtable region: \n%s", s.GetData());
+      LLDB_LOGF(log, "Read vtable region: \n%s", s.GetData());
     }
 
     next_region = m_regions.back().GetNextRegionAddr();
@@ -779,25 +779,24 @@ AppleObjCTrampolineHandler::SetupDispatc
             m_lookup_implementation_function_code, eLanguageTypeObjC,
             g_lookup_implementation_function_name, error));
         if (error.Fail()) {
-          if (log)
-            log->Printf(
-                "Failed to get Utility Function for implementation lookup: %s.",
-                error.AsCString());
+          LLDB_LOGF(
+              log,
+              "Failed to get Utility Function for implementation lookup: %s.",
+              error.AsCString());
           m_impl_code.reset();
           return args_addr;
         }
 
         if (!m_impl_code->Install(diagnostics, exe_ctx)) {
           if (log) {
-            log->Printf("Failed to install implementation lookup.");
+            LLDB_LOGF(log, "Failed to install implementation lookup.");
             diagnostics.Dump(log);
           }
           m_impl_code.reset();
           return args_addr;
         }
       } else {
-        if (log)
-          log->Printf("No method lookup implementation code.");
+        LLDB_LOGF(log, "No method lookup implementation code.");
         return LLDB_INVALID_ADDRESS;
       }
 
@@ -811,10 +810,9 @@ AppleObjCTrampolineHandler::SetupDispatc
       impl_function_caller = m_impl_code->MakeFunctionCaller(
           clang_void_ptr_type, dispatch_values, thread_sp, error);
       if (error.Fail()) {
-        if (log)
-          log->Printf(
-              "Error getting function caller for dispatch lookup: \"%s\".",
-              error.AsCString());
+        LLDB_LOGF(log,
+                  "Error getting function caller for dispatch lookup: \"%s\".",
+                  error.AsCString());
         return args_addr;
       }
     } else {
@@ -833,7 +831,7 @@ AppleObjCTrampolineHandler::SetupDispatc
   if (!impl_function_caller->WriteFunctionArguments(
           exe_ctx, args_addr, dispatch_values, diagnostics)) {
     if (log) {
-      log->Printf("Error writing function arguments.");
+      LLDB_LOGF(log, "Error writing function arguments.");
       diagnostics.Dump(log);
     }
     return args_addr;
@@ -934,9 +932,9 @@ AppleObjCTrampolineHandler::GetStepThrou
     lldb::addr_t obj_addr =
         argument_values.GetValueAtIndex(obj_index)->GetScalar().ULongLong();
     if (obj_addr == 0x0) {
-      if (log)
-        log->Printf(
-            "Asked to step to dispatch to nil object, returning empty plan.");
+      LLDB_LOGF(
+          log,
+          "Asked to step to dispatch to nil object, returning empty plan.");
       return ret_plan_sp;
     }
 
@@ -976,13 +974,11 @@ AppleObjCTrampolineHandler::GetStepThrou
           if (super_value.GetScalar().IsValid())
             isa_addr = super_value.GetScalar().ULongLong();
           else {
-            if (log)
-              log->Printf("Failed to extract the super class value from the "
-                          "class in objc_super.");
+            LLDB_LOGF(log, "Failed to extract the super class value from the "
+                           "class in objc_super.");
           }
         } else {
-          if (log)
-            log->Printf("Failed to extract the class value from objc_super.");
+          LLDB_LOGF(log, "Failed to extract the class value from objc_super.");
         }
       } else {
         // In the objc_msgSendSuper case, we don't get the object
@@ -998,8 +994,7 @@ AppleObjCTrampolineHandler::GetStepThrou
         if (super_value.GetScalar().IsValid()) {
           isa_addr = super_value.GetScalar().ULongLong();
         } else {
-          if (log)
-            log->Printf("Failed to extract the class value from objc_super.");
+          LLDB_LOGF(log, "Failed to extract the class value from objc_super.");
         }
       }
     } else {
@@ -1022,8 +1017,7 @@ AppleObjCTrampolineHandler::GetStepThrou
       if (isa_value.GetScalar().IsValid()) {
         isa_addr = isa_value.GetScalar().ULongLong();
       } else {
-        if (log)
-          log->Printf("Failed to extract the isa value from object.");
+        LLDB_LOGF(log, "Failed to extract the isa value from object.");
       }
     }
 
@@ -1033,9 +1027,10 @@ AppleObjCTrampolineHandler::GetStepThrou
 
     if (isa_addr != LLDB_INVALID_ADDRESS) {
       if (log) {
-        log->Printf("Resolving call for class - 0x%" PRIx64
-                    " and selector - 0x%" PRIx64,
-                    isa_addr, sel_addr);
+        LLDB_LOGF(log,
+                  "Resolving call for class - 0x%" PRIx64
+                  " and selector - 0x%" PRIx64,
+                  isa_addr, sel_addr);
       }
       ObjCLanguageRuntime *objc_runtime =
           ObjCLanguageRuntime::Get(*thread.GetProcess());
@@ -1047,9 +1042,8 @@ AppleObjCTrampolineHandler::GetStepThrou
     if (impl_addr != LLDB_INVALID_ADDRESS) {
       // Yup, it was in the cache, so we can run to that address directly.
 
-      if (log)
-        log->Printf("Found implementation address in cache: 0x%" PRIx64,
-                    impl_addr);
+      LLDB_LOGF(log, "Found implementation address in cache: 0x%" PRIx64,
+                impl_addr);
 
       ret_plan_sp = std::make_shared<ThreadPlanRunToAddress>(thread, impl_addr,
                                                              stop_others);
@@ -1137,7 +1131,7 @@ AppleObjCTrampolineHandler::GetStepThrou
       if (log) {
         StreamString s;
         ret_plan_sp->GetDescription(&s, eDescriptionLevelFull);
-        log->Printf("Using ObjC step plan: %s.\n", s.GetData());
+        LLDB_LOGF(log, "Using ObjC step plan: %s.\n", s.GetData());
       }
     }
   }

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=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp Wed Jul 24 10:56:10 2019
@@ -141,17 +141,15 @@ bool AppleThreadPlanStepThroughObjCTramp
     target_so_addr.SetOpcodeLoadAddress(target_addr, exc_ctx.GetTargetPtr());
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
     if (target_addr == 0) {
-      if (log)
-        log->Printf("Got target implementation of 0x0, stopping.");
+      LLDB_LOGF(log, "Got target implementation of 0x0, stopping.");
       SetPlanComplete();
       return true;
     }
     if (m_trampoline_handler->AddrIsMsgForward(target_addr)) {
-      if (log)
-        log->Printf(
-            "Implementation lookup returned msgForward function: 0x%" PRIx64
-            ", stopping.",
-            target_addr);
+      LLDB_LOGF(log,
+                "Implementation lookup returned msgForward function: 0x%" PRIx64
+                ", stopping.",
+                target_addr);
 
       SymbolContext sc = m_thread.GetStackFrameAtIndex(0)->GetSymbolContext(
           eSymbolContextEverything);
@@ -167,18 +165,17 @@ bool AppleThreadPlanStepThroughObjCTramp
       return false;
     }
 
-    if (log)
-      log->Printf("Running to ObjC method implementation: 0x%" PRIx64,
-                  target_addr);
+    LLDB_LOGF(log, "Running to ObjC method implementation: 0x%" PRIx64,
+              target_addr);
 
     ObjCLanguageRuntime *objc_runtime =
         ObjCLanguageRuntime::Get(*GetThread().GetProcess());
     assert(objc_runtime != nullptr);
     objc_runtime->AddToMethodCache(m_isa_addr, m_sel_addr, target_addr);
-    if (log)
-      log->Printf("Adding {isa-addr=0x%" PRIx64 ", sel-addr=0x%" PRIx64
-                  "} = addr=0x%" PRIx64 " to cache.",
-                  m_isa_addr, m_sel_addr, target_addr);
+    LLDB_LOGF(log,
+              "Adding {isa-addr=0x%" PRIx64 ", sel-addr=0x%" PRIx64
+              "} = addr=0x%" PRIx64 " to cache.",
+              m_isa_addr, m_sel_addr, target_addr);
 
     // Extract the target address from the value:
 

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp Wed Jul 24 10:56:10 2019
@@ -64,9 +64,10 @@ void ObjCLanguageRuntime::AddToMethodCac
                                            lldb::addr_t impl_addr) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
   if (log) {
-    log->Printf("Caching: class 0x%" PRIx64 " selector 0x%" PRIx64
-                " implementation 0x%" PRIx64 ".",
-                class_addr, selector, impl_addr);
+    LLDB_LOGF(log,
+              "Caching: class 0x%" PRIx64 " selector 0x%" PRIx64
+              " implementation 0x%" PRIx64 ".",
+              class_addr, selector, impl_addr);
   }
   m_impl_cache.insert(std::pair<ClassAndSel, lldb::addr_t>(
       ClassAndSel(class_addr, selector), impl_addr));

Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp Wed Jul 24 10:56:10 2019
@@ -140,10 +140,10 @@ bool RenderScriptRuntimeModulePass::runO
     // We've been using a triple and datalayout of some ARM variant all along,
     // so we need to let the backend know that this is no longer the case.
     if (log) {
-      log->Printf("%s - Changing RS target triple to '%s'", __FUNCTION__,
-                  real_triple.str().c_str());
-      log->Printf(
-          "%s - Changing RS datalayout to '%s'", __FUNCTION__,
+      LLDB_LOGF(log, "%s - Changing RS target triple to '%s'", __FUNCTION__,
+                real_triple.str().c_str());
+      LLDB_LOGF(
+          log, "%s - Changing RS datalayout to '%s'", __FUNCTION__,
           target_machine->createDataLayout().getStringRepresentation().c_str());
     }
     module.setTargetTriple(real_triple);

Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Wed Jul 24 10:56:10 2019
@@ -138,9 +138,8 @@ bool GetArgsX86(const GetArgsCtx &ctx, A
     size_t read =
         ctx.process->ReadMemory(sp, &arg.value, sizeof(uint32_t), err);
     if (read != arg_size || !err.Success()) {
-      if (log)
-        log->Printf("%s - error reading argument: %" PRIu64 " '%s'",
-                    __FUNCTION__, uint64_t(i), err.AsCString());
+      LLDB_LOGF(log, "%s - error reading argument: %" PRIu64 " '%s'",
+                __FUNCTION__, uint64_t(i), err.AsCString());
       return false;
     }
   }
@@ -173,8 +172,7 @@ bool GetArgsX86_64(GetArgsCtx &ctx, ArgI
 
   // check the stack alignment was correct (16 byte aligned)
   if ((sp & 0xf) != 0x0) {
-    if (log)
-      log->Printf("%s - stack misaligned", __FUNCTION__);
+    LLDB_LOGF(log, "%s - stack misaligned", __FUNCTION__);
     return false;
   }
 
@@ -213,9 +211,8 @@ bool GetArgsX86_64(GetArgsCtx &ctx, ArgI
     }
     // fail if we couldn't read this argument
     if (!success) {
-      if (log)
-        log->Printf("%s - error reading argument: %" PRIu64 ", reason: %s",
-                    __FUNCTION__, uint64_t(i), err.AsCString("n/a"));
+      LLDB_LOGF(log, "%s - error reading argument: %" PRIu64 ", reason: %s",
+                __FUNCTION__, uint64_t(i), err.AsCString("n/a"));
       return false;
     }
   }
@@ -258,9 +255,8 @@ bool GetArgsArm(GetArgsCtx &ctx, ArgItem
     }
     // fail if we couldn't read this argument
     if (!success) {
-      if (log)
-        log->Printf("%s - error reading argument: %" PRIu64 ", reason: %s",
-                    __FUNCTION__, uint64_t(i), err.AsCString("n/a"));
+      LLDB_LOGF(log, "%s - error reading argument: %" PRIu64 ", reason: %s",
+                __FUNCTION__, uint64_t(i), err.AsCString("n/a"));
       return false;
     }
   }
@@ -285,15 +281,13 @@ bool GetArgsAarch64(GetArgsCtx &ctx, Arg
     }
     // arguments passed on the stack
     else {
-      if (log)
-        log->Printf("%s - reading arguments spilled to stack not implemented",
-                    __FUNCTION__);
+      LLDB_LOGF(log, "%s - reading arguments spilled to stack not implemented",
+                __FUNCTION__);
     }
     // fail if we couldn't read this argument
     if (!success) {
-      if (log)
-        log->Printf("%s - error reading argument: %" PRIu64, __FUNCTION__,
-                    uint64_t(i));
+      LLDB_LOGF(log, "%s - error reading argument: %" PRIu64, __FUNCTION__,
+                uint64_t(i));
       return false;
     }
   }
@@ -337,9 +331,8 @@ bool GetArgsMipsel(GetArgsCtx &ctx, ArgI
     }
     // fail if we couldn't read this argument
     if (!success) {
-      if (log)
-        log->Printf("%s - error reading argument: %" PRIu64 ", reason: %s",
-                    __FUNCTION__, uint64_t(i), err.AsCString("n/a"));
+      LLDB_LOGF(log, "%s - error reading argument: %" PRIu64 ", reason: %s",
+                __FUNCTION__, uint64_t(i), err.AsCString("n/a"));
       return false;
     }
   }
@@ -385,9 +378,8 @@ bool GetArgsMips64el(GetArgsCtx &ctx, Ar
     }
     // fail if we couldn't read this argument
     if (!success) {
-      if (log)
-        log->Printf("%s - error reading argument: %" PRIu64 ", reason: %s",
-                    __FUNCTION__, uint64_t(i), err.AsCString("n/a"));
+      LLDB_LOGF(log, "%s - error reading argument: %" PRIu64 ", reason: %s",
+                __FUNCTION__, uint64_t(i), err.AsCString("n/a"));
       return false;
     }
   }
@@ -399,8 +391,7 @@ bool GetArgs(ExecutionContext &exe_ctx,
 
   // verify that we have a target
   if (!exe_ctx.GetTargetPtr()) {
-    if (log)
-      log->Printf("%s - invalid target", __FUNCTION__);
+    LLDB_LOGF(log, "%s - invalid target", __FUNCTION__);
     return false;
   }
 
@@ -430,9 +421,8 @@ bool GetArgs(ExecutionContext &exe_ctx,
   default:
     // unsupported architecture
     if (log) {
-      log->Printf(
-          "%s - architecture not supported: '%s'", __FUNCTION__,
-          exe_ctx.GetTargetRef().GetArchitecture().GetArchitectureName());
+      LLDB_LOGF(log, "%s - architecture not supported: '%s'", __FUNCTION__,
+                exe_ctx.GetTargetRef().GetArchitecture().GetArchitectureName());
     }
     return false;
   }
@@ -492,9 +482,8 @@ bool SkipPrologue(lldb::ModuleSP &module
       ConstString name = sc.GetFunctionName();
       if (offset)
         addr.Slide(offset);
-      if (log)
-        log->Printf("%s: Prologue offset for %s is %" PRIu32, __FUNCTION__,
-                    name.AsCString(), offset);
+      LLDB_LOGF(log, "%s: Prologue offset for %s is %" PRIu32, __FUNCTION__,
+                name.AsCString(), offset);
     }
     return true;
   } else
@@ -884,14 +873,13 @@ RSReduceBreakpointResolver::SearchCallba
         if (filter.AddressPasses(address)) {
           bool new_bp;
           if (!SkipPrologue(module, address)) {
-            if (log)
-              log->Printf("%s: Error trying to skip prologue", __FUNCTION__);
+            LLDB_LOGF(log, "%s: Error trying to skip prologue", __FUNCTION__);
           }
           m_breakpoint->AddLocation(address, &new_bp);
-          if (log)
-            log->Printf("%s: %s reduction breakpoint on %s in %s", __FUNCTION__,
-                        new_bp ? "new" : "existing", kernel_name.GetCString(),
-                        address.GetModule()->GetFileSpec().GetCString());
+          LLDB_LOGF(log, "%s: %s reduction breakpoint on %s in %s",
+                    __FUNCTION__, new_bp ? "new" : "existing",
+                    kernel_name.GetCString(),
+                    address.GetModule()->GetFileSpec().GetCString());
         }
       }
     }
@@ -920,48 +908,43 @@ Searcher::CallbackReturn RSScriptGroupBr
   for (auto &name : names) {
     const RSScriptGroupDescriptorSP sg = FindScriptGroup(ConstString(name));
     if (!sg) {
-      if (log)
-        log->Printf("%s: could not find script group for %s", __FUNCTION__,
-                    name.c_str());
+      LLDB_LOGF(log, "%s: could not find script group for %s", __FUNCTION__,
+                name.c_str());
       continue;
     }
 
-    if (log)
-      log->Printf("%s: Found ScriptGroup for %s", __FUNCTION__, name.c_str());
+    LLDB_LOGF(log, "%s: Found ScriptGroup for %s", __FUNCTION__, name.c_str());
 
     for (const RSScriptGroupDescriptor::Kernel &k : sg->m_kernels) {
       if (log) {
-        log->Printf("%s: Adding breakpoint for %s", __FUNCTION__,
-                    k.m_name.AsCString());
-        log->Printf("%s: Kernel address 0x%" PRIx64, __FUNCTION__, k.m_addr);
+        LLDB_LOGF(log, "%s: Adding breakpoint for %s", __FUNCTION__,
+                  k.m_name.AsCString());
+        LLDB_LOGF(log, "%s: Kernel address 0x%" PRIx64, __FUNCTION__, k.m_addr);
       }
 
       const lldb_private::Symbol *sym =
           module->FindFirstSymbolWithNameAndType(k.m_name, eSymbolTypeCode);
       if (!sym) {
-        if (log)
-          log->Printf("%s: Unable to find symbol for %s", __FUNCTION__,
-                      k.m_name.AsCString());
+        LLDB_LOGF(log, "%s: Unable to find symbol for %s", __FUNCTION__,
+                  k.m_name.AsCString());
         continue;
       }
 
       if (log) {
-        log->Printf("%s: Found symbol name is %s", __FUNCTION__,
-                    sym->GetName().AsCString());
+        LLDB_LOGF(log, "%s: Found symbol name is %s", __FUNCTION__,
+                  sym->GetName().AsCString());
       }
 
       auto address = sym->GetAddress();
       if (!SkipPrologue(module, address)) {
-        if (log)
-          log->Printf("%s: Error trying to skip prologue", __FUNCTION__);
+        LLDB_LOGF(log, "%s: Error trying to skip prologue", __FUNCTION__);
       }
 
       bool new_bp;
       m_breakpoint->AddLocation(address, &new_bp);
 
-      if (log)
-        log->Printf("%s: Placed %sbreakpoint on %s", __FUNCTION__,
-                    new_bp ? "new " : "", k.m_name.AsCString());
+      LLDB_LOGF(log, "%s: Placed %sbreakpoint on %s", __FUNCTION__,
+                new_bp ? "new " : "", k.m_name.AsCString());
 
       // exit after placing the first breakpoint if we do not intend to stop on
       // all kernels making up this script group
@@ -1136,8 +1119,7 @@ void RenderScriptRuntime::HookCallback(R
                                        ExecutionContext &exe_ctx) {
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));
 
-  if (log)
-    log->Printf("%s - '%s'", __FUNCTION__, hook->defn->name);
+  LLDB_LOGF(log, "%s - '%s'", __FUNCTION__, hook->defn->name);
 
   if (hook->defn->grabber) {
     (this->*(hook->defn->grabber))(hook, exe_ctx);
@@ -1163,19 +1145,18 @@ void RenderScriptRuntime::CaptureDebugHi
   }};
 
   if (!GetArgs(context, args.data(), args.size())) {
-    if (log)
-      log->Printf("%s - Error while reading the function parameters",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "%s - Error while reading the function parameters",
+              __FUNCTION__);
     return;
   } else if (log) {
-    log->Printf("%s - groupName    : 0x%" PRIx64, __FUNCTION__,
-                addr_t(args[eGroupName]));
-    log->Printf("%s - groupNameSize: %" PRIu64, __FUNCTION__,
-                uint64_t(args[eGroupNameSize]));
-    log->Printf("%s - kernel       : 0x%" PRIx64, __FUNCTION__,
-                addr_t(args[eKernel]));
-    log->Printf("%s - kernelCount  : %" PRIu64, __FUNCTION__,
-                uint64_t(args[eKernelCount]));
+    LLDB_LOGF(log, "%s - groupName    : 0x%" PRIx64, __FUNCTION__,
+              addr_t(args[eGroupName]));
+    LLDB_LOGF(log, "%s - groupNameSize: %" PRIu64, __FUNCTION__,
+              uint64_t(args[eGroupNameSize]));
+    LLDB_LOGF(log, "%s - kernel       : 0x%" PRIx64, __FUNCTION__,
+              addr_t(args[eKernel]));
+    LLDB_LOGF(log, "%s - kernelCount  : %" PRIu64, __FUNCTION__,
+              uint64_t(args[eKernelCount]));
   }
 
   // parse script group name
@@ -1187,12 +1168,10 @@ void RenderScriptRuntime::CaptureDebugHi
     m_process->ReadMemory(addr_t(args[eGroupName]), buffer.get(), len, err);
     buffer.get()[len] = '\0';
     if (!err.Success()) {
-      if (log)
-        log->Printf("Error reading scriptgroup name from target");
+      LLDB_LOGF(log, "Error reading scriptgroup name from target");
       return;
     } else {
-      if (log)
-        log->Printf("Extracted scriptgroup name %s", buffer.get());
+      LLDB_LOGF(log, "Extracted scriptgroup name %s", buffer.get());
     }
     // write back the script group name
     group_name.SetCString(buffer.get());
@@ -1214,9 +1193,8 @@ void RenderScriptRuntime::CaptureDebugHi
       m_scriptGroups.push_back(group);
     } else {
       // already have this script group
-      if (log)
-        log->Printf("Attempt to add duplicate script group %s",
-                    group_name.AsCString());
+      LLDB_LOGF(log, "Attempt to add duplicate script group %s",
+                group_name.AsCString());
       return;
     }
   }
@@ -1234,21 +1212,18 @@ void RenderScriptRuntime::CaptureDebugHi
     size_t read =
         m_process->ReadMemory(ptr_addr, &kernel_addr, target_ptr_size, err);
     if (!err.Success() || read != target_ptr_size) {
-      if (log)
-        log->Printf("Error parsing kernel address %" PRIu64 " in script group",
-                    i);
+      LLDB_LOGF(log, "Error parsing kernel address %" PRIu64 " in script group",
+                i);
       return;
     }
-    if (log)
-      log->Printf("Extracted scriptgroup kernel address - 0x%" PRIx64,
-                  kernel_addr);
+    LLDB_LOGF(log, "Extracted scriptgroup kernel address - 0x%" PRIx64,
+              kernel_addr);
     kernel.m_addr = kernel_addr;
 
     // try to resolve the associated kernel name
     if (!ResolveKernelName(kernel.m_addr, kernel.m_name)) {
-      if (log)
-        log->Printf("Parsed scriptgroup kernel %" PRIu64 " - 0x%" PRIx64, i,
-                    kernel_addr);
+      LLDB_LOGF(log, "Parsed scriptgroup kernel %" PRIu64 " - 0x%" PRIx64, i,
+                kernel_addr);
       return;
     }
 
@@ -1261,9 +1236,8 @@ void RenderScriptRuntime::CaptureDebugHi
         // verify this function is a valid kernel
         if (IsKnownKernel(base_kernel)) {
           kernel.m_name = base_kernel;
-          if (log)
-            log->Printf("%s - found non expand version '%s'", __FUNCTION__,
-                        base_kernel.GetCString());
+          LLDB_LOGF(log, "%s - found non expand version '%s'", __FUNCTION__,
+                    base_kernel.GetCString());
         }
       }
     }
@@ -1276,15 +1250,13 @@ void RenderScriptRuntime::CaptureDebugHi
     Target &target = m_process->GetTarget();
     const BreakpointList &list = target.GetBreakpointList();
     const size_t num_breakpoints = list.GetSize();
-    if (log)
-      log->Printf("Resolving %zu breakpoints", num_breakpoints);
+    LLDB_LOGF(log, "Resolving %zu breakpoints", num_breakpoints);
     for (size_t i = 0; i < num_breakpoints; ++i) {
       const BreakpointSP bp = list.GetBreakpointAtIndex(i);
       if (bp) {
         if (bp->MatchesName(group_name.AsCString())) {
-          if (log)
-            log->Printf("Found breakpoint with name %s",
-                        group_name.AsCString());
+          LLDB_LOGF(log, "Found breakpoint with name %s",
+                    group_name.AsCString());
           bp->ResolveBreakpoint();
         }
       }
@@ -1322,9 +1294,8 @@ void RenderScriptRuntime::CaptureScriptI
 
   bool success = GetArgs(exe_ctx, &args[0], args.size());
   if (!success) {
-    if (log)
-      log->Printf("%s - Error while reading the function parameters",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "%s - Error while reading the function parameters",
+              __FUNCTION__);
     return;
   }
 
@@ -1342,10 +1313,9 @@ void RenderScriptRuntime::CaptureScriptI
     uint64_t result = 0;
     size_t read = m_process->ReadMemory(addr, &result, target_ptr_size, err);
     if (read != target_ptr_size || !err.Success()) {
-      if (log)
-        log->Printf(
-            "%s - Error while reading allocation list argument %" PRIu64,
-            __FUNCTION__, i);
+      LLDB_LOGF(log,
+                "%s - Error while reading allocation list argument %" PRIu64,
+                __FUNCTION__, i);
     } else {
       allocs.push_back(result);
     }
@@ -1375,8 +1345,8 @@ void RenderScriptRuntime::CaptureScriptI
       if (log) {
         if (alloc->context.isValid() &&
             *alloc->context.get() != addr_t(args[eRsContext]))
-          log->Printf("%s - Allocation used by multiple contexts",
-                      __FUNCTION__);
+          LLDB_LOGF(log, "%s - Allocation used by multiple contexts",
+                    __FUNCTION__);
       }
       alloc->context = addr_t(args[eRsContext]);
     }
@@ -1388,7 +1358,7 @@ void RenderScriptRuntime::CaptureScriptI
     if (log) {
       if (script->context.isValid() &&
           *script->context.get() != addr_t(args[eRsContext]))
-        log->Printf("%s - Script used by multiple contexts", __FUNCTION__);
+        LLDB_LOGF(log, "%s - Script used by multiple contexts", __FUNCTION__);
     }
     script->context = addr_t(args[eRsContext]);
   }
@@ -1416,26 +1386,26 @@ void RenderScriptRuntime::CaptureSetGlob
 
   bool success = GetArgs(context, &args[0], args.size());
   if (!success) {
-    if (log)
-      log->Printf("%s - error reading the function parameters.", __FUNCTION__);
+    LLDB_LOGF(log, "%s - error reading the function parameters.", __FUNCTION__);
     return;
   }
 
   if (log) {
-    log->Printf("%s - 0x%" PRIx64 ",0x%" PRIx64 " slot %" PRIu64 " = 0x%" PRIx64
-                ":%" PRIu64 "bytes.",
-                __FUNCTION__, uint64_t(args[eRsContext]),
-                uint64_t(args[eRsScript]), uint64_t(args[eRsId]),
-                uint64_t(args[eRsData]), uint64_t(args[eRsLength]));
+    LLDB_LOGF(log,
+              "%s - 0x%" PRIx64 ",0x%" PRIx64 " slot %" PRIu64 " = 0x%" PRIx64
+              ":%" PRIu64 "bytes.",
+              __FUNCTION__, uint64_t(args[eRsContext]),
+              uint64_t(args[eRsScript]), uint64_t(args[eRsId]),
+              uint64_t(args[eRsData]), uint64_t(args[eRsLength]));
 
     addr_t script_addr = addr_t(args[eRsScript]);
     if (m_scriptMappings.find(script_addr) != m_scriptMappings.end()) {
       auto rsm = m_scriptMappings[script_addr];
       if (uint64_t(args[eRsId]) < rsm->m_globals.size()) {
         auto rsg = rsm->m_globals[uint64_t(args[eRsId])];
-        log->Printf("%s - Setting of '%s' within '%s' inferred", __FUNCTION__,
-                    rsg.m_name.AsCString(),
-                    rsm->m_module->GetFileSpec().GetFilename().AsCString());
+        LLDB_LOGF(log, "%s - Setting of '%s' within '%s' inferred",
+                  __FUNCTION__, rsg.m_name.AsCString(),
+                  rsm->m_module->GetFileSpec().GetFilename().AsCString());
       }
     }
   }
@@ -1455,16 +1425,14 @@ void RenderScriptRuntime::CaptureAllocat
 
   bool success = GetArgs(exe_ctx, &args[0], args.size());
   if (!success) {
-    if (log)
-      log->Printf("%s - error while reading the function parameters",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "%s - error while reading the function parameters",
+              __FUNCTION__);
     return;
   }
 
-  if (log)
-    log->Printf("%s - 0x%" PRIx64 ",0x%" PRIx64 ",0x%" PRIx64 " .",
-                __FUNCTION__, uint64_t(args[eRsContext]),
-                uint64_t(args[eRsAlloc]), uint64_t(args[eRsForceZero]));
+  LLDB_LOGF(log, "%s - 0x%" PRIx64 ",0x%" PRIx64 ",0x%" PRIx64 " .",
+            __FUNCTION__, uint64_t(args[eRsContext]), uint64_t(args[eRsAlloc]),
+            uint64_t(args[eRsForceZero]));
 
   AllocationDetails *alloc = CreateAllocation(uint64_t(args[eRsAlloc]));
   if (alloc)
@@ -1487,29 +1455,25 @@ void RenderScriptRuntime::CaptureAllocat
 
   bool success = GetArgs(exe_ctx, &args[0], args.size());
   if (!success) {
-    if (log)
-      log->Printf("%s - error while reading the function parameters.",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "%s - error while reading the function parameters.",
+              __FUNCTION__);
     return;
   }
 
-  if (log)
-    log->Printf("%s - 0x%" PRIx64 ", 0x%" PRIx64 ".", __FUNCTION__,
-                uint64_t(args[eRsContext]), uint64_t(args[eRsAlloc]));
+  LLDB_LOGF(log, "%s - 0x%" PRIx64 ", 0x%" PRIx64 ".", __FUNCTION__,
+            uint64_t(args[eRsContext]), uint64_t(args[eRsAlloc]));
 
   for (auto iter = m_allocations.begin(); iter != m_allocations.end(); ++iter) {
     auto &allocation_up = *iter; // get the unique pointer
     if (allocation_up->address.isValid() &&
         *allocation_up->address.get() == addr_t(args[eRsAlloc])) {
       m_allocations.erase(iter);
-      if (log)
-        log->Printf("%s - deleted allocation entry.", __FUNCTION__);
+      LLDB_LOGF(log, "%s - deleted allocation entry.", __FUNCTION__);
       return;
     }
   }
 
-  if (log)
-    log->Printf("%s - couldn't find destroyed allocation.", __FUNCTION__);
+  LLDB_LOGF(log, "%s - couldn't find destroyed allocation.", __FUNCTION__);
 }
 
 void RenderScriptRuntime::CaptureScriptInit(RuntimeHook *hook,
@@ -1526,32 +1490,28 @@ void RenderScriptRuntime::CaptureScriptI
        ArgItem{ArgItem::ePointer, 0}, ArgItem{ArgItem::ePointer, 0}}};
   bool success = GetArgs(exe_ctx, &args[0], args.size());
   if (!success) {
-    if (log)
-      log->Printf("%s - error while reading the function parameters.",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "%s - error while reading the function parameters.",
+              __FUNCTION__);
     return;
   }
 
   std::string res_name;
   process->ReadCStringFromMemory(addr_t(args[eRsResNamePtr]), res_name, err);
   if (err.Fail()) {
-    if (log)
-      log->Printf("%s - error reading res_name: %s.", __FUNCTION__,
-                  err.AsCString());
+    LLDB_LOGF(log, "%s - error reading res_name: %s.", __FUNCTION__,
+              err.AsCString());
   }
 
   std::string cache_dir;
   process->ReadCStringFromMemory(addr_t(args[eRsCachedDirPtr]), cache_dir, err);
   if (err.Fail()) {
-    if (log)
-      log->Printf("%s - error reading cache_dir: %s.", __FUNCTION__,
-                  err.AsCString());
+    LLDB_LOGF(log, "%s - error reading cache_dir: %s.", __FUNCTION__,
+              err.AsCString());
   }
 
-  if (log)
-    log->Printf("%s - 0x%" PRIx64 ",0x%" PRIx64 " => '%s' at '%s' .",
-                __FUNCTION__, uint64_t(args[eRsContext]),
-                uint64_t(args[eRsScript]), res_name.c_str(), cache_dir.c_str());
+  LLDB_LOGF(log, "%s - 0x%" PRIx64 ",0x%" PRIx64 " => '%s' at '%s' .",
+            __FUNCTION__, uint64_t(args[eRsContext]), uint64_t(args[eRsScript]),
+            res_name.c_str(), cache_dir.c_str());
 
   if (res_name.size() > 0) {
     StreamString strm;
@@ -1566,13 +1526,14 @@ void RenderScriptRuntime::CaptureScriptI
       script->context = addr_t(args[eRsContext]);
     }
 
-    if (log)
-      log->Printf("%s - '%s' tagged with context 0x%" PRIx64
-                  " and script 0x%" PRIx64 ".",
-                  __FUNCTION__, strm.GetData(), uint64_t(args[eRsContext]),
-                  uint64_t(args[eRsScript]));
+    LLDB_LOGF(log,
+              "%s - '%s' tagged with context 0x%" PRIx64
+              " and script 0x%" PRIx64 ".",
+              __FUNCTION__, strm.GetData(), uint64_t(args[eRsContext]),
+              uint64_t(args[eRsScript]));
   } else if (log) {
-    log->Printf("%s - resource name invalid, Script not tagged.", __FUNCTION__);
+    LLDB_LOGF(log, "%s - resource name invalid, Script not tagged.",
+              __FUNCTION__);
   }
 }
 
@@ -1593,8 +1554,7 @@ void RenderScriptRuntime::LoadRuntimeHoo
       machine != llvm::Triple::ArchType::mipsel &&
       machine != llvm::Triple::ArchType::mips64el &&
       machine != llvm::Triple::ArchType::x86_64) {
-    if (log)
-      log->Printf("%s - unable to hook runtime functions.", __FUNCTION__);
+    LLDB_LOGF(log, "%s - unable to hook runtime functions.", __FUNCTION__);
     return;
   }
 
@@ -1618,23 +1578,22 @@ void RenderScriptRuntime::LoadRuntimeHoo
         ConstString(symbol_name), eSymbolTypeCode);
     if (!sym) {
       if (log) {
-        log->Printf("%s - symbol '%s' related to the function %s not found",
-                    __FUNCTION__, symbol_name, hook_defn->name);
+        LLDB_LOGF(log, "%s - symbol '%s' related to the function %s not found",
+                  __FUNCTION__, symbol_name, hook_defn->name);
       }
       continue;
     }
 
     addr_t addr = sym->GetLoadAddress(&target);
     if (addr == LLDB_INVALID_ADDRESS) {
-      if (log)
-        log->Printf("%s - unable to resolve the address of hook function '%s' "
-                    "with symbol '%s'.",
-                    __FUNCTION__, hook_defn->name, symbol_name);
+      LLDB_LOGF(log,
+                "%s - unable to resolve the address of hook function '%s' "
+                "with symbol '%s'.",
+                __FUNCTION__, hook_defn->name, symbol_name);
       continue;
     } else {
-      if (log)
-        log->Printf("%s - function %s, address resolved at 0x%" PRIx64,
-                    __FUNCTION__, hook_defn->name, addr);
+      LLDB_LOGF(log, "%s - function %s, address resolved at 0x%" PRIx64,
+                __FUNCTION__, hook_defn->name, addr);
     }
 
     RuntimeHookSP hook(new RuntimeHook());
@@ -1644,11 +1603,12 @@ void RenderScriptRuntime::LoadRuntimeHoo
     hook->bp_sp->SetCallback(HookCallback, hook.get(), true);
     m_runtimeHooks[addr] = hook;
     if (log) {
-      log->Printf("%s - successfully hooked '%s' in '%s' version %" PRIu64
-                  " at 0x%" PRIx64 ".",
-                  __FUNCTION__, hook_defn->name,
-                  module->GetFileSpec().GetFilename().AsCString(),
-                  (uint64_t)hook_defn->version, (uint64_t)addr);
+      LLDB_LOGF(log,
+                "%s - successfully hooked '%s' in '%s' version %" PRIu64
+                " at 0x%" PRIx64 ".",
+                __FUNCTION__, hook_defn->name,
+                module->GetFileSpec().GetFilename().AsCString(),
+                (uint64_t)hook_defn->version, (uint64_t)addr);
     }
     hook_placed[idx] = true;
   }
@@ -1661,8 +1621,8 @@ void RenderScriptRuntime::LoadRuntimeHoo
       const HookDefn &hook_defn = s_runtimeHookDefns[i];
       if (hook_defn.kind != kind)
         continue;
-      log->Printf("%s - function %s was not hooked", __FUNCTION__,
-                  hook_defn.name);
+      LLDB_LOGF(log, "%s - function %s was not hooked", __FUNCTION__,
+                hook_defn.name);
     }
   }
 }
@@ -1697,11 +1657,11 @@ void RenderScriptRuntime::FixupScriptDet
     if (m_scriptMappings.find(script) != m_scriptMappings.end()) {
       // if the module we have stored is different to the one we just received.
       if (m_scriptMappings[script] != rsmodule_sp) {
-        if (log)
-          log->Printf(
-              "%s - script %" PRIx64 " wants reassigned to new rsmodule '%s'.",
-              __FUNCTION__, (uint64_t)script,
-              rsmodule_sp->m_module->GetFileSpec().GetFilename().AsCString());
+        LLDB_LOGF(
+            log,
+            "%s - script %" PRIx64 " wants reassigned to new rsmodule '%s'.",
+            __FUNCTION__, (uint64_t)script,
+            rsmodule_sp->m_module->GetFileSpec().GetFilename().AsCString());
       }
     }
     // We don't have a script mapping for the current script.
@@ -1713,11 +1673,9 @@ void RenderScriptRuntime::FixupScriptDet
         rsmodule_sp->m_resname = res_name;
       // Add Script/Module pair to map.
       m_scriptMappings[script] = rsmodule_sp;
-      if (log)
-        log->Printf(
-            "%s - script %" PRIx64 " associated with rsmodule '%s'.",
-            __FUNCTION__, (uint64_t)script,
-            rsmodule_sp->m_module->GetFileSpec().GetFilename().AsCString());
+      LLDB_LOGF(log, "%s - script %" PRIx64 " associated with rsmodule '%s'.",
+                __FUNCTION__, (uint64_t)script,
+                rsmodule_sp->m_module->GetFileSpec().GetFilename().AsCString());
     }
   }
 }
@@ -1730,8 +1688,7 @@ bool RenderScriptRuntime::EvalRSExpressi
                                            StackFrame *frame_ptr,
                                            uint64_t *result) {
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));
-  if (log)
-    log->Printf("%s(%s)", __FUNCTION__, expr);
+  LLDB_LOGF(log, "%s(%s)", __FUNCTION__, expr);
 
   ValueObjectSP expr_result;
   EvaluateExpressionOptions options;
@@ -1741,8 +1698,7 @@ bool RenderScriptRuntime::EvalRSExpressi
   target.EvaluateExpression(expr, frame_ptr, expr_result, options);
 
   if (!expr_result) {
-    if (log)
-      log->Printf("%s: couldn't evaluate expression.", __FUNCTION__);
+    LLDB_LOGF(log, "%s: couldn't evaluate expression.", __FUNCTION__);
     return false;
   }
 
@@ -1751,16 +1707,14 @@ bool RenderScriptRuntime::EvalRSExpressi
     Status err = expr_result->GetError();
     // Expression returned is void, so this is actually a success
     if (err.GetError() == UserExpression::kNoResult) {
-      if (log)
-        log->Printf("%s - expression returned void.", __FUNCTION__);
+      LLDB_LOGF(log, "%s - expression returned void.", __FUNCTION__);
 
       result = nullptr;
       return true;
     }
 
-    if (log)
-      log->Printf("%s - error evaluating expression result: %s", __FUNCTION__,
-                  err.AsCString());
+    LLDB_LOGF(log, "%s - error evaluating expression result: %s", __FUNCTION__,
+              err.AsCString());
     return false;
   }
 
@@ -1769,9 +1723,8 @@ bool RenderScriptRuntime::EvalRSExpressi
   *result = expr_result->GetValueAsUnsigned(0, &success);
 
   if (!success) {
-    if (log)
-      log->Printf("%s - couldn't convert expression result to uint32_t",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "%s - couldn't convert expression result to uint32_t",
+              __FUNCTION__);
     return false;
   }
 
@@ -1884,8 +1837,7 @@ bool RenderScriptRuntime::JITDataPointer
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));
 
   if (!alloc->address.isValid()) {
-    if (log)
-      log->Printf("%s - failed to find allocation details.", __FUNCTION__);
+    LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__);
     return false;
   }
 
@@ -1895,12 +1847,10 @@ bool RenderScriptRuntime::JITDataPointer
   int written = snprintf(expr_buf, jit_max_expr_size, fmt_str,
                          *alloc->address.get(), x, y, z);
   if (written < 0) {
-    if (log)
-      log->Printf("%s - encoding error in snprintf().", __FUNCTION__);
+    LLDB_LOGF(log, "%s - encoding error in snprintf().", __FUNCTION__);
     return false;
   } else if (written >= jit_max_expr_size) {
-    if (log)
-      log->Printf("%s - expression too long.", __FUNCTION__);
+    LLDB_LOGF(log, "%s - expression too long.", __FUNCTION__);
     return false;
   }
 
@@ -1922,8 +1872,7 @@ bool RenderScriptRuntime::JITTypePointer
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));
 
   if (!alloc->address.isValid() || !alloc->context.isValid()) {
-    if (log)
-      log->Printf("%s - failed to find allocation details.", __FUNCTION__);
+    LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__);
     return false;
   }
 
@@ -1933,12 +1882,10 @@ bool RenderScriptRuntime::JITTypePointer
   int written = snprintf(expr_buf, jit_max_expr_size, fmt_str,
                          *alloc->context.get(), *alloc->address.get());
   if (written < 0) {
-    if (log)
-      log->Printf("%s - encoding error in snprintf().", __FUNCTION__);
+    LLDB_LOGF(log, "%s - encoding error in snprintf().", __FUNCTION__);
     return false;
   } else if (written >= jit_max_expr_size) {
-    if (log)
-      log->Printf("%s - expression too long.", __FUNCTION__);
+    LLDB_LOGF(log, "%s - expression too long.", __FUNCTION__);
     return false;
   }
 
@@ -1960,8 +1907,7 @@ bool RenderScriptRuntime::JITTypePacked(
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));
 
   if (!alloc->type_ptr.isValid() || !alloc->context.isValid()) {
-    if (log)
-      log->Printf("%s - Failed to find allocation details.", __FUNCTION__);
+    LLDB_LOGF(log, "%s - Failed to find allocation details.", __FUNCTION__);
     return false;
   }
 
@@ -1983,12 +1929,10 @@ bool RenderScriptRuntime::JITTypePacked(
     int written = snprintf(expr_bufs[i], jit_max_expr_size, fmt_str,
                            *alloc->context.get(), bits, *alloc->type_ptr.get());
     if (written < 0) {
-      if (log)
-        log->Printf("%s - encoding error in snprintf().", __FUNCTION__);
+      LLDB_LOGF(log, "%s - encoding error in snprintf().", __FUNCTION__);
       return false;
     } else if (written >= jit_max_expr_size) {
-      if (log)
-        log->Printf("%s - expression too long.", __FUNCTION__);
+      LLDB_LOGF(log, "%s - expression too long.", __FUNCTION__);
       return false;
     }
 
@@ -2007,10 +1951,10 @@ bool RenderScriptRuntime::JITTypePacked(
   addr_t element_ptr = static_cast<lldb::addr_t>(results[3]);
   alloc->element.element_ptr = element_ptr;
 
-  if (log)
-    log->Printf("%s - dims (%" PRIu32 ", %" PRIu32 ", %" PRIu32
-                ") Element*: 0x%" PRIx64 ".",
-                __FUNCTION__, dims.dim_1, dims.dim_2, dims.dim_3, element_ptr);
+  LLDB_LOGF(log,
+            "%s - dims (%" PRIu32 ", %" PRIu32 ", %" PRIu32
+            ") Element*: 0x%" PRIx64 ".",
+            __FUNCTION__, dims.dim_1, dims.dim_2, dims.dim_3, element_ptr);
 
   return true;
 }
@@ -2024,8 +1968,7 @@ bool RenderScriptRuntime::JITElementPack
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));
 
   if (!elem.element_ptr.isValid()) {
-    if (log)
-      log->Printf("%s - failed to find allocation details.", __FUNCTION__);
+    LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__);
     return false;
   }
 
@@ -2042,12 +1985,10 @@ bool RenderScriptRuntime::JITElementPack
     int written = snprintf(expr_bufs[i], jit_max_expr_size, fmt_str, context,
                            *elem.element_ptr.get());
     if (written < 0) {
-      if (log)
-        log->Printf("%s - encoding error in snprintf().", __FUNCTION__);
+      LLDB_LOGF(log, "%s - encoding error in snprintf().", __FUNCTION__);
       return false;
     } else if (written >= jit_max_expr_size) {
-      if (log)
-        log->Printf("%s - expression too long.", __FUNCTION__);
+      LLDB_LOGF(log, "%s - expression too long.", __FUNCTION__);
       return false;
     }
 
@@ -2063,11 +2004,11 @@ bool RenderScriptRuntime::JITElementPack
   elem.type_vec_size = static_cast<uint32_t>(results[2]);
   elem.field_count = static_cast<uint32_t>(results[3]);
 
-  if (log)
-    log->Printf("%s - data type %" PRIu32 ", pixel type %" PRIu32
-                ", vector size %" PRIu32 ", field count %" PRIu32,
-                __FUNCTION__, *elem.type.get(), *elem.type_kind.get(),
-                *elem.type_vec_size.get(), *elem.field_count.get());
+  LLDB_LOGF(log,
+            "%s - data type %" PRIu32 ", pixel type %" PRIu32
+            ", vector size %" PRIu32 ", field count %" PRIu32,
+            __FUNCTION__, *elem.type.get(), *elem.type_kind.get(),
+            *elem.type_vec_size.get(), *elem.field_count.get());
 
   // If this Element has subelements then JIT rsaElementGetSubElements() for
   // details about its fields
@@ -2084,8 +2025,7 @@ bool RenderScriptRuntime::JITSubelements
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));
 
   if (!elem.element_ptr.isValid() || !elem.field_count.isValid()) {
-    if (log)
-      log->Printf("%s - failed to find allocation details.", __FUNCTION__);
+    LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__);
     return false;
   }
 
@@ -2107,12 +2047,10 @@ bool RenderScriptRuntime::JITSubelements
                              context, field_count, field_count, field_count,
                              *elem.element_ptr.get(), field_count, field_index);
       if (written < 0) {
-        if (log)
-          log->Printf("%s - encoding error in snprintf().", __FUNCTION__);
+        LLDB_LOGF(log, "%s - encoding error in snprintf().", __FUNCTION__);
         return false;
       } else if (written >= jit_max_expr_size) {
-        if (log)
-          log->Printf("%s - expression too long.", __FUNCTION__);
+        LLDB_LOGF(log, "%s - expression too long.", __FUNCTION__);
         return false;
       }
 
@@ -2120,8 +2058,7 @@ bool RenderScriptRuntime::JITSubelements
       if (!EvalRSExpression(expr_buffer, frame_ptr, &results))
         return false;
 
-      if (log)
-        log->Printf("%s - expr result 0x%" PRIx64 ".", __FUNCTION__, results);
+      LLDB_LOGF(log, "%s - expr result 0x%" PRIx64 ".", __FUNCTION__, results);
 
       switch (expr_index) {
       case 0: // Element* of child
@@ -2136,9 +2073,8 @@ bool RenderScriptRuntime::JITSubelements
         if (!err.Fail())
           child.type_name = ConstString(name);
         else {
-          if (log)
-            log->Printf("%s - warning: Couldn't read field name.",
-                        __FUNCTION__);
+          LLDB_LOGF(log, "%s - warning: Couldn't read field name.",
+                    __FUNCTION__);
         }
         break;
       }
@@ -2173,8 +2109,7 @@ bool RenderScriptRuntime::JITAllocationS
 
   if (!alloc->address.isValid() || !alloc->dimension.isValid() ||
       !alloc->data_ptr.isValid() || !alloc->element.datum_size.isValid()) {
-    if (log)
-      log->Printf("%s - failed to find allocation details.", __FUNCTION__);
+    LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__);
     return false;
   }
 
@@ -2196,9 +2131,8 @@ bool RenderScriptRuntime::JITAllocationS
 
     alloc->size = dim_x * dim_y * dim_z * *alloc->element.datum_size.get();
 
-    if (log)
-      log->Printf("%s - inferred size of struct allocation %" PRIu32 ".",
-                  __FUNCTION__, *alloc->size.get());
+    LLDB_LOGF(log, "%s - inferred size of struct allocation %" PRIu32 ".",
+              __FUNCTION__, *alloc->size.get());
     return true;
   }
 
@@ -2213,12 +2147,10 @@ bool RenderScriptRuntime::JITAllocationS
   int written = snprintf(expr_buf, jit_max_expr_size, fmt_str,
                          *alloc->address.get(), dim_x, dim_y, dim_z);
   if (written < 0) {
-    if (log)
-      log->Printf("%s - encoding error in snprintf().", __FUNCTION__);
+    LLDB_LOGF(log, "%s - encoding error in snprintf().", __FUNCTION__);
     return false;
   } else if (written >= jit_max_expr_size) {
-    if (log)
-      log->Printf("%s - expression too long.", __FUNCTION__);
+    LLDB_LOGF(log, "%s - expression too long.", __FUNCTION__);
     return false;
   }
 
@@ -2242,8 +2174,7 @@ bool RenderScriptRuntime::JITAllocationS
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));
 
   if (!alloc->address.isValid() || !alloc->data_ptr.isValid()) {
-    if (log)
-      log->Printf("%s - failed to find allocation details.", __FUNCTION__);
+    LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__);
     return false;
   }
 
@@ -2253,12 +2184,10 @@ bool RenderScriptRuntime::JITAllocationS
   int written = snprintf(expr_buf, jit_max_expr_size, fmt_str,
                          *alloc->address.get(), 0, 1, 0);
   if (written < 0) {
-    if (log)
-      log->Printf("%s - encoding error in snprintf().", __FUNCTION__);
+    LLDB_LOGF(log, "%s - encoding error in snprintf().", __FUNCTION__);
     return false;
   } else if (written >= jit_max_expr_size) {
-    if (log)
-      log->Printf("%s - expression too long.", __FUNCTION__);
+    LLDB_LOGF(log, "%s - expression too long.", __FUNCTION__);
     return false;
   }
 
@@ -2354,9 +2283,8 @@ void RenderScriptRuntime::FindStructType
     // '#rs_padding_[0-9]+'
     if (found && num_children < elem.children.size()) {
       const uint32_t size_diff = elem.children.size() - num_children;
-      if (log)
-        log->Printf("%s - %" PRIu32 " padding struct entries", __FUNCTION__,
-                    size_diff);
+      LLDB_LOGF(log, "%s - %" PRIu32 " padding struct entries", __FUNCTION__,
+                size_diff);
 
       for (uint32_t i = 0; i < size_diff; ++i) {
         ConstString name = elem.children[num_children + i].type_name;
@@ -2377,9 +2305,8 @@ void RenderScriptRuntime::FindStructType
 
       // Save name of variable in Element.
       elem.type_name = valobj_sp->GetTypeName();
-      if (log)
-        log->Printf("%s - element name set to %s", __FUNCTION__,
-                    elem.type_name.AsCString());
+      LLDB_LOGF(log, "%s - element name set to %s", __FUNCTION__,
+                elem.type_name.AsCString());
 
       return;
     }
@@ -2424,9 +2351,8 @@ void RenderScriptRuntime::SetElementSize
 
   elem.padding = padding;
   elem.datum_size = data_size + padding;
-  if (log)
-    log->Printf("%s - element size set to %" PRIu32, __FUNCTION__,
-                data_size + padding);
+  LLDB_LOGF(log, "%s - element size set to %" PRIu32, __FUNCTION__,
+            data_size + padding);
 }
 
 // Given an allocation, this function copies the allocation contents from
@@ -2439,13 +2365,11 @@ RenderScriptRuntime::GetAllocationData(A
 
   // JIT all the allocation details
   if (alloc->ShouldRefresh()) {
-    if (log)
-      log->Printf("%s - allocation details not calculated yet, jitting info",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "%s - allocation details not calculated yet, jitting info",
+              __FUNCTION__);
 
     if (!RefreshAllocation(alloc, frame_ptr)) {
-      if (log)
-        log->Printf("%s - couldn't JIT allocation details", __FUNCTION__);
+      LLDB_LOGF(log, "%s - couldn't JIT allocation details", __FUNCTION__);
       return nullptr;
     }
   }
@@ -2458,9 +2382,8 @@ RenderScriptRuntime::GetAllocationData(A
   const uint32_t size = *alloc->size.get();
   std::shared_ptr<uint8_t> buffer(new uint8_t[size]);
   if (!buffer) {
-    if (log)
-      log->Printf("%s - couldn't allocate a %" PRIu32 " byte buffer",
-                  __FUNCTION__, size);
+    LLDB_LOGF(log, "%s - couldn't allocate a %" PRIu32 " byte buffer",
+              __FUNCTION__, size);
     return nullptr;
   }
 
@@ -2469,10 +2392,10 @@ RenderScriptRuntime::GetAllocationData(A
   lldb::addr_t data_ptr = *alloc->data_ptr.get();
   GetProcess()->ReadMemory(data_ptr, buffer.get(), size, err);
   if (err.Fail()) {
-    if (log)
-      log->Printf("%s - '%s' Couldn't read %" PRIu32
-                  " bytes of allocation data from 0x%" PRIx64,
-                  __FUNCTION__, err.AsCString(), size, data_ptr);
+    LLDB_LOGF(log,
+              "%s - '%s' Couldn't read %" PRIu32
+              " bytes of allocation data from 0x%" PRIx64,
+              __FUNCTION__, err.AsCString(), size, data_ptr);
     return nullptr;
   }
 
@@ -2493,19 +2416,16 @@ bool RenderScriptRuntime::LoadAllocation
   if (!alloc)
     return false;
 
-  if (log)
-    log->Printf("%s - found allocation 0x%" PRIx64, __FUNCTION__,
-                *alloc->address.get());
+  LLDB_LOGF(log, "%s - found allocation 0x%" PRIx64, __FUNCTION__,
+            *alloc->address.get());
 
   // JIT all the allocation details
   if (alloc->ShouldRefresh()) {
-    if (log)
-      log->Printf("%s - allocation details not calculated yet, jitting info.",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "%s - allocation details not calculated yet, jitting info.",
+              __FUNCTION__);
 
     if (!RefreshAllocation(alloc, frame_ptr)) {
-      if (log)
-        log->Printf("%s - couldn't JIT allocation details", __FUNCTION__);
+      LLDB_LOGF(log, "%s - couldn't JIT allocation details", __FUNCTION__);
       return false;
     }
   }
@@ -2559,9 +2479,8 @@ bool RenderScriptRuntime::LoadAllocation
                            sizeof(AllocationDetails::FileHeader),
          sizeof(AllocationDetails::ElementHeader));
 
-  if (log)
-    log->Printf("%s - header type %" PRIu32 ", element size %" PRIu32,
-                __FUNCTION__, root_el_hdr.type, root_el_hdr.element_size);
+  LLDB_LOGF(log, "%s - header type %" PRIu32 ", element size %" PRIu32,
+            __FUNCTION__, root_el_hdr.type, root_el_hdr.element_size);
 
   // Check if the target allocation and file both have the same number of bytes
   // for an Element
@@ -2717,19 +2636,16 @@ bool RenderScriptRuntime::SaveAllocation
   if (!alloc)
     return false;
 
-  if (log)
-    log->Printf("%s - found allocation 0x%" PRIx64 ".", __FUNCTION__,
-                *alloc->address.get());
+  LLDB_LOGF(log, "%s - found allocation 0x%" PRIx64 ".", __FUNCTION__,
+            *alloc->address.get());
 
   // JIT all the allocation details
   if (alloc->ShouldRefresh()) {
-    if (log)
-      log->Printf("%s - allocation details not calculated yet, jitting info.",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "%s - allocation details not calculated yet, jitting info.",
+              __FUNCTION__);
 
     if (!RefreshAllocation(alloc, frame_ptr)) {
-      if (log)
-        log->Printf("%s - couldn't JIT allocation details.", __FUNCTION__);
+      LLDB_LOGF(log, "%s - couldn't JIT allocation details.", __FUNCTION__);
       return false;
     }
   }
@@ -2779,9 +2695,8 @@ bool RenderScriptRuntime::SaveAllocation
 
   // Write the file header
   size_t num_bytes = sizeof(AllocationDetails::FileHeader);
-  if (log)
-    log->Printf("%s - writing File Header, 0x%" PRIx64 " bytes", __FUNCTION__,
-                (uint64_t)num_bytes);
+  LLDB_LOGF(log, "%s - writing File Header, 0x%" PRIx64 " bytes", __FUNCTION__,
+            (uint64_t)num_bytes);
 
   Status err = file.Write(&head, num_bytes);
   if (!err.Success()) {
@@ -2805,9 +2720,8 @@ bool RenderScriptRuntime::SaveAllocation
 
   // Write headers for allocation element type to file
   num_bytes = element_header_size;
-  if (log)
-    log->Printf("%s - writing element headers, 0x%" PRIx64 " bytes.",
-                __FUNCTION__, (uint64_t)num_bytes);
+  LLDB_LOGF(log, "%s - writing element headers, 0x%" PRIx64 " bytes.",
+            __FUNCTION__, (uint64_t)num_bytes);
 
   err = file.Write(element_header_buffer.get(), num_bytes);
   if (!err.Success()) {
@@ -2818,9 +2732,8 @@ bool RenderScriptRuntime::SaveAllocation
 
   // Write allocation data to file
   num_bytes = static_cast<size_t>(*alloc->size.get());
-  if (log)
-    log->Printf("%s - writing 0x%" PRIx64 " bytes", __FUNCTION__,
-                (uint64_t)num_bytes);
+  LLDB_LOGF(log, "%s - writing 0x%" PRIx64 " bytes", __FUNCTION__,
+            (uint64_t)num_bytes);
 
   err = file.Write(buffer.get(), num_bytes);
   if (!err.Success()) {
@@ -2894,17 +2807,17 @@ bool RenderScriptRuntime::LoadModule(con
           addr_t addr = debug_present->GetLoadAddress(&target);
           GetProcess()->WriteMemory(addr, &flag, sizeof(flag), err);
           if (err.Success()) {
-            if (log)
-              log->Printf("%s - debugger present flag set on debugee.",
-                          __FUNCTION__);
+            LLDB_LOGF(log, "%s - debugger present flag set on debugee.",
+                      __FUNCTION__);
 
             m_debuggerPresentFlagged = true;
           } else if (log) {
-            log->Printf("%s - error writing debugger present flags '%s' ",
-                        __FUNCTION__, err.AsCString());
+            LLDB_LOGF(log, "%s - error writing debugger present flags '%s' ",
+                      __FUNCTION__, err.AsCString());
           }
         } else if (log) {
-          log->Printf(
+          LLDB_LOGF(
+              log,
               "%s - error writing debugger present flags - symbol not found",
               __FUNCTION__);
         }
@@ -3004,8 +2917,7 @@ bool RSModuleDescriptor::ParseExportRedu
       return false;
     }
 
-    if (log)
-      log->Printf("Found RenderScript reduction '%s'", spec[2].str().c_str());
+    LLDB_LOGF(log, "Found RenderScript reduction '%s'", spec[2].str().c_str());
 
     m_reductions.push_back(RSReductionDescriptor(this, sig, accum_data_size,
                                                  spec[2], spec[3], spec[4],
@@ -3082,10 +2994,8 @@ bool RSModuleDescriptor::ParseRSInfo() {
   {
     const llvm::StringRef raw_rs_info((const char *)buffer->GetBytes());
     raw_rs_info.split(info_lines, '\n');
-    if (log)
-      log->Printf("'.rs.info symbol for '%s':\n%s",
-                  m_module->GetFileSpec().GetCString(),
-                  raw_rs_info.str().c_str());
+    LLDB_LOGF(log, "'.rs.info symbol for '%s':\n%s",
+              m_module->GetFileSpec().GetCString(), raw_rs_info.str().c_str());
   }
 
   enum {
@@ -3153,9 +3063,8 @@ bool RSModuleDescriptor::ParseRSInfo() {
       success = ParseVersionInfo(line, n_lines);
       break;
     default: {
-      if (log)
-        log->Printf("%s - skipping .rs.info field '%s'", __FUNCTION__,
-                    line->str().c_str());
+      LLDB_LOGF(log, "%s - skipping .rs.info field '%s'", __FUNCTION__,
+                line->str().c_str());
       continue;
     }
     }
@@ -3276,15 +3185,13 @@ bool RenderScriptRuntime::DumpAllocation
   if (!alloc)
     return false; // FindAllocByID() will print error message for us here
 
-  if (log)
-    log->Printf("%s - found allocation 0x%" PRIx64, __FUNCTION__,
-                *alloc->address.get());
+  LLDB_LOGF(log, "%s - found allocation 0x%" PRIx64, __FUNCTION__,
+            *alloc->address.get());
 
   // Check we have information about the allocation, if not calculate it
   if (alloc->ShouldRefresh()) {
-    if (log)
-      log->Printf("%s - allocation details not calculated yet, jitting info.",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "%s - allocation details not calculated yet, jitting info.",
+              __FUNCTION__);
 
     // JIT all the allocation information
     if (!RefreshAllocation(alloc, frame_ptr)) {
@@ -3313,9 +3220,8 @@ bool RenderScriptRuntime::DumpAllocation
 
   const uint32_t data_size = *alloc->element.datum_size.get();
 
-  if (log)
-    log->Printf("%s - element size %" PRIu32 " bytes, including padding",
-                __FUNCTION__, data_size);
+  LLDB_LOGF(log, "%s - element size %" PRIu32 " bytes, including padding",
+            __FUNCTION__, data_size);
 
   // Allocate a buffer to copy data into
   std::shared_ptr<uint8_t> buffer = GetAllocationData(alloc, frame_ptr);
@@ -3340,10 +3246,10 @@ bool RenderScriptRuntime::DumpAllocation
   const uint32_t size = *alloc->size.get(); // Size of whole allocation
   const uint32_t padding =
       alloc->element.padding.isValid() ? *alloc->element.padding.get() : 0;
-  if (log)
-    log->Printf("%s - stride %" PRIu32 " bytes, size %" PRIu32
-                " bytes, padding %" PRIu32,
-                __FUNCTION__, stride, size, padding);
+  LLDB_LOGF(log,
+            "%s - stride %" PRIu32 " bytes, size %" PRIu32
+            " bytes, padding %" PRIu32,
+            __FUNCTION__, stride, size, padding);
 
   // Find dimensions used to index loops, so need to be non-zero
   uint32_t dim_x = alloc->dimension.get()->dim_1;
@@ -3395,8 +3301,7 @@ bool RenderScriptRuntime::DumpAllocation
                        *alloc->data_ptr.get() + offset);
 
           if (written < 0 || written >= jit_max_expr_size) {
-            if (log)
-              log->Printf("%s - error in snprintf().", __FUNCTION__);
+            LLDB_LOGF(log, "%s - error in snprintf().", __FUNCTION__);
             continue;
           }
 
@@ -3573,17 +3478,16 @@ void RenderScriptRuntime::SetBreakAllKer
     for (const auto &module : m_rsmodules)
       BreakOnModuleKernels(module);
 
-    if (log)
-      log->Printf("%s(True) - breakpoints set on all currently loaded kernels.",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "%s(True) - breakpoints set on all currently loaded kernels.",
+              __FUNCTION__);
   } else if (!do_break &&
              m_breakAllKernels) // Breakpoints won't be set on any new kernels.
   {
     m_breakAllKernels = false;
 
-    if (log)
-      log->Printf("%s(False) - breakpoints no longer automatically set.",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "%s(False) - breakpoints no longer automatically set.",
+              __FUNCTION__);
   }
 }
 
@@ -3595,8 +3499,8 @@ RenderScriptRuntime::CreateKernelBreakpo
       GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS));
 
   if (!m_filtersp) {
-    if (log)
-      log->Printf("%s - error, no breakpoint search filter set.", __FUNCTION__);
+    LLDB_LOGF(log, "%s - error, no breakpoint search filter set.",
+              __FUNCTION__);
     return nullptr;
   }
 
@@ -3610,9 +3514,8 @@ RenderScriptRuntime::CreateKernelBreakpo
   Status err;
   target.AddNameToBreakpoint(bp, "RenderScriptKernel", err);
   if (err.Fail() && log)
-    if (log)
-      log->Printf("%s - error setting break name, '%s'.", __FUNCTION__,
-                  err.AsCString());
+    LLDB_LOGF(log, "%s - error setting break name, '%s'.", __FUNCTION__,
+              err.AsCString());
 
   return bp;
 }
@@ -3624,8 +3527,8 @@ RenderScriptRuntime::CreateReductionBrea
       GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS));
 
   if (!m_filtersp) {
-    if (log)
-      log->Printf("%s - error, no breakpoint search filter set.", __FUNCTION__);
+    LLDB_LOGF(log, "%s - error, no breakpoint search filter set.",
+              __FUNCTION__);
     return nullptr;
   }
 
@@ -3640,8 +3543,8 @@ RenderScriptRuntime::CreateReductionBrea
   Status err;
   target.AddNameToBreakpoint(bp, "RenderScriptReduction", err);
   if (err.Fail() && log)
-      log->Printf("%s - error setting break name, '%s'.", __FUNCTION__,
-                  err.AsCString());
+    LLDB_LOGF(log, "%s - error setting break name, '%s'.", __FUNCTION__,
+              err.AsCString());
 
   return bp;
 }
@@ -3663,9 +3566,8 @@ bool RenderScriptRuntime::GetFrameVarAsU
           StackFrame::eExpressionPathOptionsAllowDirectIVarAccess,
       var_sp, err));
   if (!err.Success()) {
-    if (log)
-      log->Printf("%s - error, couldn't find '%s' in frame", __FUNCTION__,
-                  var_name);
+    LLDB_LOGF(log, "%s - error, couldn't find '%s' in frame", __FUNCTION__,
+              var_name);
     return false;
   }
 
@@ -3673,9 +3575,8 @@ bool RenderScriptRuntime::GetFrameVarAsU
   bool success = false;
   val = value_sp->GetValueAsUnsigned(0, &success);
   if (!success) {
-    if (log)
-      log->Printf("%s - error, couldn't parse '%s' as an uint32_t.",
-                  __FUNCTION__, var_name);
+    LLDB_LOGF(log, "%s - error, couldn't parse '%s' as an uint32_t.",
+              __FUNCTION__, var_name);
     return false;
   }
 
@@ -3695,8 +3596,7 @@ bool RenderScriptRuntime::GetKernelCoord
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE));
 
   if (!thread_ptr) {
-    if (log)
-      log->Printf("%s - Error, No thread pointer", __FUNCTION__);
+    LLDB_LOGF(log, "%s - Error, No thread pointer", __FUNCTION__);
 
     return false;
   }
@@ -3718,17 +3618,15 @@ bool RenderScriptRuntime::GetKernelCoord
     if (!func_name)
       continue;
 
-    if (log)
-      log->Printf("%s - Inspecting function '%s'", __FUNCTION__,
-                  func_name.GetCString());
+    LLDB_LOGF(log, "%s - Inspecting function '%s'", __FUNCTION__,
+              func_name.GetCString());
 
     // Check if function name has .expand suffix
     if (!func_name.GetStringRef().endswith(".expand"))
       continue;
 
-    if (log)
-      log->Printf("%s - Found .expand function '%s'", __FUNCTION__,
-                  func_name.GetCString());
+    LLDB_LOGF(log, "%s - Found .expand function '%s'", __FUNCTION__,
+              func_name.GetCString());
 
     // Get values for variables in .expand frame that tell us the current
     // kernel invocation
@@ -3770,9 +3668,8 @@ bool RenderScriptRuntime::KernelBreakpoi
   // Coordinate we want to stop on
   RSCoordinate target_coord = *static_cast<RSCoordinate *>(baton);
 
-  if (log)
-    log->Printf("%s - Break ID %" PRIu64 ", " FMT_COORD, __FUNCTION__, break_id,
-                target_coord.x, target_coord.y, target_coord.z);
+  LLDB_LOGF(log, "%s - Break ID %" PRIu64 ", " FMT_COORD, __FUNCTION__,
+            break_id, target_coord.x, target_coord.y, target_coord.z);
 
   // Select current thread
   ExecutionContext context(ctx->exe_ctx_ref);
@@ -3782,22 +3679,19 @@ bool RenderScriptRuntime::KernelBreakpoi
   // Find current kernel invocation from .expand frame variables
   RSCoordinate current_coord{};
   if (!GetKernelCoordinate(current_coord, thread_ptr)) {
-    if (log)
-      log->Printf("%s - Error, couldn't select .expand stack frame",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "%s - Error, couldn't select .expand stack frame",
+              __FUNCTION__);
     return false;
   }
 
-  if (log)
-    log->Printf("%s - " FMT_COORD, __FUNCTION__, current_coord.x,
-                current_coord.y, current_coord.z);
+  LLDB_LOGF(log, "%s - " FMT_COORD, __FUNCTION__, current_coord.x,
+            current_coord.y, current_coord.z);
 
   // Check if the current kernel invocation coordinate matches our target
   // coordinate
   if (target_coord == current_coord) {
-    if (log)
-      log->Printf("%s, BREAKING " FMT_COORD, __FUNCTION__, current_coord.x,
-                  current_coord.y, current_coord.z);
+    LLDB_LOGF(log, "%s, BREAKING " FMT_COORD, __FUNCTION__, current_coord.x,
+              current_coord.y, current_coord.z);
 
     BreakpointSP breakpoint_sp =
         context.GetTargetPtr()->GetBreakpointByID(break_id);
@@ -3865,8 +3759,8 @@ RenderScriptRuntime::CreateScriptGroupBr
       GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS));
 
   if (!m_filtersp) {
-    if (log)
-      log->Printf("%s - error, no breakpoint search filter set.", __FUNCTION__);
+    LLDB_LOGF(log, "%s - error, no breakpoint search filter set.",
+              __FUNCTION__);
     return nullptr;
   }
 
@@ -3880,8 +3774,8 @@ RenderScriptRuntime::CreateScriptGroupBr
   Status err;
   target.AddNameToBreakpoint(bp, name.GetCString(), err);
   if (err.Fail() && log)
-    log->Printf("%s - error setting break name, '%s'.", __FUNCTION__,
-                err.AsCString());
+    LLDB_LOGF(log, "%s - error setting break name, '%s'.", __FUNCTION__,
+              err.AsCString());
   // ask the breakpoint to resolve itself
   bp->ResolveBreakpoint();
   return bp;
@@ -3964,9 +3858,8 @@ RenderScriptRuntime::CreateAllocation(ad
   auto it = m_allocations.begin();
   while (it != m_allocations.end()) {
     if (*((*it)->address) == address) {
-      if (log)
-        log->Printf("%s - Removing allocation id: %d, address: 0x%" PRIx64,
-                    __FUNCTION__, (*it)->id, address);
+      LLDB_LOGF(log, "%s - Removing allocation id: %d, address: 0x%" PRIx64,
+                __FUNCTION__, (*it)->id, address);
 
       it = m_allocations.erase(it);
     } else {
@@ -3988,9 +3881,8 @@ bool RenderScriptRuntime::ResolveKernelN
   Address resolved;
   // RenderScript module
   if (!target.GetSectionLoadList().ResolveLoadAddress(kernel_addr, resolved)) {
-    if (log)
-      log->Printf("%s: unable to resolve 0x%" PRIx64 " to a loaded symbol",
-                  __FUNCTION__, kernel_addr);
+    LLDB_LOGF(log, "%s: unable to resolve 0x%" PRIx64 " to a loaded symbol",
+              __FUNCTION__, kernel_addr);
     return false;
   }
 
@@ -4000,9 +3892,8 @@ bool RenderScriptRuntime::ResolveKernelN
 
   name = sym->GetName();
   assert(IsRenderScriptModule(resolved.CalculateSymbolContextModule()));
-  if (log)
-    log->Printf("%s: 0x%" PRIx64 " resolved to the symbol '%s'", __FUNCTION__,
-                kernel_addr, name.GetCString());
+  LLDB_LOGF(log, "%s: 0x%" PRIx64 " resolved to the symbol '%s'", __FUNCTION__,
+            kernel_addr, name.GetCString());
   return true;
 }
 

Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp Wed Jul 24 10:56:10 2019
@@ -93,9 +93,8 @@ llvm::FunctionType *cloneToStructRetFnTy
   assert(orig && "CallInst has no called function");
   llvm::FunctionType *orig_type = orig->getFunctionType();
   auto name = orig->getName();
-  if (log)
-    log->Printf("%s - cloning to StructRet function for '%s'", __FUNCTION__,
-                name.str().c_str());
+  LLDB_LOGF(log, "%s - cloning to StructRet function for '%s'", __FUNCTION__,
+            name.str().c_str());
 
   unsigned num_params = orig_type->getNumParams();
   std::vector<llvm::Type *> new_params{num_params + 1, nullptr};
@@ -113,9 +112,9 @@ llvm::FunctionType *cloneToStructRetFnTy
   if (!return_type_ptr_type)
     return nullptr;
 
-  if (log)
-    log->Printf("%s - return type pointer type for StructRet clone @ '0x%p':\n",
-                __FUNCTION__, (void *)return_type_ptr_type);
+  LLDB_LOGF(log,
+            "%s - return type pointer type for StructRet clone @ '0x%p':\n",
+            __FUNCTION__, (void *)return_type_ptr_type);
   // put the sret pointer argument in place at the beginning of the
   // argument list.
   params.emplace(params.begin(), return_type_ptr_type);

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Wed Jul 24 10:56:10 2019
@@ -264,8 +264,7 @@ bool ELFNote::Parse(const DataExtractor
   const char *cstr = data.GetCStr(offset, llvm::alignTo(n_namesz, 4));
   if (cstr == nullptr) {
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS));
-    if (log)
-      log->Printf("Failed to parse note name lacking nul terminator");
+    LLDB_LOGF(log, "Failed to parse note name lacking nul terminator");
 
     return false;
   }
@@ -608,10 +607,9 @@ size_t ObjectFileELF::GetModuleSpecifica
           llvm::Triple::OSType spec_ostype =
               spec.GetArchitecture().GetTriple().getOS();
 
-          if (log)
-            log->Printf("ObjectFileELF::%s file '%s' module OSABI: %s",
-                        __FUNCTION__, file.GetPath().c_str(),
-                        OSABIAsCString(header.e_ident[EI_OSABI]));
+          LLDB_LOGF(log, "ObjectFileELF::%s file '%s' module OSABI: %s",
+                    __FUNCTION__, file.GetPath().c_str(),
+                    OSABIAsCString(header.e_ident[EI_OSABI]));
 
           // SetArchitecture should have set the vendor to unknown
           vendor = spec.GetArchitecture().GetTriple().getVendor();
@@ -623,10 +621,10 @@ size_t ObjectFileELF::GetModuleSpecifica
           GetOsFromOSABI(header.e_ident[EI_OSABI], ostype);
           assert(spec_ostype == ostype);
           if (spec_ostype != llvm::Triple::OSType::UnknownOS) {
-            if (log)
-              log->Printf("ObjectFileELF::%s file '%s' set ELF module OS type "
-                          "from ELF header OSABI.",
-                          __FUNCTION__, file.GetPath().c_str());
+            LLDB_LOGF(log,
+                      "ObjectFileELF::%s file '%s' set ELF module OS type "
+                      "from ELF header OSABI.",
+                      __FUNCTION__, file.GetPath().c_str());
           }
 
           data_sp = MapFileData(file, -1, file_offset);
@@ -652,12 +650,12 @@ size_t ObjectFileELF::GetModuleSpecifica
 
           llvm::Triple &spec_triple = spec.GetArchitecture().GetTriple();
 
-          if (log)
-            log->Printf("ObjectFileELF::%s file '%s' module set to triple: %s "
-                        "(architecture %s)",
-                        __FUNCTION__, file.GetPath().c_str(),
-                        spec_triple.getTriple().c_str(),
-                        spec.GetArchitecture().GetArchitectureName());
+          LLDB_LOGF(log,
+                    "ObjectFileELF::%s file '%s' module set to triple: %s "
+                    "(architecture %s)",
+                    __FUNCTION__, file.GetPath().c_str(),
+                    spec_triple.getTriple().c_str(),
+                    spec.GetArchitecture().GetArchitectureName());
 
           if (!uuid.IsValid()) {
             uint32_t core_notes_crc = 0;
@@ -1109,9 +1107,8 @@ ObjectFileELF::RefineModuleDetailsFromNo
       return error;
     }
 
-    if (log)
-      log->Printf("ObjectFileELF::%s parsing note name='%s', type=%" PRIu32,
-                  __FUNCTION__, note.n_name.c_str(), note.n_type);
+    LLDB_LOGF(log, "ObjectFileELF::%s parsing note name='%s', type=%" PRIu32,
+              __FUNCTION__, note.n_name.c_str(), note.n_type);
 
     // Process FreeBSD ELF notes.
     if ((note.n_name == LLDB_NT_OWNER_FREEBSD) &&
@@ -1136,11 +1133,11 @@ ObjectFileELF::RefineModuleDetailsFromNo
       arch_spec.GetTriple().setOSName(os_name);
       arch_spec.GetTriple().setVendor(llvm::Triple::VendorType::UnknownVendor);
 
-      if (log)
-        log->Printf("ObjectFileELF::%s detected FreeBSD %" PRIu32 ".%" PRIu32
-                    ".%" PRIu32,
-                    __FUNCTION__, version_major, version_minor,
-                    static_cast<uint32_t>(version_info % 1000));
+      LLDB_LOGF(log,
+                "ObjectFileELF::%s detected FreeBSD %" PRIu32 ".%" PRIu32
+                ".%" PRIu32,
+                __FUNCTION__, version_major, version_minor,
+                static_cast<uint32_t>(version_info % 1000));
     }
     // Process GNU ELF notes.
     else if (note.n_name == LLDB_NT_OWNER_GNU) {
@@ -1161,12 +1158,11 @@ ObjectFileELF::RefineModuleDetailsFromNo
             arch_spec.GetTriple().setOS(llvm::Triple::OSType::Linux);
             arch_spec.GetTriple().setVendor(
                 llvm::Triple::VendorType::UnknownVendor);
-            if (log)
-              log->Printf(
-                  "ObjectFileELF::%s detected Linux, min version %" PRIu32
-                  ".%" PRIu32 ".%" PRIu32,
-                  __FUNCTION__, version_info[1], version_info[2],
-                  version_info[3]);
+            LLDB_LOGF(log,
+                      "ObjectFileELF::%s detected Linux, min version %" PRIu32
+                      ".%" PRIu32 ".%" PRIu32,
+                      __FUNCTION__, version_info[1], version_info[2],
+                      version_info[3]);
             // FIXME we have the minimal version number, we could be propagating
             // that.  version_info[1] = OS Major, version_info[2] = OS Minor,
             // version_info[3] = Revision.
@@ -1175,30 +1171,28 @@ ObjectFileELF::RefineModuleDetailsFromNo
             arch_spec.GetTriple().setOS(llvm::Triple::OSType::UnknownOS);
             arch_spec.GetTriple().setVendor(
                 llvm::Triple::VendorType::UnknownVendor);
-            if (log)
-              log->Printf("ObjectFileELF::%s detected Hurd (unsupported), min "
-                          "version %" PRIu32 ".%" PRIu32 ".%" PRIu32,
-                          __FUNCTION__, version_info[1], version_info[2],
-                          version_info[3]);
+            LLDB_LOGF(log,
+                      "ObjectFileELF::%s detected Hurd (unsupported), min "
+                      "version %" PRIu32 ".%" PRIu32 ".%" PRIu32,
+                      __FUNCTION__, version_info[1], version_info[2],
+                      version_info[3]);
             break;
           case LLDB_NT_GNU_ABI_OS_SOLARIS:
             arch_spec.GetTriple().setOS(llvm::Triple::OSType::Solaris);
             arch_spec.GetTriple().setVendor(
                 llvm::Triple::VendorType::UnknownVendor);
-            if (log)
-              log->Printf(
-                  "ObjectFileELF::%s detected Solaris, min version %" PRIu32
-                  ".%" PRIu32 ".%" PRIu32,
-                  __FUNCTION__, version_info[1], version_info[2],
-                  version_info[3]);
+            LLDB_LOGF(log,
+                      "ObjectFileELF::%s detected Solaris, min version %" PRIu32
+                      ".%" PRIu32 ".%" PRIu32,
+                      __FUNCTION__, version_info[1], version_info[2],
+                      version_info[3]);
             break;
           default:
-            if (log)
-              log->Printf(
-                  "ObjectFileELF::%s unrecognized OS in note, id %" PRIu32
-                  ", min version %" PRIu32 ".%" PRIu32 ".%" PRIu32,
-                  __FUNCTION__, version_info[0], version_info[1],
-                  version_info[2], version_info[3]);
+            LLDB_LOGF(log,
+                      "ObjectFileELF::%s unrecognized OS in note, id %" PRIu32
+                      ", min version %" PRIu32 ".%" PRIu32 ".%" PRIu32,
+                      __FUNCTION__, version_info[0], version_info[1],
+                      version_info[2], version_info[3]);
             break;
           }
         }
@@ -1607,9 +1601,8 @@ size_t ObjectFileELF::GetSectionHeaderIn
                                             section_size) == section_size)) {
             Status error = RefineModuleDetailsFromNote(data, arch_spec, uuid);
             if (error.Fail()) {
-              if (log)
-                log->Printf("ObjectFileELF::%s ELF note processing failed: %s",
-                            __FUNCTION__, error.AsCString());
+              LLDB_LOGF(log, "ObjectFileELF::%s ELF note processing failed: %s",
+                        __FUNCTION__, error.AsCString());
             }
           }
         }
@@ -2643,7 +2636,7 @@ unsigned ObjectFileELF::ApplyRelocations
                ((int64_t)value > INT32_MAX && (int64_t)value < INT32_MIN))) {
             Log *log =
                 lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES);
-            log->Printf("Failed to apply debug info relocations");
+            LLDB_LOGF(log, "Failed to apply debug info relocations");
             break;
           }
           uint32_t truncated_addr = (value & 0xFFFFFFFF);

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Wed Jul 24 10:56:10 2019
@@ -2103,8 +2103,9 @@ UUID ObjectFileMachO::GetSharedCacheUUID
   }
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS));
   if (log && dsc_uuid.IsValid()) {
-    log->Printf("Shared cache %s has UUID %s", dyld_shared_cache.GetPath().c_str(), 
-                dsc_uuid.GetAsString().c_str());
+    LLDB_LOGF(log, "Shared cache %s has UUID %s",
+              dyld_shared_cache.GetPath().c_str(),
+              dsc_uuid.GetAsString().c_str());
   }
   return dsc_uuid;
 }
@@ -4933,8 +4934,7 @@ namespace {
       default: {
         Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS |
                                                         LIBLLDB_LOG_PROCESS));
-        if (log)
-          log->Printf("unsupported platform in LC_BUILD_VERSION");
+        LLDB_LOGF(log, "unsupported platform in LC_BUILD_VERSION");
       }
       }
     }
@@ -5718,8 +5718,10 @@ void ObjectFileMachO::GetProcessSharedCa
                                   private_shared_cache);
   }
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS | LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("inferior process shared cache has a UUID of %s, base address 0x%" PRIx64 , uuid.GetAsString().c_str(), base_addr);
+  LLDB_LOGF(
+      log,
+      "inferior process shared cache has a UUID of %s, base address 0x%" PRIx64,
+      uuid.GetAsString().c_str(), base_addr);
 }
 
 // From dyld SPI header dyld_process_info.h
@@ -5804,7 +5806,10 @@ void ObjectFileMachO::GetLLDBSharedCache
   }
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS | LIBLLDB_LOG_PROCESS));
   if (log && uuid.IsValid())
-    log->Printf("lldb's in-memory shared cache has a UUID of %s base address of 0x%" PRIx64, uuid.GetAsString().c_str(), base_addr);
+    LLDB_LOGF(log,
+              "lldb's in-memory shared cache has a UUID of %s base address of "
+              "0x%" PRIx64,
+              uuid.GetAsString().c_str(), base_addr);
 #endif
 }
 

Modified: lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Wed Jul 24 10:56:10 2019
@@ -235,11 +235,11 @@ bool ObjectFilePECOFF::CreateBinary() {
 
   auto binary = llvm::object::createBinary(m_file.GetPath());
   if (!binary) {
-    if (log)
-      log->Printf("ObjectFilePECOFF::CreateBinary() - failed to create binary "
-                  "for file (%s): %s",
-                  m_file ? m_file.GetPath().c_str() : "<NULL>",
-                  errorToErrorCode(binary.takeError()).message().c_str());
+    LLDB_LOGF(log,
+              "ObjectFilePECOFF::CreateBinary() - failed to create binary "
+              "for file (%s): %s",
+              m_file ? m_file.GetPath().c_str() : "<NULL>",
+              errorToErrorCode(binary.takeError()).message().c_str());
     return false;
   }
 
@@ -249,15 +249,14 @@ bool ObjectFilePECOFF::CreateBinary() {
     return false;
 
   m_owningbin = OWNBINType(std::move(*binary));
-  if (log)
-    log->Printf("%p ObjectFilePECOFF::CreateBinary() module = %p (%s), file = "
-                "%s, binary = %p (Bin = %p)",
-                static_cast<void *>(this),
-                static_cast<void *>(GetModule().get()),
-                GetModule()->GetSpecificationDescription().c_str(),
-                m_file ? m_file.GetPath().c_str() : "<NULL>",
-                static_cast<void *>(m_owningbin.getPointer()),
-                static_cast<void *>(m_owningbin->getBinary()));
+  LLDB_LOGF(log,
+            "%p ObjectFilePECOFF::CreateBinary() module = %p (%s), file = "
+            "%s, binary = %p (Bin = %p)",
+            static_cast<void *>(this), static_cast<void *>(GetModule().get()),
+            GetModule()->GetSpecificationDescription().c_str(),
+            m_file ? m_file.GetPath().c_str() : "<NULL>",
+            static_cast<void *>(m_owningbin.getPointer()),
+            static_cast<void *>(m_owningbin->getBinary()));
   return true;
 }
 
@@ -911,13 +910,13 @@ uint32_t ObjectFilePECOFF::ParseDependen
     return 0;
 
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
-  if (log)
-    log->Printf("%p ObjectFilePECOFF::ParseDependentModules() module = %p "
-                "(%s), binary = %p (Bin = %p)",
-                static_cast<void *>(this), static_cast<void *>(module_sp.get()),
-                module_sp->GetSpecificationDescription().c_str(),
-                static_cast<void *>(m_owningbin.getPointer()),
-                static_cast<void *>(m_owningbin->getBinary()));
+  LLDB_LOGF(log,
+            "%p ObjectFilePECOFF::ParseDependentModules() module = %p "
+            "(%s), binary = %p (Bin = %p)",
+            static_cast<void *>(this), static_cast<void *>(module_sp.get()),
+            module_sp->GetSpecificationDescription().c_str(),
+            static_cast<void *>(m_owningbin.getPointer()),
+            static_cast<void *>(m_owningbin->getBinary()));
 
   auto COFFObj =
       llvm::dyn_cast<llvm::object::COFFObjectFile>(m_owningbin->getBinary());
@@ -931,10 +930,10 @@ uint32_t ObjectFilePECOFF::ParseDependen
     auto ec = entry.getName(dll_name);
     // Report a bogus entry.
     if (ec != std::error_code()) {
-      if (log)
-        log->Printf("ObjectFilePECOFF::ParseDependentModules() - failed to get "
-                    "import directory entry name: %s",
-                    ec.message().c_str());
+      LLDB_LOGF(log,
+                "ObjectFilePECOFF::ParseDependentModules() - failed to get "
+                "import directory entry name: %s",
+                ec.message().c_str());
       continue;
     }
 

Modified: lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp (original)
+++ lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp Wed Jul 24 10:56:10 2019
@@ -120,10 +120,10 @@ DynamicRegisterInfo *OperatingSystemPyth
       return nullptr;
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OS));
 
-    if (log)
-      log->Printf("OperatingSystemPython::GetDynamicRegisterInfo() fetching "
-                  "thread register definitions from python for pid %" PRIu64,
-                  m_process->GetID());
+    LLDB_LOGF(log,
+              "OperatingSystemPython::GetDynamicRegisterInfo() fetching "
+              "thread register definitions from python for pid %" PRIu64,
+              m_process->GetID());
 
     StructuredData::DictionarySP dictionary =
         m_interpreter->OSPlugin_RegisterInfo(m_python_object_sp);
@@ -169,10 +169,10 @@ bool OperatingSystemPython::UpdateThread
   api_lock.try_lock();
   auto interpreter_lock = m_interpreter->AcquireInterpreterLock();
 
-  if (log)
-    log->Printf("OperatingSystemPython::UpdateThreadList() fetching thread "
-                "data from python for pid %" PRIu64,
-                m_process->GetID());
+  LLDB_LOGF(log,
+            "OperatingSystemPython::UpdateThreadList() fetching thread "
+            "data from python for pid %" PRIu64,
+            m_process->GetID());
 
   // The threads that are in "new_thread_list" upon entry are the threads from
   // the lldb_private::Process subclass, no memory threads will be in this
@@ -190,7 +190,7 @@ bool OperatingSystemPython::UpdateThread
     if (log) {
       StreamString strm;
       threads_list->Dump(strm);
-      log->Printf("threads_list = %s", strm.GetData());
+      LLDB_LOGF(log, "threads_list = %s", strm.GetData());
     }
 
     const uint32_t num_threads = threads_list->GetSize();
@@ -316,21 +316,21 @@ OperatingSystemPython::CreateRegisterCon
   if (reg_data_addr != LLDB_INVALID_ADDRESS) {
     // The registers data is in contiguous memory, just create the register
     // context using the address provided
-    if (log)
-      log->Printf("OperatingSystemPython::CreateRegisterContextForThread (tid "
-                  "= 0x%" PRIx64 ", 0x%" PRIx64 ", reg_data_addr = 0x%" PRIx64
-                  ") creating memory register context",
-                  thread->GetID(), thread->GetProtocolID(), reg_data_addr);
+    LLDB_LOGF(log,
+              "OperatingSystemPython::CreateRegisterContextForThread (tid "
+              "= 0x%" PRIx64 ", 0x%" PRIx64 ", reg_data_addr = 0x%" PRIx64
+              ") creating memory register context",
+              thread->GetID(), thread->GetProtocolID(), reg_data_addr);
     reg_ctx_sp = std::make_shared<RegisterContextMemory>(
         *thread, 0, *GetDynamicRegisterInfo(), reg_data_addr);
   } else {
     // No register data address is provided, query the python plug-in to let it
     // make up the data as it sees fit
-    if (log)
-      log->Printf("OperatingSystemPython::CreateRegisterContextForThread (tid "
-                  "= 0x%" PRIx64 ", 0x%" PRIx64
-                  ") fetching register data from python",
-                  thread->GetID(), thread->GetProtocolID());
+    LLDB_LOGF(log,
+              "OperatingSystemPython::CreateRegisterContextForThread (tid "
+              "= 0x%" PRIx64 ", 0x%" PRIx64
+              ") fetching register data from python",
+              thread->GetID(), thread->GetProtocolID());
 
     StructuredData::StringSP reg_context_data =
         m_interpreter->OSPlugin_RegisterContextData(m_python_object_sp,
@@ -351,10 +351,10 @@ OperatingSystemPython::CreateRegisterCon
   // if we still have no register data, fallback on a dummy context to avoid
   // crashing
   if (!reg_ctx_sp) {
-    if (log)
-      log->Printf("OperatingSystemPython::CreateRegisterContextForThread (tid "
-                  "= 0x%" PRIx64 ") forcing a dummy register context",
-                  thread->GetID());
+    LLDB_LOGF(log,
+              "OperatingSystemPython::CreateRegisterContextForThread (tid "
+              "= 0x%" PRIx64 ") forcing a dummy register context",
+              thread->GetID());
     reg_ctx_sp = std::make_shared<RegisterContextDummy>(
         *thread, 0, target.GetArchitecture().GetAddressByteSize());
   }
@@ -375,10 +375,10 @@ lldb::ThreadSP OperatingSystemPython::Cr
                                                    addr_t context) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
 
-  if (log)
-    log->Printf("OperatingSystemPython::CreateThread (tid = 0x%" PRIx64
-                ", context = 0x%" PRIx64 ") fetching register data from python",
-                tid, context);
+  LLDB_LOGF(log,
+            "OperatingSystemPython::CreateThread (tid = 0x%" PRIx64
+            ", context = 0x%" PRIx64 ") fetching register data from python",
+            tid, context);
 
   if (m_interpreter && m_python_object_sp) {
     // First thing we have to do is to try to get the API lock, and the

Modified: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp Wed Jul 24 10:56:10 2019
@@ -68,8 +68,8 @@ PlatformSP PlatformAndroid::CreateInstan
     const char *triple_cstr =
         arch ? arch->GetTriple().getTriple().c_str() : "<null>";
 
-    log->Printf("PlatformAndroid::%s(force=%s, arch={%s,%s})", __FUNCTION__,
-                force ? "true" : "false", arch_name, triple_cstr);
+    LLDB_LOGF(log, "PlatformAndroid::%s(force=%s, arch={%s,%s})", __FUNCTION__,
+              force ? "true" : "false", arch_name, triple_cstr);
   }
 
   bool create = force;
@@ -113,16 +113,14 @@ PlatformSP PlatformAndroid::CreateInstan
   }
 
   if (create) {
-    if (log)
-      log->Printf("PlatformAndroid::%s() creating remote-android platform",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "PlatformAndroid::%s() creating remote-android platform",
+              __FUNCTION__);
     return PlatformSP(new PlatformAndroid(false));
   }
 
-  if (log)
-    log->Printf(
-        "PlatformAndroid::%s() aborting creation of remote-android platform",
-        __FUNCTION__);
+  LLDB_LOGF(
+      log, "PlatformAndroid::%s() aborting creation of remote-android platform",
+      __FUNCTION__);
 
   return PlatformSP();
 }
@@ -212,9 +210,8 @@ Status PlatformAndroid::GetFile(const Fi
   auto source_file = source_spec.GetCString(false);
 
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
-  if (log)
-    log->Printf("Got mode == 0 on '%s': try to get file via 'shell cat'",
-                source_file);
+  LLDB_LOGF(log, "Got mode == 0 on '%s': try to get file via 'shell cat'",
+            source_file);
 
   if (strchr(source_file, '\'') != nullptr)
     return Status("Doesn't support single-quotes in filenames");
@@ -288,9 +285,8 @@ uint32_t PlatformAndroid::GetSdkVersion(
 
   if (error.Fail() || version_string.empty()) {
     Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM);
-    if (log)
-      log->Printf("Get SDK version failed. (error: %s, output: %s)",
-                  error.AsCString(), version_string.c_str());
+    LLDB_LOGF(log, "Get SDK version failed. (error: %s, output: %s)",
+              error.AsCString(), version_string.c_str());
     return 0;
   }
 
@@ -337,7 +333,7 @@ Status PlatformAndroid::DownloadSymbolFi
 
     Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
     if (log && error.Fail())
-      log->Printf("Failed to remove temp directory: %s", error.AsCString());
+      LLDB_LOGF(log, "Failed to remove temp directory: %s", error.AsCString());
   });
 
   FileSpec symfile_platform_filespec(tmpdir);

Modified: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp Wed Jul 24 10:56:10 2019
@@ -36,19 +36,16 @@ static Status ForwardPortWithAdb(
     return error;
 
   device_id = adb.GetDeviceID();
-  if (log)
-    log->Printf("Connected to Android device \"%s\"", device_id.c_str());
+  LLDB_LOGF(log, "Connected to Android device \"%s\"", device_id.c_str());
 
   if (remote_port != 0) {
-    if (log)
-      log->Printf("Forwarding remote TCP port %d to local TCP port %d",
-                  remote_port, local_port);
+    LLDB_LOGF(log, "Forwarding remote TCP port %d to local TCP port %d",
+              remote_port, local_port);
     return adb.SetPortForwarding(local_port, remote_port);
   }
 
-  if (log)
-    log->Printf("Forwarding remote socket \"%s\" to local TCP port %d",
-                remote_socket_name.str().c_str(), local_port);
+  LLDB_LOGF(log, "Forwarding remote socket \"%s\" to local TCP port %d",
+            remote_socket_name.str().c_str(), local_port);
 
   if (!socket_namespace)
     return Status("Invalid socket namespace");
@@ -95,7 +92,7 @@ bool PlatformAndroidRemoteGDBServer::Lau
   auto error =
       MakeConnectURL(pid, remote_port, socket_name.c_str(), connect_url);
   if (error.Success() && log)
-    log->Printf("gdbserver connect URL: %s", connect_url.c_str());
+    LLDB_LOGF(log, "gdbserver connect URL: %s", connect_url.c_str());
 
   return error.Success();
 }
@@ -139,8 +136,7 @@ Status PlatformAndroidRemoteGDBServer::C
   args.ReplaceArgumentAtIndex(0, connect_url);
 
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
-  if (log)
-    log->Printf("Rewritten platform connect URL: %s", connect_url.c_str());
+  LLDB_LOGF(log, "Rewritten platform connect URL: %s", connect_url.c_str());
 
   error = PlatformRemoteGDBServer::ConnectRemote(args);
   if (error.Fail())
@@ -164,10 +160,10 @@ void PlatformAndroidRemoteGDBServer::Del
   const auto port = it->second;
   const auto error = DeleteForwardPortWithAdb(port, m_device_id);
   if (error.Fail()) {
-    if (log)
-      log->Printf("Failed to delete port forwarding (pid=%" PRIu64
-                  ", port=%d, device=%s): %s",
-                  pid, port, m_device_id.c_str(), error.AsCString());
+    LLDB_LOGF(log,
+              "Failed to delete port forwarding (pid=%" PRIu64
+              ", port=%d, device=%s): %s",
+              pid, port, m_device_id.c_str(), error.AsCString());
   }
   m_port_forwards.erase(it);
 }

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp Wed Jul 24 10:56:10 2019
@@ -70,8 +70,8 @@ PlatformSP PlatformAppleTVSimulator::Cre
     const char *triple_cstr =
         arch ? arch->GetTriple().getTriple().c_str() : "<null>";
 
-    log->Printf("PlatformAppleTVSimulator::%s(force=%s, arch={%s,%s})",
-                __FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
+    LLDB_LOGF(log, "PlatformAppleTVSimulator::%s(force=%s, arch={%s,%s})",
+              __FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
   }
 
   bool create = force;
@@ -120,16 +120,14 @@ PlatformSP PlatformAppleTVSimulator::Cre
     }
   }
   if (create) {
-    if (log)
-      log->Printf("PlatformAppleTVSimulator::%s() creating platform",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "PlatformAppleTVSimulator::%s() creating platform",
+              __FUNCTION__);
 
     return PlatformSP(new PlatformAppleTVSimulator());
   }
 
-  if (log)
-    log->Printf("PlatformAppleTVSimulator::%s() aborting creation of platform",
-                __FUNCTION__);
+  LLDB_LOGF(log, "PlatformAppleTVSimulator::%s() aborting creation of platform",
+            __FUNCTION__);
 
   return PlatformSP();
 }

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp Wed Jul 24 10:56:10 2019
@@ -69,8 +69,8 @@ PlatformSP PlatformAppleWatchSimulator::
     const char *triple_cstr =
         arch ? arch->GetTriple().getTriple().c_str() : "<null>";
 
-    log->Printf("PlatformAppleWatchSimulator::%s(force=%s, arch={%s,%s})",
-                __FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
+    LLDB_LOGF(log, "PlatformAppleWatchSimulator::%s(force=%s, arch={%s,%s})",
+              __FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
   }
 
   bool create = force;
@@ -119,17 +119,15 @@ PlatformSP PlatformAppleWatchSimulator::
     }
   }
   if (create) {
-    if (log)
-      log->Printf("PlatformAppleWatchSimulator::%s() creating platform",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "PlatformAppleWatchSimulator::%s() creating platform",
+              __FUNCTION__);
 
     return PlatformSP(new PlatformAppleWatchSimulator());
   }
 
-  if (log)
-    log->Printf(
-        "PlatformAppleWatchSimulator::%s() aborting creation of platform",
-        __FUNCTION__);
+  LLDB_LOGF(log,
+            "PlatformAppleWatchSimulator::%s() aborting creation of platform",
+            __FUNCTION__);
 
   return PlatformSP();
 }

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Wed Jul 24 10:56:10 2019
@@ -220,16 +220,16 @@ lldb_private::Status PlatformDarwin::Get
     lldb::ModuleSP *old_module_sp_ptr, bool *did_create_ptr) {
 
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
-  if (log)
-    log->Printf("[%s] Trying to find module %s/%s - platform path %s/%s symbol "
-                "path %s/%s",
-                (IsHost() ? "host" : "remote"),
-                module_spec.GetFileSpec().GetDirectory().AsCString(),
-                module_spec.GetFileSpec().GetFilename().AsCString(),
-                module_spec.GetPlatformFileSpec().GetDirectory().AsCString(),
-                module_spec.GetPlatformFileSpec().GetFilename().AsCString(),
-                module_spec.GetSymbolFileSpec().GetDirectory().AsCString(),
-                module_spec.GetSymbolFileSpec().GetFilename().AsCString());
+  LLDB_LOGF(log,
+            "[%s] Trying to find module %s/%s - platform path %s/%s symbol "
+            "path %s/%s",
+            (IsHost() ? "host" : "remote"),
+            module_spec.GetFileSpec().GetDirectory().AsCString(),
+            module_spec.GetFileSpec().GetFilename().AsCString(),
+            module_spec.GetPlatformFileSpec().GetDirectory().AsCString(),
+            module_spec.GetPlatformFileSpec().GetFilename().AsCString(),
+            module_spec.GetSymbolFileSpec().GetDirectory().AsCString(),
+            module_spec.GetSymbolFileSpec().GetFilename().AsCString());
 
   Status err;
 
@@ -256,11 +256,10 @@ lldb_private::Status PlatformDarwin::Get
           return err;
         if (FileSystem::Instance().Exists(module_cache_spec)) {
           Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
-          if (log)
-            log->Printf("[%s] module %s/%s was rsynced and is now there",
-                        (IsHost() ? "host" : "remote"),
-                        module_spec.GetFileSpec().GetDirectory().AsCString(),
-                        module_spec.GetFileSpec().GetFilename().AsCString());
+          LLDB_LOGF(log, "[%s] module %s/%s was rsynced and is now there",
+                    (IsHost() ? "host" : "remote"),
+                    module_spec.GetFileSpec().GetDirectory().AsCString(),
+                    module_spec.GetFileSpec().GetFilename().AsCString());
           ModuleSpec local_spec(module_cache_spec,
                                 module_spec.GetArchitecture());
           module_sp = std::make_shared<Module>(local_spec);
@@ -287,12 +286,11 @@ lldb_private::Status PlatformDarwin::Get
           if (low_local != low_remote || high_local != high_remote) {
             // bring in the remote file
             Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
-            if (log)
-              log->Printf(
-                  "[%s] module %s/%s needs to be replaced from remote copy",
-                  (IsHost() ? "host" : "remote"),
-                  module_spec.GetFileSpec().GetDirectory().AsCString(),
-                  module_spec.GetFileSpec().GetFilename().AsCString());
+            LLDB_LOGF(log,
+                      "[%s] module %s/%s needs to be replaced from remote copy",
+                      (IsHost() ? "host" : "remote"),
+                      module_spec.GetFileSpec().GetDirectory().AsCString(),
+                      module_spec.GetFileSpec().GetFilename().AsCString());
             Status err =
                 BringInRemoteFile(this, module_spec, module_cache_spec);
             if (err.Fail())
@@ -304,30 +302,27 @@ lldb_private::Status PlatformDarwin::Get
         module_sp = std::make_shared<Module>(local_spec);
         module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
         Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
-        if (log)
-          log->Printf("[%s] module %s/%s was found in the cache",
-                      (IsHost() ? "host" : "remote"),
-                      module_spec.GetFileSpec().GetDirectory().AsCString(),
-                      module_spec.GetFileSpec().GetFilename().AsCString());
+        LLDB_LOGF(log, "[%s] module %s/%s was found in the cache",
+                  (IsHost() ? "host" : "remote"),
+                  module_spec.GetFileSpec().GetDirectory().AsCString(),
+                  module_spec.GetFileSpec().GetFilename().AsCString());
         return Status();
       }
 
       // bring in the remote module file
-      if (log)
-        log->Printf("[%s] module %s/%s needs to come in remotely",
-                    (IsHost() ? "host" : "remote"),
-                    module_spec.GetFileSpec().GetDirectory().AsCString(),
-                    module_spec.GetFileSpec().GetFilename().AsCString());
+      LLDB_LOGF(log, "[%s] module %s/%s needs to come in remotely",
+                (IsHost() ? "host" : "remote"),
+                module_spec.GetFileSpec().GetDirectory().AsCString(),
+                module_spec.GetFileSpec().GetFilename().AsCString());
       Status err = BringInRemoteFile(this, module_spec, module_cache_spec);
       if (err.Fail())
         return err;
       if (FileSystem::Instance().Exists(module_cache_spec)) {
         Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
-        if (log)
-          log->Printf("[%s] module %s/%s is now cached and fine",
-                      (IsHost() ? "host" : "remote"),
-                      module_spec.GetFileSpec().GetDirectory().AsCString(),
-                      module_spec.GetFileSpec().GetFilename().AsCString());
+        LLDB_LOGF(log, "[%s] module %s/%s is now cached and fine",
+                  (IsHost() ? "host" : "remote"),
+                  module_spec.GetFileSpec().GetDirectory().AsCString(),
+                  module_spec.GetFileSpec().GetFilename().AsCString());
         ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture());
         module_sp = std::make_shared<Module>(local_spec);
         module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
@@ -1713,8 +1708,11 @@ PlatformDarwin::FindBundleBinaryInExecSe
     size_t num_module_search_paths = module_search_paths_ptr->GetSize();
     for (size_t i = 0; i < num_module_search_paths; ++i) {
       Log *log_verbose = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
-      if (log_verbose)
-          log_verbose->Printf ("PlatformRemoteDarwinDevice::GetSharedModule searching for binary in search-path %s", module_search_paths_ptr->GetFileSpecAtIndex(i).GetPath().c_str());
+      LLDB_LOGF(
+          log_verbose,
+          "PlatformRemoteDarwinDevice::GetSharedModule searching for binary in "
+          "search-path %s",
+          module_search_paths_ptr->GetFileSpecAtIndex(i).GetPath().c_str());
       // Create a new FileSpec with this module_search_paths_ptr plus just the
       // filename ("UIFoundation"), then the parent dir plus filename
       // ("UIFoundation.framework/UIFoundation") etc - up to four names (to

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp Wed Jul 24 10:56:10 2019
@@ -80,8 +80,8 @@ PlatformSP PlatformDarwinKernel::CreateI
     const char *triple_cstr =
         arch ? arch->GetTriple().getTriple().c_str() : "<null>";
 
-    log->Printf("PlatformDarwinKernel::%s(force=%s, arch={%s,%s})",
-                __FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
+    LLDB_LOGF(log, "PlatformDarwinKernel::%s(force=%s, arch={%s,%s})",
+              __FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
   }
 
   // This is a special plugin that we don't want to activate just based on an
@@ -89,10 +89,10 @@ PlatformSP PlatformDarwinKernel::CreateI
   // sessions and the DynamicLoaderDarwinPlugin (or a user doing 'platform
   // select') will force the creation of this Platform plugin.
   if (!force) {
-    if (log)
-      log->Printf("PlatformDarwinKernel::%s() aborting creation of platform "
-                  "because force == false",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "PlatformDarwinKernel::%s() aborting creation of platform "
+              "because force == false",
+              __FUNCTION__);
     return PlatformSP();
   }
 
@@ -154,15 +154,14 @@ PlatformSP PlatformDarwinKernel::CreateI
     }
   }
   if (create) {
-    if (log)
-      log->Printf("PlatformDarwinKernel::%s() creating platform", __FUNCTION__);
+    LLDB_LOGF(log, "PlatformDarwinKernel::%s() creating platform",
+              __FUNCTION__);
 
     return PlatformSP(new PlatformDarwinKernel(is_ios_debug_session));
   }
 
-  if (log)
-    log->Printf("PlatformDarwinKernel::%s() aborting creation of platform",
-                __FUNCTION__);
+  LLDB_LOGF(log, "PlatformDarwinKernel::%s() aborting creation of platform",
+            __FUNCTION__);
 
   return PlatformSP();
 }
@@ -298,24 +297,24 @@ void PlatformDarwinKernel::GetStatus(Str
 
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
   if (log) {
-    log->Printf("\nkexts with dSYMs");
+    LLDB_LOGF(log, "\nkexts with dSYMs");
     for (auto pos : m_name_to_kext_path_map_with_dsyms) {
-      log->Printf("%s", pos.second.GetPath().c_str());
+      LLDB_LOGF(log, "%s", pos.second.GetPath().c_str());
     }
-    log->Printf("\nkexts without dSYMs");
+    LLDB_LOGF(log, "\nkexts without dSYMs");
 
     for (auto pos : m_name_to_kext_path_map_without_dsyms) {
-      log->Printf("%s", pos.second.GetPath().c_str());
+      LLDB_LOGF(log, "%s", pos.second.GetPath().c_str());
     }
-    log->Printf("\nkernels with dSYMS");
+    LLDB_LOGF(log, "\nkernels with dSYMS");
     for (auto fs : m_kernel_binaries_with_dsyms) {
-      log->Printf("%s", fs.GetPath().c_str());
+      LLDB_LOGF(log, "%s", fs.GetPath().c_str());
     }
-    log->Printf("\nkernels without dSYMS");
+    LLDB_LOGF(log, "\nkernels without dSYMS");
     for (auto fs : m_kernel_binaries_without_dsyms) {
-      log->Printf("%s", fs.GetPath().c_str());
+      LLDB_LOGF(log, "%s", fs.GetPath().c_str());
     }
-    log->Printf("\n");
+    LLDB_LOGF(log, "\n");
   }
 }
 
@@ -495,8 +494,8 @@ PlatformDarwinKernel::GetKernelsAndKexts
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
   Log *log_verbose(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM | LLDB_LOG_OPTION_VERBOSE));
 
-  if (log_verbose)
-      log_verbose->Printf ("PlatformDarwinKernel examining '%s'", file_spec.GetPath().c_str());
+  LLDB_LOGF(log_verbose, "PlatformDarwinKernel examining '%s'",
+            file_spec.GetPath().c_str());
 
   PlatformDarwinKernel *thisp = (PlatformDarwinKernel *)baton;
   if (ft == llvm::sys::fs::file_type::regular_file ||
@@ -507,18 +506,17 @@ PlatformDarwinKernel::GetKernelsAndKexts
         file_spec_extension != g_dsym_suffix) {
       if (KernelHasdSYMSibling(file_spec))
       {
-        if (log)
-        {
-            log->Printf ("PlatformDarwinKernel registering kernel binary '%s' with dSYM sibling", file_spec.GetPath().c_str());
-        }
+        LLDB_LOGF(log,
+                  "PlatformDarwinKernel registering kernel binary '%s' with "
+                  "dSYM sibling",
+                  file_spec.GetPath().c_str());
         thisp->m_kernel_binaries_with_dsyms.push_back(file_spec);
       }
       else
       {
-        if (log)
-        {
-            log->Printf ("PlatformDarwinKernel registering kernel binary '%s', no dSYM", file_spec.GetPath().c_str());
-        }
+        LLDB_LOGF(
+            log, "PlatformDarwinKernel registering kernel binary '%s', no dSYM",
+            file_spec.GetPath().c_str());
         thisp->m_kernel_binaries_without_dsyms.push_back(file_spec);
       }
       return FileSystem::eEnumerateDirectoryResultNext;
@@ -554,8 +552,9 @@ PlatformDarwinKernel::GetKernelsAndKexts
   if (recurse && file_spec_extension != g_dsym_suffix &&
       file_spec_extension != g_kext_suffix &&
       file_spec_extension != g_bundle_suffix) {
-    if (log_verbose)
-        log_verbose->Printf ("PlatformDarwinKernel descending into directory '%s'", file_spec.GetPath().c_str());
+    LLDB_LOGF(log_verbose,
+              "PlatformDarwinKernel descending into directory '%s'",
+              file_spec.GetPath().c_str());
     return FileSystem::eEnumerateDirectoryResultEnter;
   } else {
     return FileSystem::eEnumerateDirectoryResultNext;
@@ -574,19 +573,18 @@ void PlatformDarwinKernel::AddKextToMap(
       ConstString bundle_conststr(bundle_id_buf);
       if (KextHasdSYMSibling(file_spec))
       {
-        if (log)
-        {
-            log->Printf ("PlatformDarwinKernel registering kext binary '%s' with dSYM sibling", file_spec.GetPath().c_str());
-        }
+        LLDB_LOGF(log,
+                  "PlatformDarwinKernel registering kext binary '%s' with dSYM "
+                  "sibling",
+                  file_spec.GetPath().c_str());
         thisp->m_name_to_kext_path_map_with_dsyms.insert(
             std::pair<ConstString, FileSpec>(bundle_conststr, file_spec));
       }
       else
       {
-        if (log)
-        {
-            log->Printf ("PlatformDarwinKernel registering kext binary '%s', no dSYM", file_spec.GetPath().c_str());
-        }
+        LLDB_LOGF(log,
+                  "PlatformDarwinKernel registering kext binary '%s', no dSYM",
+                  file_spec.GetPath().c_str());
         thisp->m_name_to_kext_path_map_without_dsyms.insert(
             std::pair<ConstString, FileSpec>(bundle_conststr, file_spec));
       }

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp Wed Jul 24 10:56:10 2019
@@ -70,8 +70,8 @@ PlatformSP PlatformMacOSX::CreateInstanc
     const char *triple_cstr =
         arch ? arch->GetTriple().getTriple().c_str() : "<null>";
 
-    log->Printf("PlatformMacOSX::%s(force=%s, arch={%s,%s})", __FUNCTION__,
-                force ? "true" : "false", arch_name, triple_cstr);
+    LLDB_LOGF(log, "PlatformMacOSX::%s(force=%s, arch={%s,%s})", __FUNCTION__,
+              force ? "true" : "false", arch_name, triple_cstr);
   }
 
   // The only time we create an instance is when we are creating a remote
@@ -117,14 +117,12 @@ PlatformSP PlatformMacOSX::CreateInstanc
     }
   }
   if (create) {
-    if (log)
-      log->Printf("PlatformMacOSX::%s() creating platform", __FUNCTION__);
+    LLDB_LOGF(log, "PlatformMacOSX::%s() creating platform", __FUNCTION__);
     return PlatformSP(new PlatformMacOSX(is_host));
   }
 
-  if (log)
-    log->Printf("PlatformMacOSX::%s() aborting creation of platform",
-                __FUNCTION__);
+  LLDB_LOGF(log, "PlatformMacOSX::%s() aborting creation of platform",
+            __FUNCTION__);
 
   return PlatformSP();
 }

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp Wed Jul 24 10:56:10 2019
@@ -68,8 +68,8 @@ PlatformSP PlatformRemoteAppleBridge::Cr
     const char *triple_cstr =
         arch ? arch->GetTriple().getTriple().c_str() : "<null>";
 
-    log->Printf("PlatformRemoteAppleBridge::%s(force=%s, arch={%s,%s})",
-                __FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
+    LLDB_LOGF(log, "PlatformRemoteAppleBridge::%s(force=%s, arch={%s,%s})",
+              __FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
   }
 
   bool create = force;
@@ -112,16 +112,15 @@ PlatformSP PlatformRemoteAppleBridge::Cr
   }
 
   if (create) {
-    if (log)
-      log->Printf("PlatformRemoteAppleBridge::%s() creating platform",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "PlatformRemoteAppleBridge::%s() creating platform",
+              __FUNCTION__);
 
     return lldb::PlatformSP(new PlatformRemoteAppleBridge());
   }
 
-  if (log)
-    log->Printf("PlatformRemoteAppleBridge::%s() aborting creation of platform",
-                __FUNCTION__);
+  LLDB_LOGF(log,
+            "PlatformRemoteAppleBridge::%s() aborting creation of platform",
+            __FUNCTION__);
 
   return lldb::PlatformSP();
 }

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp Wed Jul 24 10:56:10 2019
@@ -69,8 +69,8 @@ PlatformSP PlatformRemoteAppleTV::Create
     const char *triple_cstr =
         arch ? arch->GetTriple().getTriple().c_str() : "<null>";
 
-    log->Printf("PlatformRemoteAppleTV::%s(force=%s, arch={%s,%s})",
-                __FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
+    LLDB_LOGF(log, "PlatformRemoteAppleTV::%s(force=%s, arch={%s,%s})",
+              __FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
   }
 
   bool create = force;
@@ -116,16 +116,14 @@ PlatformSP PlatformRemoteAppleTV::Create
   }
 
   if (create) {
-    if (log)
-      log->Printf("PlatformRemoteAppleTV::%s() creating platform",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "PlatformRemoteAppleTV::%s() creating platform",
+              __FUNCTION__);
 
     return lldb::PlatformSP(new PlatformRemoteAppleTV());
   }
 
-  if (log)
-    log->Printf("PlatformRemoteAppleTV::%s() aborting creation of platform",
-                __FUNCTION__);
+  LLDB_LOGF(log, "PlatformRemoteAppleTV::%s() aborting creation of platform",
+            __FUNCTION__);
 
   return lldb::PlatformSP();
 }

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp Wed Jul 24 10:56:10 2019
@@ -66,8 +66,8 @@ PlatformSP PlatformRemoteAppleWatch::Cre
     const char *triple_cstr =
         arch ? arch->GetTriple().getTriple().c_str() : "<null>";
 
-    log->Printf("PlatformRemoteAppleWatch::%s(force=%s, arch={%s,%s})",
-                __FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
+    LLDB_LOGF(log, "PlatformRemoteAppleWatch::%s(force=%s, arch={%s,%s})",
+              __FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
   }
 
   bool create = force;
@@ -122,16 +122,14 @@ PlatformSP PlatformRemoteAppleWatch::Cre
 #endif
 
   if (create) {
-    if (log)
-      log->Printf("PlatformRemoteAppleWatch::%s() creating platform",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "PlatformRemoteAppleWatch::%s() creating platform",
+              __FUNCTION__);
 
     return lldb::PlatformSP(new PlatformRemoteAppleWatch());
   }
 
-  if (log)
-    log->Printf("PlatformRemoteAppleWatch::%s() aborting creation of platform",
-                __FUNCTION__);
+  LLDB_LOGF(log, "PlatformRemoteAppleWatch::%s() aborting creation of platform",
+            __FUNCTION__);
 
   return lldb::PlatformSP();
 }

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp Wed Jul 24 10:56:10 2019
@@ -150,17 +150,21 @@ bool PlatformRemoteDarwinDevice::UpdateS
       const SDKDirectoryInfo sdk_sysroot_directory_info(sdk_sysroot_fspec);
       m_sdk_directory_infos.push_back(sdk_sysroot_directory_info);
       if (log) {
-        log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded added "
-                    "--sysroot SDK directory %s",
-                    m_sdk_sysroot.GetCString());
+        LLDB_LOGF(
+            log,
+            "PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded added "
+            "--sysroot SDK directory %s",
+            m_sdk_sysroot.GetCString());
       }
       return true;
     }
     const char *device_support_dir = GetDeviceSupportDirectory();
     if (log) {
-      log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded Got "
-                  "DeviceSupport directory %s",
-                  device_support_dir);
+      LLDB_LOGF(
+          log,
+          "PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded Got "
+          "DeviceSupport directory %s",
+          device_support_dir);
     }
     if (device_support_dir) {
       const bool find_directories = true;
@@ -183,9 +187,11 @@ bool PlatformRemoteDarwinDevice::UpdateS
         if (FileSystem::Instance().Exists(sdk_symbols_symlink_fspec)) {
           m_sdk_directory_infos.push_back(sdk_directory_info);
           if (log) {
-            log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
-                        "added builtin SDK directory %s",
-                        sdk_symbols_symlink_fspec.GetPath().c_str());
+            LLDB_LOGF(
+                log,
+                "PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
+                "added builtin SDK directory %s",
+                sdk_symbols_symlink_fspec.GetPath().c_str());
           }
         }
       }
@@ -202,9 +208,11 @@ bool PlatformRemoteDarwinDevice::UpdateS
         FileSystem::Instance().Resolve(local_sdk_cache);
         if (FileSystem::Instance().Exists(local_sdk_cache)) {
           if (log) {
-            log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
-                        "searching %s for additional SDKs",
-                        local_sdk_cache.GetPath().c_str());
+            LLDB_LOGF(
+                log,
+                "PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
+                "searching %s for additional SDKs",
+                local_sdk_cache.GetPath().c_str());
           }
             char path[PATH_MAX];
             if (local_sdk_cache.GetPath(path, sizeof(path))) {
@@ -217,9 +225,12 @@ bool PlatformRemoteDarwinDevice::UpdateS
               for (uint32_t i = num_installed; i < num_sdk_infos; ++i) {
                 m_sdk_directory_infos[i].user_cached = true;
                 if (log) {
-                log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
-                            "user SDK directory %s",
-                            m_sdk_directory_infos[i].directory.GetPath().c_str());
+                  LLDB_LOGF(
+                      log,
+                      "PlatformRemoteDarwinDevice::"
+                      "UpdateSDKDirectoryInfosIfNeeded "
+                      "user SDK directory %s",
+                      m_sdk_directory_infos[i].directory.GetPath().c_str());
                 }
             }
           }
@@ -240,9 +251,11 @@ bool PlatformRemoteDarwinDevice::UpdateS
           if (FileSystem::Instance().Exists(sdk_symbols_symlink_fspec)) {
             m_sdk_directory_infos.push_back(sdk_directory_info);
             if (log) {
-              log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
-                          "added env var SDK directory %s",
-                          sdk_symbols_symlink_fspec.GetPath().c_str());
+              LLDB_LOGF(
+                  log,
+                  "PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
+                  "added env var SDK directory %s",
+                  sdk_symbols_symlink_fspec.GetPath().c_str());
             }
           }
         }
@@ -418,10 +431,8 @@ bool PlatformRemoteDarwinDevice::GetFile
         local_file.AppendPathComponent(platform_file_path);
         FileSystem::Instance().Resolve(local_file);
         if (FileSystem::Instance().Exists(local_file)) {
-          if (log)
-            log->Printf("Found a copy of %s in the SDK dir %s/%s",
-                        platform_file_path, sdkroot_path.c_str(),
-                        paths_to_try[i]);
+          LLDB_LOGF(log, "Found a copy of %s in the SDK dir %s/%s",
+                    platform_file_path, sdkroot_path.c_str(), paths_to_try[i]);
           return true;
         }
         local_file.Clear();
@@ -449,8 +460,8 @@ Status PlatformRemoteDarwinDevice::GetSy
       FileSystem::Instance().Resolve(local_file);
       if (FileSystem::Instance().Exists(local_file)) {
         if (log) {
-          log->Printf("Found a copy of %s in the DeviceSupport dir %s",
-                      platform_file_path, os_version_dir);
+          LLDB_LOGF(log, "Found a copy of %s in the DeviceSupport dir %s",
+                    platform_file_path, os_version_dir);
         }
         return error;
       }
@@ -462,7 +473,8 @@ Status PlatformRemoteDarwinDevice::GetSy
       FileSystem::Instance().Resolve(local_file);
       if (FileSystem::Instance().Exists(local_file)) {
         if (log) {
-          log->Printf(
+          LLDB_LOGF(
+              log,
               "Found a copy of %s in the DeviceSupport dir %s/Symbols.Internal",
               platform_file_path, os_version_dir);
         }
@@ -475,8 +487,9 @@ Status PlatformRemoteDarwinDevice::GetSy
       FileSystem::Instance().Resolve(local_file);
       if (FileSystem::Instance().Exists(local_file)) {
         if (log) {
-          log->Printf("Found a copy of %s in the DeviceSupport dir %s/Symbols",
-                      platform_file_path, os_version_dir);
+          LLDB_LOGF(log,
+                    "Found a copy of %s in the DeviceSupport dir %s/Symbols",
+                    platform_file_path, os_version_dir);
         }
         return error;
       }

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp Wed Jul 24 10:56:10 2019
@@ -61,8 +61,8 @@ PlatformSP PlatformRemoteiOS::CreateInst
     const char *triple_cstr =
         arch ? arch->GetTriple().getTriple().c_str() : "<null>";
 
-    log->Printf("PlatformRemoteiOS::%s(force=%s, arch={%s,%s})", __FUNCTION__,
-                force ? "true" : "false", arch_name, triple_cstr);
+    LLDB_LOGF(log, "PlatformRemoteiOS::%s(force=%s, arch={%s,%s})",
+              __FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
   }
 
   bool create = force;
@@ -111,14 +111,14 @@ PlatformSP PlatformRemoteiOS::CreateInst
 
   if (create) {
     if (log)
-      log->Printf("PlatformRemoteiOS::%s() creating platform", __FUNCTION__);
+      LLDB_LOGF(log, "PlatformRemoteiOS::%s() creating platform", __FUNCTION__);
 
     return lldb::PlatformSP(new PlatformRemoteiOS());
   }
 
   if (log)
-    log->Printf("PlatformRemoteiOS::%s() aborting creation of platform",
-                __FUNCTION__);
+    LLDB_LOGF(log, "PlatformRemoteiOS::%s() aborting creation of platform",
+              __FUNCTION__);
 
   return lldb::PlatformSP();
 }

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp Wed Jul 24 10:56:10 2019
@@ -70,8 +70,8 @@ PlatformSP PlatformiOSSimulator::CreateI
     const char *triple_cstr =
         arch ? arch->GetTriple().getTriple().c_str() : "<null>";
 
-    log->Printf("PlatformiOSSimulator::%s(force=%s, arch={%s,%s})",
-                __FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
+    LLDB_LOGF(log, "PlatformiOSSimulator::%s(force=%s, arch={%s,%s})",
+              __FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
   }
 
   bool create = force;
@@ -125,15 +125,14 @@ PlatformSP PlatformiOSSimulator::CreateI
     }
   }
   if (create) {
-    if (log)
-      log->Printf("PlatformiOSSimulator::%s() creating platform", __FUNCTION__);
+    LLDB_LOGF(log, "PlatformiOSSimulator::%s() creating platform",
+              __FUNCTION__);
 
     return PlatformSP(new PlatformiOSSimulator());
   }
 
-  if (log)
-    log->Printf("PlatformiOSSimulator::%s() aborting creation of platform",
-                __FUNCTION__);
+  LLDB_LOGF(log, "PlatformiOSSimulator::%s() aborting creation of platform",
+            __FUNCTION__);
 
   return PlatformSP();
 }

Modified: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp Wed Jul 24 10:56:10 2019
@@ -276,8 +276,7 @@ PlatformPOSIX::PutFile(const lldb_privat
       } else
         command.Printf("rsync %s %s %s:%s", GetRSyncOpts(), src_path.c_str(),
                        GetHostname(), dst_path.c_str());
-      if (log)
-        log->Printf("[PutFile] Running command: %s\n", command.GetData());
+      LLDB_LOGF(log, "[PutFile] Running command: %s\n", command.GetData());
       int retcode;
       Host::RunShellCommand(command.GetData(), nullptr, &retcode, nullptr,
                             nullptr, std::chrono::minutes(1));
@@ -334,8 +333,7 @@ lldb_private::Status PlatformPOSIX::GetF
         command.Printf("rsync %s %s:%s %s", GetRSyncOpts(),
                        m_remote_platform_sp->GetHostname(), src_path.c_str(),
                        dst_path.c_str());
-      if (log)
-        log->Printf("[GetFile] Running command: %s\n", command.GetData());
+      LLDB_LOGF(log, "[GetFile] Running command: %s\n", command.GetData());
       int retcode;
       Host::RunShellCommand(command.GetData(), nullptr, &retcode, nullptr,
                             nullptr, std::chrono::minutes(1));
@@ -348,8 +346,7 @@ lldb_private::Status PlatformPOSIX::GetF
     // read/write, read/write, read/write, ...
     // close src
     // close dst
-    if (log)
-      log->Printf("[GetFile] Using block by block transfer....\n");
+    LLDB_LOGF(log, "[GetFile] Using block by block transfer....\n");
     Status error;
     user_id_t fd_src = OpenFile(source, File::eOpenOptionRead,
                                 lldb::eFilePermissionsFileDefault, error);
@@ -515,24 +512,21 @@ lldb::ProcessSP PlatformPOSIX::Attach(Pr
       error = debugger.GetTargetList().CreateTarget(
           debugger, "", "", eLoadDependentsNo, nullptr, new_target_sp);
       target = new_target_sp.get();
-      if (log)
-        log->Printf("PlatformPOSIX::%s created new target", __FUNCTION__);
+      LLDB_LOGF(log, "PlatformPOSIX::%s created new target", __FUNCTION__);
     } else {
       error.Clear();
-      if (log)
-        log->Printf("PlatformPOSIX::%s target already existed, setting target",
-                    __FUNCTION__);
+      LLDB_LOGF(log, "PlatformPOSIX::%s target already existed, setting target",
+                __FUNCTION__);
     }
 
     if (target && error.Success()) {
       debugger.GetTargetList().SetSelectedTarget(target);
       if (log) {
         ModuleSP exe_module_sp = target->GetExecutableModule();
-        log->Printf("PlatformPOSIX::%s set selected target to %p %s",
-                    __FUNCTION__, (void *)target,
-                    exe_module_sp
-                        ? exe_module_sp->GetFileSpec().GetPath().c_str()
-                        : "<null>");
+        LLDB_LOGF(log, "PlatformPOSIX::%s set selected target to %p %s",
+                  __FUNCTION__, (void *)target,
+                  exe_module_sp ? exe_module_sp->GetFileSpec().GetPath().c_str()
+                                : "<null>");
       }
 
       process_sp =

Modified: lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp Wed Jul 24 10:56:10 2019
@@ -169,21 +169,21 @@ bool PlatformRemoteGDBServer::GetModuleS
   const auto module_path = module_file_spec.GetPath(false);
 
   if (!m_gdb_client.GetModuleInfo(module_file_spec, arch, module_spec)) {
-    if (log)
-      log->Printf(
-          "PlatformRemoteGDBServer::%s - failed to get module info for %s:%s",
-          __FUNCTION__, module_path.c_str(),
-          arch.GetTriple().getTriple().c_str());
+    LLDB_LOGF(
+        log,
+        "PlatformRemoteGDBServer::%s - failed to get module info for %s:%s",
+        __FUNCTION__, module_path.c_str(),
+        arch.GetTriple().getTriple().c_str());
     return false;
   }
 
   if (log) {
     StreamString stream;
     module_spec.Dump(stream);
-    log->Printf(
-        "PlatformRemoteGDBServer::%s - got module info for (%s:%s) : %s",
-        __FUNCTION__, module_path.c_str(), arch.GetTriple().getTriple().c_str(),
-        stream.GetData());
+    LLDB_LOGF(log,
+              "PlatformRemoteGDBServer::%s - got module info for (%s:%s) : %s",
+              __FUNCTION__, module_path.c_str(),
+              arch.GetTriple().getTriple().c_str(), stream.GetData());
   }
 
   return true;
@@ -253,9 +253,9 @@ FileSpec PlatformRemoteGDBServer::GetRem
     Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
     FileSpec working_dir;
     if (m_gdb_client.GetWorkingDir(working_dir) && log)
-      log->Printf(
-          "PlatformRemoteGDBServer::GetRemoteWorkingDirectory() -> '%s'",
-          working_dir.GetCString());
+      LLDB_LOGF(log,
+                "PlatformRemoteGDBServer::GetRemoteWorkingDirectory() -> '%s'",
+                working_dir.GetCString());
     return working_dir;
   } else {
     return Platform::GetRemoteWorkingDirectory();
@@ -268,9 +268,8 @@ bool PlatformRemoteGDBServer::SetRemoteW
     // Clear the working directory it case it doesn't get set correctly. This
     // will for use to re-read it
     Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
-    if (log)
-      log->Printf("PlatformRemoteGDBServer::SetRemoteWorkingDirectory('%s')",
-                  working_dir.GetCString());
+    LLDB_LOGF(log, "PlatformRemoteGDBServer::SetRemoteWorkingDirectory('%s')",
+              working_dir.GetCString());
     return m_gdb_client.SetWorkingDir(working_dir) == 0;
   } else
     return Platform::SetRemoteWorkingDirectory(working_dir);
@@ -370,8 +369,7 @@ Status PlatformRemoteGDBServer::LaunchPr
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
   Status error;
 
-  if (log)
-    log->Printf("PlatformRemoteGDBServer::%s() called", __FUNCTION__);
+  LLDB_LOGF(log, "PlatformRemoteGDBServer::%s() called", __FUNCTION__);
 
   auto num_file_actions = launch_info.GetNumFileActions();
   for (decltype(num_file_actions) i = 0; i < num_file_actions; ++i) {
@@ -408,10 +406,10 @@ Status PlatformRemoteGDBServer::LaunchPr
   const char *arch_triple = arch_spec.GetTriple().str().c_str();
 
   m_gdb_client.SendLaunchArchPacket(arch_triple);
-  if (log)
-    log->Printf(
-        "PlatformRemoteGDBServer::%s() set launch architecture triple to '%s'",
-        __FUNCTION__, arch_triple ? arch_triple : "<NULL>");
+  LLDB_LOGF(
+      log,
+      "PlatformRemoteGDBServer::%s() set launch architecture triple to '%s'",
+      __FUNCTION__, arch_triple ? arch_triple : "<NULL>");
 
   int arg_packet_err;
   {
@@ -427,22 +425,21 @@ Status PlatformRemoteGDBServer::LaunchPr
       const auto pid = m_gdb_client.GetCurrentProcessID(false);
       if (pid != LLDB_INVALID_PROCESS_ID) {
         launch_info.SetProcessID(pid);
-        if (log)
-          log->Printf("PlatformRemoteGDBServer::%s() pid %" PRIu64
-                      " launched successfully",
-                      __FUNCTION__, pid);
+        LLDB_LOGF(log,
+                  "PlatformRemoteGDBServer::%s() pid %" PRIu64
+                  " launched successfully",
+                  __FUNCTION__, pid);
       } else {
-        if (log)
-          log->Printf("PlatformRemoteGDBServer::%s() launch succeeded but we "
-                      "didn't get a valid process id back!",
-                      __FUNCTION__);
+        LLDB_LOGF(log,
+                  "PlatformRemoteGDBServer::%s() launch succeeded but we "
+                  "didn't get a valid process id back!",
+                  __FUNCTION__);
         error.SetErrorString("failed to get PID");
       }
     } else {
       error.SetErrorString(error_str.c_str());
-      if (log)
-        log->Printf("PlatformRemoteGDBServer::%s() launch failed: %s",
-                    __FUNCTION__, error.AsCString());
+      LLDB_LOGF(log, "PlatformRemoteGDBServer::%s() launch failed: %s",
+                __FUNCTION__, error.AsCString());
     }
   } else {
     error.SetErrorStringWithFormat("'A' packet returned an error: %i",
@@ -600,11 +597,10 @@ Status PlatformRemoteGDBServer::MakeDire
                                               uint32_t mode) {
   Status error = m_gdb_client.MakeDirectory(file_spec, mode);
   Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
-  if (log)
-    log->Printf("PlatformRemoteGDBServer::MakeDirectory(path='%s', mode=%o) "
-                "error = %u (%s)",
-                file_spec.GetCString(), mode, error.GetError(),
-                error.AsCString());
+  LLDB_LOGF(log,
+            "PlatformRemoteGDBServer::MakeDirectory(path='%s', mode=%o) "
+            "error = %u (%s)",
+            file_spec.GetCString(), mode, error.GetError(), error.AsCString());
   return error;
 }
 
@@ -612,11 +608,11 @@ Status PlatformRemoteGDBServer::GetFileP
                                                    uint32_t &file_permissions) {
   Status error = m_gdb_client.GetFilePermissions(file_spec, file_permissions);
   Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
-  if (log)
-    log->Printf("PlatformRemoteGDBServer::GetFilePermissions(path='%s', "
-                "file_permissions=%o) error = %u (%s)",
-                file_spec.GetCString(), file_permissions, error.GetError(),
-                error.AsCString());
+  LLDB_LOGF(log,
+            "PlatformRemoteGDBServer::GetFilePermissions(path='%s', "
+            "file_permissions=%o) error = %u (%s)",
+            file_spec.GetCString(), file_permissions, error.GetError(),
+            error.AsCString());
   return error;
 }
 
@@ -624,11 +620,11 @@ Status PlatformRemoteGDBServer::SetFileP
                                                    uint32_t file_permissions) {
   Status error = m_gdb_client.SetFilePermissions(file_spec, file_permissions);
   Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
-  if (log)
-    log->Printf("PlatformRemoteGDBServer::SetFilePermissions(path='%s', "
-                "file_permissions=%o) error = %u (%s)",
-                file_spec.GetCString(), file_permissions, error.GetError(),
-                error.AsCString());
+  LLDB_LOGF(log,
+            "PlatformRemoteGDBServer::SetFilePermissions(path='%s', "
+            "file_permissions=%o) error = %u (%s)",
+            file_spec.GetCString(), file_permissions, error.GetError(),
+            error.AsCString());
   return error;
 }
 
@@ -671,20 +667,19 @@ Status PlatformRemoteGDBServer::CreateSy
 {
   Status error = m_gdb_client.CreateSymlink(src, dst);
   Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
-  if (log)
-    log->Printf("PlatformRemoteGDBServer::CreateSymlink(src='%s', dst='%s') "
-                "error = %u (%s)",
-                src.GetCString(), dst.GetCString(), error.GetError(),
-                error.AsCString());
+  LLDB_LOGF(log,
+            "PlatformRemoteGDBServer::CreateSymlink(src='%s', dst='%s') "
+            "error = %u (%s)",
+            src.GetCString(), dst.GetCString(), error.GetError(),
+            error.AsCString());
   return error;
 }
 
 Status PlatformRemoteGDBServer::Unlink(const FileSpec &file_spec) {
   Status error = m_gdb_client.Unlink(file_spec);
   Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
-  if (log)
-    log->Printf("PlatformRemoteGDBServer::Unlink(path='%s') error = %u (%s)",
-                file_spec.GetCString(), error.GetError(), error.AsCString());
+  LLDB_LOGF(log, "PlatformRemoteGDBServer::Unlink(path='%s') error = %u (%s)",
+            file_spec.GetCString(), error.GetError(), error.AsCString());
   return error;
 }
 

Modified: lldb/trunk/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp Wed Jul 24 10:56:10 2019
@@ -254,9 +254,8 @@ CreatePosixSpawnFileAction(const FileAct
 
   case FileAction::eFileActionNone:
   default:
-    if (log)
-      log->Printf("%s(): unsupported file action %u", __FUNCTION__,
-                  action.GetAction());
+    LLDB_LOGF(log, "%s(): unsupported file action %u", __FUNCTION__,
+              action.GetAction());
     break;
   }
 
@@ -288,8 +287,7 @@ static Status PosixSpawnChildForPTraceDe
 
   int error_code;
   if ((error_code = ::posix_spawnattr_init(&attr)) != 0) {
-    if (log)
-      log->Printf("::posix_spawnattr_init(&attr) failed");
+    LLDB_LOGF(log, "::posix_spawnattr_init(&attr) failed");
     error.SetError(error_code, eErrorTypePOSIX);
     return error;
   }
@@ -378,10 +376,10 @@ static Status PosixSpawnChildForPTraceDe
 
     error = CreatePosixSpawnFileAction(*action, &file_actions);
     if (!error.Success()) {
-      if (log)
-        log->Printf("%s(): error converting FileAction to posix_spawn "
-                    "file action: %s",
-                    __FUNCTION__, error.AsCString());
+      LLDB_LOGF(log,
+                "%s(): error converting FileAction to posix_spawn "
+                "file action: %s",
+                __FUNCTION__, error.AsCString());
       return error;
     }
   }
@@ -416,10 +414,10 @@ static Status PosixSpawnChildForPTraceDe
 
   if (actual_cpu_type) {
     *actual_cpu_type = GetCPUTypeForLocalProcess(*pid);
-    if (log)
-      log->Printf("%s(): cpu type for launched process pid=%i: "
-                  "cpu_type=0x%8.8x",
-                  __FUNCTION__, *pid, *actual_cpu_type);
+    LLDB_LOGF(log,
+              "%s(): cpu type for launched process pid=%i: "
+              "cpu_type=0x%8.8x",
+              __FUNCTION__, *pid, *actual_cpu_type);
   }
 
   return error;
@@ -477,23 +475,21 @@ Status LaunchInferior(ProcessLaunchInfo
   char resolved_path[PATH_MAX];
   resolved_path[0] = '\0';
 
-  if (log)
-    log->Printf("%s(): attempting to resolve given binary path: \"%s\"",
-                __FUNCTION__, given_path);
+  LLDB_LOGF(log, "%s(): attempting to resolve given binary path: \"%s\"",
+            __FUNCTION__, given_path);
 
   // If we fail to resolve the path to our executable, then just use what we
   // were given and hope for the best
   if (!ResolveExecutablePath(given_path, resolved_path,
                              sizeof(resolved_path))) {
-    if (log)
-      log->Printf("%s(): failed to resolve binary path, using "
-                  "what was given verbatim and hoping for the best",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "%s(): failed to resolve binary path, using "
+              "what was given verbatim and hoping for the best",
+              __FUNCTION__);
     ::strncpy(resolved_path, given_path, sizeof(resolved_path));
   } else {
-    if (log)
-      log->Printf("%s(): resolved given binary path to: \"%s\"", __FUNCTION__,
-                  resolved_path);
+    LLDB_LOGF(log, "%s(): resolved given binary path to: \"%s\"", __FUNCTION__,
+              resolved_path);
   }
 
   char launch_err_str[PATH_MAX];

Modified: lldb/trunk/source/Plugins/Process/Darwin/MachException.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Darwin/MachException.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Darwin/MachException.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Darwin/MachException.cpp Wed Jul 24 10:56:10 2019
@@ -67,10 +67,11 @@ extern "C" kern_return_t catch_mach_exce
   // TODO change to LIBLLDB_LOG_EXCEPTION
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE));
   if (log) {
-    log->Printf("::%s(exc_port = 0x%4.4x, exc_type = %d (%s), "
-                "exc_data = 0x%llx, exc_data_count = %d)",
-                __FUNCTION__, exc_port, exc_type, MachException::Name(exc_type),
-                (uint64_t)exc_data, exc_data_count);
+    LLDB_LOGF(log,
+              "::%s(exc_port = 0x%4.4x, exc_type = %d (%s), "
+              "exc_data = 0x%llx, exc_data_count = %d)",
+              __FUNCTION__, exc_port, exc_type, MachException::Name(exc_type),
+              (uint64_t)exc_data, exc_data_count);
   }
   return KERN_FAILURE;
 }
@@ -83,13 +84,14 @@ extern "C" kern_return_t catch_mach_exce
     thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) {
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE));
   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] = "
-                "{ 0x%llx, 0x%llx })",
-                __FUNCTION__, exc_port, thread_port, task_port, exc_type,
-                MachException::Name(exc_type), exc_data_count,
-                (uint64_t)(exc_data_count > 0 ? exc_data[0] : 0xBADDBADD),
-                (uint64_t)(exc_data_count > 1 ? exc_data[1] : 0xBADDBADD));
+    LLDB_LOGF(log,
+              "::%s(exc_port = 0x%4.4x, thd_port = 0x%4.4x, "
+              "tsk_port = 0x%4.4x, exc_type = %d (%s), exc_data[%d] = "
+              "{ 0x%llx, 0x%llx })",
+              __FUNCTION__, exc_port, thread_port, task_port, exc_type,
+              MachException::Name(exc_type), exc_data_count,
+              (uint64_t)(exc_data_count > 0 ? exc_data[0] : 0xBADDBADD),
+              (uint64_t)(exc_data_count > 1 ? exc_data[1] : 0xBADDBADD));
   }
 
   return KERN_FAILURE;
@@ -102,13 +104,14 @@ catch_mach_exception_raise(mach_port_t e
                            mach_msg_type_number_t exc_data_count) {
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE));
   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] "
-                "= { 0x%llx, 0x%llx })",
-                __FUNCTION__, exc_port, thread_port, task_port, exc_type,
-                MachException::Name(exc_type), exc_data_count,
-                (uint64_t)(exc_data_count > 0 ? exc_data[0] : 0xBADDBADD),
-                (uint64_t)(exc_data_count > 1 ? exc_data[1] : 0xBADDBADD));
+    LLDB_LOGF(log,
+              "::%s(exc_port = 0x%4.4x, thd_port = 0x%4.4x, "
+              "tsk_port = 0x%4.4x, exc_type = %d (%s), exc_data[%d] "
+              "= { 0x%llx, 0x%llx })",
+              __FUNCTION__, exc_port, thread_port, task_port, exc_type,
+              MachException::Name(exc_type), exc_data_count,
+              (uint64_t)(exc_data_count > 0 ? exc_data[0] : 0xBADDBADD),
+              (uint64_t)(exc_data_count > 1 ? exc_data[1] : 0xBADDBADD));
   }
 
   if (task_port == g_message->task_port) {
@@ -187,15 +190,16 @@ Status MachException::Message::Receive(m
       options & MACH_RCV_TIMEOUT ? timeout : 0;
   if (log && ((options & MACH_RCV_TIMEOUT) == 0)) {
     // Dump this log message if we have no timeout in case it never returns
-    log->Printf("::mach_msg(msg->{bits = %#x, size = %u remote_port = %#x, "
-                "local_port = %#x, reserved = 0x%x, id = 0x%x}, "
-                "option = %#x, send_size = 0, rcv_size = %llu, "
-                "rcv_name = %#x, timeout = %u, notify = %#x)",
-                exc_msg.hdr.msgh_bits, exc_msg.hdr.msgh_size,
-                exc_msg.hdr.msgh_remote_port, exc_msg.hdr.msgh_local_port,
-                exc_msg.hdr.msgh_reserved, exc_msg.hdr.msgh_id, options,
-                (uint64_t)sizeof(exc_msg.data), port, mach_msg_timeout,
-                notify_port);
+    LLDB_LOGF(log,
+              "::mach_msg(msg->{bits = %#x, size = %u remote_port = %#x, "
+              "local_port = %#x, reserved = 0x%x, id = 0x%x}, "
+              "option = %#x, send_size = 0, rcv_size = %llu, "
+              "rcv_name = %#x, timeout = %u, notify = %#x)",
+              exc_msg.hdr.msgh_bits, exc_msg.hdr.msgh_size,
+              exc_msg.hdr.msgh_remote_port, exc_msg.hdr.msgh_local_port,
+              exc_msg.hdr.msgh_reserved, exc_msg.hdr.msgh_id, options,
+              (uint64_t)sizeof(exc_msg.data), port, mach_msg_timeout,
+              notify_port);
   }
 
   mach_msg_return_t mach_err =
@@ -213,15 +217,16 @@ Status MachException::Message::Receive(m
 
   // Dump any errors we get
   if (error.Fail() && log) {
-    log->Printf("::mach_msg(msg->{bits = %#x, size = %u remote_port = %#x, "
-                "local_port = %#x, reserved = 0x%x, id = 0x%x}, "
-                "option = %#x, send_size = %u, rcv_size = %lu, rcv_name "
-                "= %#x, timeout = %u, notify = %#x) failed: %s",
-                exc_msg.hdr.msgh_bits, exc_msg.hdr.msgh_size,
-                exc_msg.hdr.msgh_remote_port, exc_msg.hdr.msgh_local_port,
-                exc_msg.hdr.msgh_reserved, exc_msg.hdr.msgh_id, options, 0,
-                sizeof(exc_msg.data), port, mach_msg_timeout, notify_port,
-                error.AsCString());
+    LLDB_LOGF(log,
+              "::mach_msg(msg->{bits = %#x, size = %u remote_port = %#x, "
+              "local_port = %#x, reserved = 0x%x, id = 0x%x}, "
+              "option = %#x, send_size = %u, rcv_size = %lu, rcv_name "
+              "= %#x, timeout = %u, notify = %#x) failed: %s",
+              exc_msg.hdr.msgh_bits, exc_msg.hdr.msgh_size,
+              exc_msg.hdr.msgh_remote_port, exc_msg.hdr.msgh_local_port,
+              exc_msg.hdr.msgh_reserved, exc_msg.hdr.msgh_id, options, 0,
+              sizeof(exc_msg.data), port, mach_msg_timeout, notify_port,
+              error.AsCString());
   }
   return error;
 }
@@ -264,10 +269,10 @@ bool MachException::Message::CatchExcept
   } else {
     Log *log(
         GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE));
-    if (log)
-      log->Printf("MachException::Message::%s(): mach_exc_server "
-                  "returned zero...",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "MachException::Message::%s(): mach_exc_server "
+              "returned zero...",
+              __FUNCTION__);
   }
   g_message = NULL;
   return success;
@@ -293,10 +298,10 @@ Status MachException::Message::Reply(::p
       auto mach_err = ::pid_for_task(state.task_port, &state_pid);
       if (mach_err) {
         error.SetError(mach_err, eErrorTypeMachKernel);
-        if (log)
-          log->Printf("MachException::Message::%s(): pid_for_task() "
-                      "failed: %s",
-                      __FUNCTION__, error.AsCString());
+        LLDB_LOGF(log,
+                  "MachException::Message::%s(): pid_for_task() "
+                  "failed: %s",
+                  __FUNCTION__, error.AsCString());
         return error;
       }
     }
@@ -309,25 +314,25 @@ Status MachException::Message::Reply(::p
         error.SetError(errno, eErrorTypePOSIX);
 
       if (!error.Success()) {
-        if (log)
-          log->Printf("::ptrace(request = PT_THUPDATE, pid = "
-                      "0x%4.4x, tid = 0x%4.4x, signal = %i)",
-                      state_pid, state.thread_port, soft_signal);
+        LLDB_LOGF(log,
+                  "::ptrace(request = PT_THUPDATE, pid = "
+                  "0x%4.4x, tid = 0x%4.4x, signal = %i)",
+                  state_pid, state.thread_port, soft_signal);
         return error;
       }
     }
   }
 
-  if (log)
-    log->Printf("::mach_msg ( msg->{bits = %#x, size = %u, remote_port "
-                "= %#x, local_port = %#x, reserved = 0x%x, id = 0x%x}, "
-                "option = %#x, send_size = %u, rcv_size = %u, rcv_name "
-                "= %#x, timeout = %u, notify = %#x)",
-                reply_msg.hdr.msgh_bits, reply_msg.hdr.msgh_size,
-                reply_msg.hdr.msgh_remote_port, reply_msg.hdr.msgh_local_port,
-                reply_msg.hdr.msgh_reserved, reply_msg.hdr.msgh_id,
-                MACH_SEND_MSG | MACH_SEND_INTERRUPT, reply_msg.hdr.msgh_size, 0,
-                MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+  LLDB_LOGF(log,
+            "::mach_msg ( msg->{bits = %#x, size = %u, remote_port "
+            "= %#x, local_port = %#x, reserved = 0x%x, id = 0x%x}, "
+            "option = %#x, send_size = %u, rcv_size = %u, rcv_name "
+            "= %#x, timeout = %u, notify = %#x)",
+            reply_msg.hdr.msgh_bits, reply_msg.hdr.msgh_size,
+            reply_msg.hdr.msgh_remote_port, reply_msg.hdr.msgh_local_port,
+            reply_msg.hdr.msgh_reserved, reply_msg.hdr.msgh_id,
+            MACH_SEND_MSG | MACH_SEND_INTERRUPT, reply_msg.hdr.msgh_size, 0,
+            MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
 
   auto mach_err =
       ::mach_msg(&reply_msg.hdr, MACH_SEND_MSG | MACH_SEND_INTERRUPT,
@@ -342,12 +347,13 @@ Status MachException::Message::Reply(::p
       log->PutCString("::mach_msg() - send interrupted");
       // TODO: keep retrying to reply???
     } else if (state.task_port == inferior_task) {
-      log->Printf("mach_msg(): returned an error when replying "
-                  "to a mach exception: error = %u (%s)",
-                  error.GetError(), error.AsCString());
+      LLDB_LOGF(log,
+                "mach_msg(): returned an error when replying "
+                "to a mach exception: error = %u (%s)",
+                error.GetError(), error.AsCString());
     } else {
-      log->Printf("::mach_msg() - failed (child of task): %u (%s)",
-                  error.GetError(), error.AsCString());
+      LLDB_LOGF(log, "::mach_msg() - failed (child of task): %u (%s)",
+                error.GetError(), error.AsCString());
     }
   }
 
@@ -377,9 +383,8 @@ Status MachException::PortInfo::Save(tas
   Status error;
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE));
 
-  if (log)
-    log->Printf("MachException::PortInfo::%s(task = 0x%4.4x)", __FUNCTION__,
-                task);
+  LLDB_LOGF(log, "MachException::PortInfo::%s(task = 0x%4.4x)", __FUNCTION__,
+            task);
 
   // Be careful to be able to have debugserver built on a newer OS than what it
   // is currently running on by being able to start with all exceptions and
@@ -394,13 +399,15 @@ Status MachException::PortInfo::Save(tas
 
   if (log) {
     if (error.Success()) {
-      log->Printf("::task_get_exception_ports(task = 0x%4.4x, mask = "
-                  "0x%x, maskCnt => %u, ports, behaviors, flavors)",
-                  task, mask, count);
+      LLDB_LOGF(log,
+                "::task_get_exception_ports(task = 0x%4.4x, mask = "
+                "0x%x, maskCnt => %u, ports, behaviors, flavors)",
+                task, mask, count);
     } else {
-      log->Printf("::task_get_exception_ports(task = 0x%4.4x, mask = 0x%x, "
-                  "maskCnt => %u, ports, behaviors, flavors) error: %u (%s)",
-                  task, mask, count, error.GetError(), error.AsCString());
+      LLDB_LOGF(log,
+                "::task_get_exception_ports(task = 0x%4.4x, mask = 0x%x, "
+                "maskCnt => %u, ports, behaviors, flavors) error: %u (%s)",
+                task, mask, count, error.GetError(), error.AsCString());
     }
   }
 
@@ -413,15 +420,17 @@ Status MachException::PortInfo::Save(tas
     error.SetError(mach_err, eErrorTypeMachKernel);
     if (log) {
       if (error.Success()) {
-        log->Printf("::task_get_exception_ports(task = 0x%4.4x, "
-                    "mask = 0x%x, maskCnt => %u, ports, behaviors, "
-                    "flavors)",
-                    task, mask, count);
+        LLDB_LOGF(log,
+                  "::task_get_exception_ports(task = 0x%4.4x, "
+                  "mask = 0x%x, maskCnt => %u, ports, behaviors, "
+                  "flavors)",
+                  task, mask, count);
       } else {
-        log->Printf("::task_get_exception_ports(task = 0x%4.4x, mask = "
-                    "0x%x, maskCnt => %u, ports, behaviors, flavors) "
-                    "error: %u (%s)",
-                    task, mask, count, error.GetError(), error.AsCString());
+        LLDB_LOGF(log,
+                  "::task_get_exception_ports(task = 0x%4.4x, mask = "
+                  "0x%x, maskCnt => %u, ports, behaviors, flavors) "
+                  "error: %u (%s)",
+                  task, mask, count, error.GetError(), error.AsCString());
       }
     }
   }
@@ -437,8 +446,7 @@ Status MachException::PortInfo::Restore(
 
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE));
 
-  if (log)
-    log->Printf("MachException::PortInfo::Restore(task = 0x%4.4x)", task);
+  LLDB_LOGF(log, "MachException::PortInfo::Restore(task = 0x%4.4x)", task);
 
   uint32_t i = 0;
   if (count > 0) {
@@ -449,17 +457,19 @@ Status MachException::PortInfo::Restore(
         error.SetError(mach_err, eErrorTypeMachKernel);
       if (log) {
         if (error.Success()) {
-          log->Printf("::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]);
+          LLDB_LOGF(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]);
         } else {
-          log->Printf("::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): "
-                      "error %u (%s)",
-                      task, masks[i], ports[i], behaviors[i], flavors[i],
-                      error.GetError(), error.AsCString());
+          LLDB_LOGF(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): "
+                    "error %u (%s)",
+                    task, masks[i], ports[i], behaviors[i], flavors[i],
+                    error.GetError(), error.AsCString());
         }
       }
 

Modified: lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp Wed Jul 24 10:56:10 2019
@@ -75,19 +75,19 @@ Status NativeProcessProtocol::Launch(
 
   // Handle launch failure.
   if (!error.Success()) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s() failed to launch process: "
-                  "%s",
-                  __FUNCTION__, error.AsCString());
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s() failed to launch process: "
+              "%s",
+              __FUNCTION__, error.AsCString());
     return error;
   }
 
   // Handle failure to return a pid.
   if (launch_info.GetProcessID() == LLDB_INVALID_PROCESS_ID) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s() launch succeeded but no "
-                  "pid was returned!  Aborting.",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s() launch succeeded but no "
+              "pid was returned!  Aborting.",
+              __FUNCTION__);
     return error;
   }
 
@@ -104,10 +104,10 @@ Status NativeProcessProtocol::Launch(
   // NativeProcessDarwin instance.
   error = np_darwin_sp->FinalizeLaunch(launch_flavor, mainloop);
   if (!error.Success()) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s() aborting, failed to finalize"
-                  " the launching of the process: %s",
-                  __FUNCTION__, error.AsCString());
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s() aborting, failed to finalize"
+              " the launching of the process: %s",
+              __FUNCTION__, error.AsCString());
     return error;
   }
 
@@ -120,9 +120,8 @@ Status NativeProcessProtocol::Attach(
     lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate,
     MainLoop &mainloop, NativeProcessProtocolSP &native_process_sp) {
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("NativeProcessDarwin::%s(pid = %" PRIi64 ")", __FUNCTION__,
-                pid);
+  LLDB_LOGF(log, "NativeProcessDarwin::%s(pid = %" PRIi64 ")", __FUNCTION__,
+            pid);
 
   // Retrieve the architecture for the running process.
   ArchSpec process_arch;
@@ -173,10 +172,10 @@ Status NativeProcessDarwin::FinalizeLaun
 
   error = StartExceptionThread();
   if (!error.Success()) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s(): failure starting the "
-                  "mach exception port monitor thread: %s",
-                  __FUNCTION__, error.AsCString());
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s(): failure starting the "
+              "mach exception port monitor thread: %s",
+              __FUNCTION__, error.AsCString());
 
     // Terminate the inferior process.  There's nothing meaningful we can do if
     // we can't receive signals and exceptions.  Since we launched the process,
@@ -195,33 +194,31 @@ Status NativeProcessDarwin::FinalizeLaun
     int err = ::ptrace(PT_ATTACHEXC, m_pid, 0, 0);
     if (err == 0) {
       // m_flags |= eMachProcessFlagsAttached;
-      if (log)
-        log->Printf("NativeProcessDarwin::%s(): successfully spawned "
-                    "process with pid %" PRIu64,
-                    __FUNCTION__, m_pid);
+      LLDB_LOGF(log,
+                "NativeProcessDarwin::%s(): successfully spawned "
+                "process with pid %" PRIu64,
+                __FUNCTION__, m_pid);
     } else {
       error.SetErrorToErrno();
       SetState(eStateExited);
-      if (log)
-        log->Printf("NativeProcessDarwin::%s(): error: failed to "
-                    "attach to spawned pid %" PRIu64 " (error=%d (%s))",
-                    __FUNCTION__, m_pid, (int)error.GetError(),
-                    error.AsCString());
+      LLDB_LOGF(log,
+                "NativeProcessDarwin::%s(): error: failed to "
+                "attach to spawned pid %" PRIu64 " (error=%d (%s))",
+                __FUNCTION__, m_pid, (int)error.GetError(), error.AsCString());
       return error;
     }
   }
 
-  if (log)
-    log->Printf("NativeProcessDarwin::%s(): new pid is %" PRIu64 "...",
-                __FUNCTION__, m_pid);
+  LLDB_LOGF(log, "NativeProcessDarwin::%s(): new pid is %" PRIu64 "...",
+            __FUNCTION__, m_pid);
 
   // Spawn a thread to reap our child inferior process...
   error = StartWaitpidThread(main_loop);
   if (error.Fail()) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s(): failed to start waitpid() "
-                  "thread: %s",
-                  __FUNCTION__, error.AsCString());
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s(): failed to start waitpid() "
+              "thread: %s",
+              __FUNCTION__, error.AsCString());
     kill(SIGKILL, static_cast<::pid_t>(m_pid));
     return error;
   }
@@ -230,10 +227,10 @@ Status NativeProcessDarwin::FinalizeLaun
     // We failed to get the task for our process ID which is bad. Kill our
     // process; otherwise, it will be stopped at the entry point and get
     // reparented to someone else and never go away.
-    if (log)
-      log->Printf("NativeProcessDarwin::%s(): could not get task port "
-                  "for process, sending SIGKILL and exiting: %s",
-                  __FUNCTION__, error.AsCString());
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s(): could not get task port "
+              "for process, sending SIGKILL and exiting: %s",
+              __FUNCTION__, error.AsCString());
     kill(SIGKILL, static_cast<::pid_t>(m_pid));
     return error;
   }
@@ -278,18 +275,17 @@ void NativeProcessDarwin::ExceptionMessa
   // the exception to our internal exception stack
   m_exception_messages.push_back(message);
 
-  if (log)
-    log->Printf("NativeProcessDarwin::%s(): new queued message count: %lu",
-                __FUNCTION__, m_exception_messages.size());
+  LLDB_LOGF(log, "NativeProcessDarwin::%s(): new queued message count: %lu",
+            __FUNCTION__, m_exception_messages.size());
 }
 
 void *NativeProcessDarwin::ExceptionThread(void *arg) {
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE));
   if (!arg) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s(): cannot run mach exception "
-                  "thread, mandatory process arg was null",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s(): cannot run mach exception "
+              "thread, mandatory process arg was null",
+              __FUNCTION__);
     return nullptr;
   }
 
@@ -299,9 +295,8 @@ void *NativeProcessDarwin::ExceptionThre
 void *NativeProcessDarwin::DoExceptionThread() {
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE));
 
-  if (log)
-    log->Printf("NativeProcessDarwin::%s(arg=%p) starting thread...",
-                __FUNCTION__, this);
+  LLDB_LOGF(log, "NativeProcessDarwin::%s(arg=%p) starting thread...",
+            __FUNCTION__, this);
 
   pthread_setname_np("exception monitoring thread");
 
@@ -344,20 +339,20 @@ void *NativeProcessDarwin::DoExceptionTh
   if (process->ProcessUsingSpringBoard()) {
     // Request a renewal for every 60 seconds if we attached using SpringBoard.
     watchdog.reset(::SBSWatchdogAssertionCreateForPID(nullptr, pid, 60));
-    if (log)
-      log->Printf("::SBSWatchdogAssertionCreateForPID(NULL, %4.4x, 60) "
-                  "=> %p",
-                  pid, watchdog.get());
+    LLDB_LOGF(log,
+              "::SBSWatchdogAssertionCreateForPID(NULL, %4.4x, 60) "
+              "=> %p",
+              pid, watchdog.get());
 
     if (watchdog.get()) {
       ::SBSWatchdogAssertionRenew(watchdog.get());
 
       CFTimeInterval watchdogRenewalInterval =
           ::SBSWatchdogAssertionGetRenewalInterval(watchdog.get());
-      if (log)
-        log->Printf("::SBSWatchdogAssertionGetRenewalInterval(%p) => "
-                    "%g seconds",
-                    watchdog.get(), watchdogRenewalInterval);
+      LLDB_LOGF(log,
+                "::SBSWatchdogAssertionGetRenewalInterval(%p) => "
+                "%g seconds",
+                watchdog.get(), watchdogRenewalInterval);
       if (watchdogRenewalInterval > 0.0) {
         watchdog_timeout = (mach_msg_timeout_t)watchdogRenewalInterval * 1000;
         if (watchdog_timeout > 3000) {
@@ -425,11 +420,11 @@ void *NativeProcessDarwin::DoExceptionTh
         // If we have no task port we should exit this thread, as it implies
         // the inferior went down.
         if (!IsExceptionPortValid()) {
-          if (log)
-            log->Printf("NativeProcessDarwin::%s(): the inferior "
-                        "exception port is no longer valid, "
-                        "canceling exception thread...",
-                        __FUNCTION__);
+          LLDB_LOGF(log,
+                    "NativeProcessDarwin::%s(): the inferior "
+                    "exception port is no longer valid, "
+                    "canceling exception thread...",
+                    __FUNCTION__);
           // Should we be setting a process state here?
           break;
         }
@@ -437,19 +432,19 @@ void *NativeProcessDarwin::DoExceptionTh
         // Make sure the inferior task is still valid.
         if (IsTaskValid()) {
           // Task is still ok.
-          if (log)
-            log->Printf("NativeProcessDarwin::%s(): interrupted, but "
-                        "the inferior task iss till valid, "
-                        "continuing...",
-                        __FUNCTION__);
+          LLDB_LOGF(log,
+                    "NativeProcessDarwin::%s(): interrupted, but "
+                    "the inferior task iss till valid, "
+                    "continuing...",
+                    __FUNCTION__);
           continue;
         } else {
           // The inferior task is no longer valid.  Time to exit as the process
           // has gone away.
-          if (log)
-            log->Printf("NativeProcessDarwin::%s(): the inferior task "
-                        "has exited, and so will we...",
-                        __FUNCTION__);
+          LLDB_LOGF(log,
+                    "NativeProcessDarwin::%s(): the inferior task "
+                    "has exited, and so will we...",
+                    __FUNCTION__);
           // Does this race at all with our waitpid()?
           SetState(eStateExited);
           break;
@@ -471,18 +466,18 @@ void *NativeProcessDarwin::DoExceptionTh
           // our task is still valid.
           if (IsTaskValid(task)) {
             // Task is still ok.
-            if (log)
-              log->Printf("NativeProcessDarwin::%s(): got a timeout, "
-                          "continuing...",
-                          __FUNCTION__);
+            LLDB_LOGF(log,
+                      "NativeProcessDarwin::%s(): got a timeout, "
+                      "continuing...",
+                      __FUNCTION__);
             continue;
           } else {
             // The inferior task is no longer valid.  Time to exit as the
             // process has gone away.
-            if (log)
-              log->Printf("NativeProcessDarwin::%s(): the inferior "
-                          "task has exited, and so will we...",
-                          __FUNCTION__);
+            LLDB_LOGF(log,
+                      "NativeProcessDarwin::%s(): the inferior "
+                      "task has exited, and so will we...",
+                      __FUNCTION__);
             // Does this race at all with our waitpid()?
             SetState(eStateExited);
             break;
@@ -493,18 +488,17 @@ void *NativeProcessDarwin::DoExceptionTh
         if (watchdog.get()) {
           watchdog_elapsed += periodic_timeout;
           if (watchdog_elapsed >= watchdog_timeout) {
-            if (log)
-              log->Printf("SBSWatchdogAssertionRenew(%p)", watchdog.get());
+            LLDB_LOGF(log, "SBSWatchdogAssertionRenew(%p)", watchdog.get());
             ::SBSWatchdogAssertionRenew(watchdog.get());
             watchdog_elapsed = 0;
           }
         }
 #endif
       } else {
-        if (log)
-          log->Printf("NativeProcessDarwin::%s(): continuing after "
-                      "receiving an unexpected error: %u (%s)",
-                      __FUNCTION__, error.GetError(), error.AsCString());
+        LLDB_LOGF(log,
+                  "NativeProcessDarwin::%s(): continuing after "
+                  "receiving an unexpected error: %u (%s)",
+                  __FUNCTION__, error.GetError(), error.AsCString());
         // TODO: notify of error?
       }
     }
@@ -523,17 +517,15 @@ void *NativeProcessDarwin::DoExceptionTh
   }
 #endif // #if defined (WITH_SPRINGBOARD) && !defined (WITH_BKS)
 
-  if (log)
-    log->Printf("NativeProcessDarwin::%s(%p): thread exiting...", __FUNCTION__,
-                this);
+  LLDB_LOGF(log, "NativeProcessDarwin::%s(%p): thread exiting...", __FUNCTION__,
+            this);
   return nullptr;
 }
 
 Status NativeProcessDarwin::StartExceptionThread() {
   Status error;
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("NativeProcessDarwin::%s() called", __FUNCTION__);
+  LLDB_LOGF(log, "NativeProcessDarwin::%s() called", __FUNCTION__);
 
   // Make sure we've looked up the inferior port.
   TaskPortForProcessID(error);
@@ -554,11 +546,11 @@ Status NativeProcessDarwin::StartExcepti
                                        &m_exception_port);
   error.SetError(mach_err, eErrorTypeMachKernel);
   if (error.Fail()) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s(): mach_port_allocate("
-                  "task_self=0x%4.4x, MACH_PORT_RIGHT_RECEIVE, "
-                  "&m_exception_port) failed: %u (%s)",
-                  __FUNCTION__, task_self, error.GetError(), error.AsCString());
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s(): mach_port_allocate("
+              "task_self=0x%4.4x, MACH_PORT_RIGHT_RECEIVE, "
+              "&m_exception_port) failed: %u (%s)",
+              __FUNCTION__, task_self, error.GetError(), error.AsCString());
     return error;
   }
 
@@ -567,23 +559,23 @@ Status NativeProcessDarwin::StartExcepti
       task_self, m_exception_port, m_exception_port, MACH_MSG_TYPE_MAKE_SEND);
   error.SetError(mach_err, eErrorTypeMachKernel);
   if (error.Fail()) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s(): 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) "
-                  "failed: %u (%s)",
-                  __FUNCTION__, task_self, m_exception_port, m_exception_port,
-                  error.GetError(), error.AsCString());
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s(): 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) "
+              "failed: %u (%s)",
+              __FUNCTION__, task_self, m_exception_port, m_exception_port,
+              error.GetError(), error.AsCString());
     return error;
   }
 
   // Save the original state of the exception ports for our child process.
   error = SaveExceptionPortInfo();
   if (error.Fail() || (m_exc_port_info.mask == 0)) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s(): SaveExceptionPortInfo() "
-                  "failed, cannot install exception handler: %s",
-                  __FUNCTION__, error.AsCString());
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s(): SaveExceptionPortInfo() "
+              "failed, cannot install exception handler: %s",
+              __FUNCTION__, error.AsCString());
     return error;
   }
 
@@ -593,14 +585,14 @@ Status NativeProcessDarwin::StartExcepti
       EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES, THREAD_STATE_NONE);
   error.SetError(mach_err, eErrorTypeMachKernel);
   if (error.Fail()) {
-    if (log)
-      log->Printf("::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) failed: "
-                  "%u (%s)",
-                  m_task, m_exc_port_info.mask, m_exception_port,
-                  (EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES), THREAD_STATE_NONE,
-                  error.GetError(), error.AsCString());
+    LLDB_LOGF(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) failed: "
+              "%u (%s)",
+              m_task, m_exc_port_info.mask, m_exception_port,
+              (EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES), THREAD_STATE_NONE,
+              error.GetError(), error.AsCString());
     return error;
   }
 
@@ -609,10 +601,10 @@ Status NativeProcessDarwin::StartExcepti
       ::pthread_create(&m_exception_thread, nullptr, ExceptionThread, this);
   error.SetError(pthread_err, eErrorTypePOSIX);
   if (error.Fail()) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s(): failed to create Mach "
-                  "exception-handling thread: %u (%s)",
-                  __FUNCTION__, error.GetError(), error.AsCString());
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s(): failed to create Mach "
+              "exception-handling thread: %u (%s)",
+              __FUNCTION__, error.GetError(), error.AsCString());
   }
 
   return error;
@@ -677,10 +669,10 @@ task_t NativeProcessDarwin::ExceptionMes
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE));
 
   std::lock_guard<std::recursive_mutex> locker(m_exception_messages_mutex);
-  if (log)
-    log->Printf("NativeProcessDarwin::%s(): processing %lu exception "
-                "messages.",
-                __FUNCTION__, m_exception_messages.size());
+  LLDB_LOGF(log,
+            "NativeProcessDarwin::%s(): processing %lu exception "
+            "messages.",
+            __FUNCTION__, m_exception_messages.size());
 
   if (m_exception_messages.empty()) {
     // Not particularly useful...
@@ -733,18 +725,18 @@ task_t NativeProcessDarwin::ExceptionMes
             const bool force_update = true;
             const task_t new_task = TaskPortForProcessID(error, force_update);
             if (old_task != new_task) {
-              if (log)
-                log->Printf("exec: inferior task port changed "
-                            "from 0x%4.4x to 0x%4.4x",
-                            old_task, new_task);
+              LLDB_LOGF(log,
+                        "exec: inferior task port changed "
+                        "from 0x%4.4x to 0x%4.4x",
+                        old_task, new_task);
             }
           }
         } else {
-          if (log)
-            log->Printf("NativeProcessDarwin::%s() warning: "
-                        "failed to read all_image_infos."
-                        "infoArrayCount from 0x%8.8llx",
-                        __FUNCTION__, info_array_count_addr);
+          LLDB_LOGF(log,
+                    "NativeProcessDarwin::%s() warning: "
+                    "failed to read all_image_infos."
+                    "infoArrayCount from 0x%8.8llx",
+                    __FUNCTION__, info_array_count_addr);
         }
       } else if ((m_sent_interrupt_signo != 0) &&
                  (signo == m_sent_interrupt_signo)) {
@@ -756,10 +748,10 @@ task_t NativeProcessDarwin::ExceptionMes
     if (m_did_exec) {
       cpu_type_t process_cpu_type = GetCPUTypeForLocalProcess(m_pid);
       if (m_cpu_type != process_cpu_type) {
-        if (log)
-          log->Printf("NativeProcessDarwin::%s(): arch changed from "
-                      "0x%8.8x to 0x%8.8x",
-                      __FUNCTION__, m_cpu_type, process_cpu_type);
+        LLDB_LOGF(log,
+                  "NativeProcessDarwin::%s(): arch changed from "
+                  "0x%8.8x to 0x%8.8x",
+                  __FUNCTION__, m_cpu_type, process_cpu_type);
         m_cpu_type = process_cpu_type;
         // TODO figure out if we need to do something here.
         // DNBArchProtocol::SetArchitecture (process_cpu_type);
@@ -772,10 +764,10 @@ task_t NativeProcessDarwin::ExceptionMes
 
     if (m_sent_interrupt_signo != 0) {
       if (received_interrupt) {
-        if (log)
-          log->Printf("NativeProcessDarwin::%s(): process "
-                      "successfully interrupted with signal %i",
-                      __FUNCTION__, m_sent_interrupt_signo);
+        LLDB_LOGF(log,
+                  "NativeProcessDarwin::%s(): process "
+                  "successfully interrupted with signal %i",
+                  __FUNCTION__, m_sent_interrupt_signo);
 
         // Mark that we received the interrupt signal
         m_sent_interrupt_signo = 0;
@@ -792,19 +784,19 @@ task_t NativeProcessDarwin::ExceptionMes
           // Only auto_resume if we stopped with _only_ the interrupt signal.
           if (num_task_exceptions == 1) {
             auto_resume = true;
-            if (log)
-              log->Printf("NativeProcessDarwin::%s(): auto "
-                          "resuming due to unhandled interrupt "
-                          "signal %i",
-                          __FUNCTION__, m_auto_resume_signo);
+            LLDB_LOGF(log,
+                      "NativeProcessDarwin::%s(): auto "
+                      "resuming due to unhandled interrupt "
+                      "signal %i",
+                      __FUNCTION__, m_auto_resume_signo);
           }
           m_auto_resume_signo = 0;
         }
       } else {
-        if (log)
-          log->Printf("NativeProcessDarwin::%s(): didn't get signal "
-                      "%i after MachProcess::Interrupt()",
-                      __FUNCTION__, m_sent_interrupt_signo);
+        LLDB_LOGF(log,
+                  "NativeProcessDarwin::%s(): didn't get signal "
+                  "%i after MachProcess::Interrupt()",
+                  __FUNCTION__, m_sent_interrupt_signo);
       }
     }
   }
@@ -878,10 +870,10 @@ Status NativeProcessDarwin::StartWaitpid
   const bool child_inherits = false;
   error = m_waitpid_pipe.CreateNew(child_inherits);
   if (error.Fail()) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s(): failed to create waitpid "
-                  "communication pipe: %s",
-                  __FUNCTION__, error.AsCString());
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s(): failed to create waitpid "
+              "communication pipe: %s",
+              __FUNCTION__, error.AsCString());
     return error;
   }
 
@@ -899,10 +891,10 @@ Status NativeProcessDarwin::StartWaitpid
       ::pthread_create(&m_waitpid_thread, nullptr, WaitpidThread, this);
   error.SetError(pthread_err, eErrorTypePOSIX);
   if (error.Fail()) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s(): failed to create waitpid "
-                  "handling thread: %u (%s)",
-                  __FUNCTION__, error.GetError(), error.AsCString());
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s(): failed to create waitpid "
+              "handling thread: %u (%s)",
+              __FUNCTION__, error.GetError(), error.AsCString());
     return error;
   }
 
@@ -912,10 +904,10 @@ Status NativeProcessDarwin::StartWaitpid
 void *NativeProcessDarwin::WaitpidThread(void *arg) {
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
   if (!arg) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s(): cannot run waitpid "
-                  "thread, mandatory process arg was null",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s(): cannot run waitpid "
+              "thread, mandatory process arg was null",
+              __FUNCTION__);
     return nullptr;
   }
 
@@ -938,10 +930,10 @@ void *NativeProcessDarwin::DoWaitpidThre
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
 
   if (m_pid == LLDB_INVALID_PROCESS_ID) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s(): inferior process ID is "
-                  "not set, cannot waitpid on it",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s(): inferior process ID is "
+              "not set, cannot waitpid on it",
+              __FUNCTION__);
     return nullptr;
   }
 
@@ -962,41 +954,41 @@ void *NativeProcessDarwin::DoWaitpidThre
     if (error.Fail()) {
       if (error.GetError() == EINTR) {
         // This is okay, we can keep going.
-        if (log)
-          log->Printf("NativeProcessDarwin::%s(): waitpid(pid = %" PRIu64
-                      ", &status, 0) interrupted, continuing",
-                      __FUNCTION__, m_pid);
+        LLDB_LOGF(log,
+                  "NativeProcessDarwin::%s(): waitpid(pid = %" PRIu64
+                  ", &status, 0) interrupted, continuing",
+                  __FUNCTION__, m_pid);
         continue;
       }
 
       // This error is not okay, abort.
-      if (log)
-        log->Printf("NativeProcessDarwin::%s(): waitpid(pid = %" PRIu64
-                    ", &status, 0) aborting due to error: %u (%s)",
-                    __FUNCTION__, m_pid, error.GetError(), error.AsCString());
+      LLDB_LOGF(log,
+                "NativeProcessDarwin::%s(): waitpid(pid = %" PRIu64
+                ", &status, 0) aborting due to error: %u (%s)",
+                __FUNCTION__, m_pid, error.GetError(), error.AsCString());
       break;
     }
 
     // Log the successful result.
-    if (log)
-      log->Printf("NativeProcessDarwin::%s(): waitpid(pid = %" PRIu64
-                  ", &status, 0) => %i, status = %i",
-                  __FUNCTION__, m_pid, child_pid, status);
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s(): waitpid(pid = %" PRIu64
+              ", &status, 0) => %i, status = %i",
+              __FUNCTION__, m_pid, child_pid, status);
 
     // Handle the result.
     if (WIFSTOPPED(status)) {
-      if (log)
-        log->Printf("NativeProcessDarwin::%s(): waitpid(pid = %" PRIu64
-                    ") received a stop, continuing waitpid() loop",
-                    __FUNCTION__, m_pid);
+      LLDB_LOGF(log,
+                "NativeProcessDarwin::%s(): waitpid(pid = %" PRIu64
+                ") received a stop, continuing waitpid() loop",
+                __FUNCTION__, m_pid);
       continue;
     } else // if (WIFEXITED(status) || WIFSIGNALED(status))
     {
-      if (log)
-        log->Printf("NativeProcessDarwin::%s(pid = %" PRIu64 "): "
-                    "waitpid thread is setting exit status for pid = "
-                    "%i to %i",
-                    __FUNCTION__, m_pid, child_pid, status);
+      LLDB_LOGF(log,
+                "NativeProcessDarwin::%s(pid = %" PRIu64 "): "
+                "waitpid thread is setting exit status for pid = "
+                "%i to %i",
+                __FUNCTION__, m_pid, child_pid, status);
 
       error = SendInferiorExitStatusToMainLoop(child_pid, status);
       return nullptr;
@@ -1005,12 +997,11 @@ void *NativeProcessDarwin::DoWaitpidThre
 
   // We should never exit as long as our child process is alive.  If we get
   // here, something completely unexpected went wrong and we should exit.
-  if (log)
-    log->Printf(
-        "NativeProcessDarwin::%s(): internal error: waitpid thread "
-        "exited out of its main loop in an unexpected way. pid = %" PRIu64
-        ". Sending exit status of -1.",
-        __FUNCTION__, m_pid);
+  LLDB_LOGF(log,
+            "NativeProcessDarwin::%s(): internal error: waitpid thread "
+            "exited out of its main loop in an unexpected way. pid = %" PRIu64
+            ". Sending exit status of -1.",
+            __FUNCTION__, m_pid);
 
   error = SendInferiorExitStatusToMainLoop((::pid_t)m_pid, -1);
   return nullptr;
@@ -1026,11 +1017,11 @@ Status NativeProcessDarwin::SendInferior
   // Send the pid.
   error = m_waitpid_pipe.Write(&pid, sizeof(pid), bytes_written);
   if (error.Fail() || (bytes_written < sizeof(pid))) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s() - failed to write "
-                  "waitpid exiting pid to the pipe.  Client will not "
-                  "hear about inferior exit status!",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s() - failed to write "
+              "waitpid exiting pid to the pipe.  Client will not "
+              "hear about inferior exit status!",
+              __FUNCTION__);
     return error;
   }
 
@@ -1038,11 +1029,11 @@ Status NativeProcessDarwin::SendInferior
   bytes_written = 0;
   error = m_waitpid_pipe.Write(&status, sizeof(status), bytes_written);
   if (error.Fail() || (bytes_written < sizeof(status))) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s() - failed to write "
-                  "waitpid exit result to the pipe.  Client will not "
-                  "hear about inferior exit status!",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s() - failed to write "
+              "waitpid exit result to the pipe.  Client will not "
+              "hear about inferior exit status!",
+              __FUNCTION__);
   }
   return error;
 }
@@ -1058,11 +1049,11 @@ Status NativeProcessDarwin::HandleWaitpi
   size_t bytes_read = 0;
   error = m_waitpid_pipe.Read(&pid, sizeof(pid), bytes_read);
   if (error.Fail() || (bytes_read < sizeof(pid))) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s() - failed to read "
-                  "waitpid exiting pid from the pipe.  Will notify "
-                  "as if parent process died with exit status -1.",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s() - failed to read "
+              "waitpid exiting pid from the pipe.  Will notify "
+              "as if parent process died with exit status -1.",
+              __FUNCTION__);
     SetExitStatus(WaitStatus(WaitStatus::Exit, -1), notify_status);
     return error;
   }
@@ -1071,21 +1062,21 @@ Status NativeProcessDarwin::HandleWaitpi
   int status = -1;
   error = m_waitpid_pipe.Read(&status, sizeof(status), bytes_read);
   if (error.Fail() || (bytes_read < sizeof(status))) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s() - failed to read "
-                  "waitpid exit status from the pipe.  Will notify "
-                  "as if parent process died with exit status -1.",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s() - failed to read "
+              "waitpid exit status from the pipe.  Will notify "
+              "as if parent process died with exit status -1.",
+              __FUNCTION__);
     SetExitStatus(WaitStatus(WaitStatus::Exit, -1), notify_status);
     return error;
   }
 
   // Notify the monitor that our state has changed.
-  if (log)
-    log->Printf("NativeProcessDarwin::%s(): main loop received waitpid "
-                "exit status info: pid=%i (%s), status=%i",
-                __FUNCTION__, pid,
-                (pid == m_pid) ? "the inferior" : "not the inferior", status);
+  LLDB_LOGF(log,
+            "NativeProcessDarwin::%s(): main loop received waitpid "
+            "exit status info: pid=%i (%s), status=%i",
+            __FUNCTION__, pid,
+            (pid == m_pid) ? "the inferior" : "not the inferior", status);
 
   SetExitStatus(WaitStatus::Decode(status), notify_status);
   return error;
@@ -1096,10 +1087,10 @@ task_t NativeProcessDarwin::TaskPortForP
   if ((m_task == TASK_NULL) || force) {
     Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
     if (m_pid == LLDB_INVALID_PROCESS_ID) {
-      if (log)
-        log->Printf("NativeProcessDarwin::%s(): cannot get task due "
-                    "to invalid pid",
-                    __FUNCTION__);
+      LLDB_LOGF(log,
+                "NativeProcessDarwin::%s(): cannot get task due "
+                "to invalid pid",
+                __FUNCTION__);
       return TASK_NULL;
     }
 
@@ -1115,19 +1106,21 @@ task_t NativeProcessDarwin::TaskPortForP
         // Succeeded.  Save and return it.
         error.Clear();
         m_task = task;
-        log->Printf("NativeProcessDarwin::%s(): ::task_for_pid("
-                    "stub_port = 0x%4.4x, pid = %llu, &task) "
-                    "succeeded: inferior task port = 0x%4.4x",
-                    __FUNCTION__, task_self, m_pid, m_task);
+        LLDB_LOGF(log,
+                  "NativeProcessDarwin::%s(): ::task_for_pid("
+                  "stub_port = 0x%4.4x, pid = %llu, &task) "
+                  "succeeded: inferior task port = 0x%4.4x",
+                  __FUNCTION__, task_self, m_pid, m_task);
         return m_task;
       } else {
         // Failed to get the task for the inferior process.
         error.SetError(err, eErrorTypeMachKernel);
         if (log) {
-          log->Printf("NativeProcessDarwin::%s(): ::task_for_pid("
-                      "stub_port = 0x%4.4x, pid = %llu, &task) "
-                      "failed, err = 0x%8.8x (%s)",
-                      __FUNCTION__, task_self, m_pid, err, error.AsCString());
+          LLDB_LOGF(log,
+                    "NativeProcessDarwin::%s(): ::task_for_pid("
+                    "stub_port = 0x%4.4x, pid = %llu, &task) "
+                    "failed, err = 0x%8.8x (%s)",
+                    __FUNCTION__, task_self, m_pid, err, error.AsCString());
         }
       }
 
@@ -1156,20 +1149,21 @@ Status NativeProcessDarwin::PrivateResum
 
   if (log) {
     if (m_auto_resume_signo)
-      log->Printf("NativeProcessDarwin::%s(): task 0x%x resuming (with "
-                  "unhandled interrupt signal %i)...",
-                  __FUNCTION__, m_task, m_auto_resume_signo);
+      LLDB_LOGF(log,
+                "NativeProcessDarwin::%s(): task 0x%x resuming (with "
+                "unhandled interrupt signal %i)...",
+                __FUNCTION__, m_task, m_auto_resume_signo);
     else
-      log->Printf("NativeProcessDarwin::%s(): task 0x%x resuming...",
-                  __FUNCTION__, m_task);
+      LLDB_LOGF(log, "NativeProcessDarwin::%s(): task 0x%x resuming...",
+                __FUNCTION__, m_task);
   }
 
   error = ReplyToAllExceptions();
   if (error.Fail()) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s(): aborting, failed to "
-                  "reply to exceptions: %s",
-                  __FUNCTION__, error.AsCString());
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s(): aborting, failed to "
+              "reply to exceptions: %s",
+              __FUNCTION__, error.AsCString());
     return error;
   }
   //    bool stepOverBreakInstruction = step;
@@ -1196,9 +1190,8 @@ Status NativeProcessDarwin::ReplyToAllEx
 
   TaskPortForProcessID(error);
   if (error.Fail()) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s(): no task port, aborting",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "NativeProcessDarwin::%s(): no task port, aborting",
+              __FUNCTION__);
     return error;
   }
 
@@ -1211,9 +1204,10 @@ Status NativeProcessDarwin::ReplyToAllEx
   size_t index = 0;
   for (auto &message : m_exception_messages) {
     if (log) {
-      log->Printf("NativeProcessDarwin::%s(): replying to exception "
-                  "%zu...",
-                  __FUNCTION__, index++);
+      LLDB_LOGF(log,
+                "NativeProcessDarwin::%s(): replying to exception "
+                "%zu...",
+                __FUNCTION__, index++);
     }
 
     int thread_reply_signal = 0;
@@ -1234,9 +1228,10 @@ Status NativeProcessDarwin::ReplyToAllEx
     if (error.Fail() && log) {
       // We log any error here, but we don't stop the exception response
       // handling.
-      log->Printf("NativeProcessDarwin::%s(): failed to reply to "
-                  "exception: %s",
-                  __FUNCTION__, error.AsCString());
+      LLDB_LOGF(log,
+                "NativeProcessDarwin::%s(): failed to reply to "
+                "exception: %s",
+                __FUNCTION__, error.AsCString());
       error.Clear();
     }
   }
@@ -1253,10 +1248,10 @@ Status NativeProcessDarwin::ResumeTask()
 
   TaskPortForProcessID(error);
   if (error.Fail()) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s(): failed to get task port "
-                  "for process when attempting to resume: %s",
-                  __FUNCTION__, error.AsCString());
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s(): failed to get task port "
+              "for process when attempting to resume: %s",
+              __FUNCTION__, error.AsCString());
     return error;
   }
   if (m_task == TASK_NULL) {
@@ -1265,20 +1260,20 @@ Status NativeProcessDarwin::ResumeTask()
     return error;
   }
 
-  if (log)
-    log->Printf("NativeProcessDarwin::%s(): requesting resume of task "
-                "0x%4.4x",
-                __FUNCTION__, m_task);
+  LLDB_LOGF(log,
+            "NativeProcessDarwin::%s(): requesting resume of task "
+            "0x%4.4x",
+            __FUNCTION__, m_task);
 
   // Get the BasicInfo struct to verify that we're suspended before we try to
   // resume the task.
   struct task_basic_info task_info;
   error = GetTaskBasicInfo(m_task, &task_info);
   if (error.Fail()) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s(): failed to get task "
-                  "BasicInfo when attempting to resume: %s",
-                  __FUNCTION__, error.AsCString());
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s(): failed to get task "
+              "BasicInfo when attempting to resume: %s",
+              __FUNCTION__, error.AsCString());
     return error;
   }
 
@@ -1289,16 +1284,16 @@ Status NativeProcessDarwin::ResumeTask()
     error.SetError(mach_err, eErrorTypeMachKernel);
     if (log) {
       if (error.Success())
-        log->Printf("::task_resume(target_task = 0x%4.4x): success", m_task);
+        LLDB_LOGF(log, "::task_resume(target_task = 0x%4.4x): success", m_task);
       else
-        log->Printf("::task_resume(target_task = 0x%4.4x) error: %s", m_task,
-                    error.AsCString());
+        LLDB_LOGF(log, "::task_resume(target_task = 0x%4.4x) error: %s", m_task,
+                  error.AsCString());
     }
   } else {
-    if (log)
-      log->Printf("::task_resume(target_task = 0x%4.4x): ignored, "
-                  "already running",
-                  m_task);
+    LLDB_LOGF(log,
+              "::task_resume(target_task = 0x%4.4x): ignored, "
+              "already running",
+              m_task);
   }
 
   return error;
@@ -1353,11 +1348,11 @@ NativeProcessDarwin::GetTaskBasicInfo(ta
   auto err = ::task_info(m_task, TASK_BASIC_INFO, (task_info_t)info, &count);
   error.SetError(err, eErrorTypeMachKernel);
   if (error.Fail()) {
-    if (log)
-      log->Printf("::task_info(target_task = 0x%4.4x, "
-                  "flavor = TASK_BASIC_INFO, task_info_out => %p, "
-                  "task_info_outCnt => %u) failed: %u (%s)",
-                  m_task, info, count, error.GetError(), error.AsCString());
+    LLDB_LOGF(log,
+              "::task_info(target_task = 0x%4.4x, "
+              "flavor = TASK_BASIC_INFO, task_info_out => %p, "
+              "task_info_outCnt => %u) failed: %u (%s)",
+              m_task, info, count, error.GetError(), error.AsCString());
     return error;
   }
 
@@ -1368,11 +1363,12 @@ NativeProcessDarwin::GetTaskBasicInfo(ta
                  (float)info->user_time.microseconds / 1000000.0f;
     float system = (float)info->user_time.seconds +
                    (float)info->user_time.microseconds / 1000000.0f;
-    verbose_log->Printf("task_basic_info = { suspend_count = %i, "
-                        "virtual_size = 0x%8.8llx, resident_size = "
-                        "0x%8.8llx, user_time = %f, system_time = %f }",
-                        info->suspend_count, (uint64_t)info->virtual_size,
-                        (uint64_t)info->resident_size, user, system);
+    verbose_LLDB_LOGF(log,
+                      "task_basic_info = { suspend_count = %i, "
+                      "virtual_size = 0x%8.8llx, resident_size = "
+                      "0x%8.8llx, user_time = %f, system_time = %f }",
+                      info->suspend_count, (uint64_t)info->virtual_size,
+                      (uint64_t)info->resident_size, user, system);
   }
   return error;
 }
@@ -1383,16 +1379,15 @@ Status NativeProcessDarwin::SuspendTask(
 
   if (m_task == TASK_NULL) {
     error.SetErrorString("task port is null, cannot suspend task");
-    if (log)
-      log->Printf("NativeProcessDarwin::%s() failed: %s", __FUNCTION__,
-                  error.AsCString());
+    LLDB_LOGF(log, "NativeProcessDarwin::%s() failed: %s", __FUNCTION__,
+              error.AsCString());
     return error;
   }
 
   auto mach_err = ::task_suspend(m_task);
   error.SetError(mach_err, eErrorTypeMachKernel);
   if (error.Fail() && log)
-    log->Printf("::task_suspend(target_task = 0x%4.4x)", m_task);
+    LLDB_LOGF(log, "::task_suspend(target_task = 0x%4.4x)", m_task);
 
   return error;
 }
@@ -1401,8 +1396,7 @@ Status NativeProcessDarwin::Resume(const
   Status error;
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
 
-  if (log)
-    log->Printf("NativeProcessDarwin::%s() called", __FUNCTION__);
+  LLDB_LOGF(log, "NativeProcessDarwin::%s() called", __FUNCTION__);
 
   if (CanResume()) {
     m_thread_actions = resume_actions;
@@ -1412,10 +1406,10 @@ Status NativeProcessDarwin::Resume(const
 
   auto state = GetState();
   if (state == eStateRunning) {
-    if (log)
-      log->Printf("NativeProcessDarwin::%s(): task 0x%x is already "
-                  "running, ignoring...",
-                  __FUNCTION__, TaskPortForProcessID(error));
+    LLDB_LOGF(log,
+              "NativeProcessDarwin::%s(): task 0x%x is already "
+              "running, ignoring...",
+              __FUNCTION__, TaskPortForProcessID(error));
     return error;
   }
 

Modified: lldb/trunk/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp Wed Jul 24 10:56:10 2019
@@ -301,10 +301,10 @@ uint32_t NativeThreadListDarwin::UpdateT
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
 
   std::lock_guard<std::recursive_mutex> locker(m_threads_mutex);
-  if (log)
-    log->Printf("NativeThreadListDarwin::%s() (pid = %" PRIu64 ", update = "
-                "%u) process stop count = %u",
-                __FUNCTION__, process.GetID(), update, process.GetStopID());
+  LLDB_LOGF(log,
+            "NativeThreadListDarwin::%s() (pid = %" PRIu64 ", update = "
+            "%u) process stop count = %u",
+            __FUNCTION__, process.GetID(), update, process.GetStopID());
 
   if (process.GetStopID() == 0) {
     // On our first stop, we'll record details like 32/64 bitness and select
@@ -346,11 +346,11 @@ uint32_t NativeThreadListDarwin::UpdateT
     auto mach_err = ::task_threads(task, &thread_list, &thread_list_count);
     error.SetError(mach_err, eErrorTypeMachKernel);
     if (error.Fail()) {
-      if (log)
-        log->Printf("::task_threads(task = 0x%4.4x, thread_list => %p, "
-                    "thread_list_count => %u) failed: %u (%s)",
-                    task, thread_list, thread_list_count, error.GetError(),
-                    error.AsCString());
+      LLDB_LOGF(log,
+                "::task_threads(task = 0x%4.4x, thread_list => %p, "
+                "thread_list_count => %u) failed: %u (%s)",
+                task, thread_list, thread_list_count, error.GetError(),
+                error.AsCString());
       return 0;
     }
 

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp Wed Jul 24 10:56:10 2019
@@ -288,9 +288,8 @@ void FreeBSDThread::DidStop() {
 
 void FreeBSDThread::WillResume(lldb::StateType resume_state) {
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD));
-  if (log)
-    log->Printf("tid %lu resume_state = %s", GetID(),
-                lldb_private::StateAsCString(resume_state));
+  LLDB_LOGF(log, "tid %lu resume_state = %s", GetID(),
+            lldb_private::StateAsCString(resume_state));
   ProcessSP process_sp(GetProcess());
   ProcessFreeBSD *process = static_cast<ProcessFreeBSD *>(process_sp.get());
   int signo = GetResumeSignal();
@@ -322,9 +321,8 @@ bool FreeBSDThread::Resume() {
   bool status;
 
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD));
-  if (log)
-    log->Printf("FreeBSDThread::%s (), resume_state = %s", __FUNCTION__,
-                StateAsCString(resume_state));
+  LLDB_LOGF(log, "FreeBSDThread::%s (), resume_state = %s", __FUNCTION__,
+            StateAsCString(resume_state));
 
   switch (resume_state) {
   default:
@@ -352,9 +350,8 @@ bool FreeBSDThread::Resume() {
 
 void FreeBSDThread::Notify(const ProcessMessage &message) {
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD));
-  if (log)
-    log->Printf("FreeBSDThread::%s () message kind = '%s' for tid %" PRIu64,
-                __FUNCTION__, message.PrintKind(), GetID());
+  LLDB_LOGF(log, "FreeBSDThread::%s () message kind = '%s' for tid %" PRIu64,
+            __FUNCTION__, message.PrintKind(), GetID());
 
   switch (message.GetKind()) {
   default:
@@ -457,8 +454,7 @@ void FreeBSDThread::BreakNotify(const Pr
   // corresponding to our current PC.
   assert(GetRegisterContext());
   lldb::addr_t pc = GetRegisterContext()->GetPC();
-  if (log)
-    log->Printf("FreeBSDThread::%s () PC=0x%8.8" PRIx64, __FUNCTION__, pc);
+  LLDB_LOGF(log, "FreeBSDThread::%s () PC=0x%8.8" PRIx64, __FUNCTION__, pc);
   lldb::BreakpointSiteSP bp_site(
       GetProcess()->GetBreakpointSiteList().FindByAddress(pc));
 
@@ -490,10 +486,9 @@ void FreeBSDThread::WatchNotify(const Pr
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD));
 
   lldb::addr_t halt_addr = message.GetHWAddress();
-  if (log)
-    log->Printf(
-        "FreeBSDThread::%s () Hardware Watchpoint Address = 0x%8.8" PRIx64,
-        __FUNCTION__, halt_addr);
+  LLDB_LOGF(log,
+            "FreeBSDThread::%s () Hardware Watchpoint Address = 0x%8.8" PRIx64,
+            __FUNCTION__, halt_addr);
 
   POSIXBreakpointProtocol *reg_ctx = GetPOSIXBreakpointProtocol();
   if (reg_ctx) {
@@ -527,8 +522,7 @@ void FreeBSDThread::TraceNotify(const Pr
   // Try to resolve the breakpoint object corresponding to the current PC.
   assert(GetRegisterContext());
   lldb::addr_t pc = GetRegisterContext()->GetPC();
-  if (log)
-    log->Printf("FreeBSDThread::%s () PC=0x%8.8" PRIx64, __FUNCTION__, pc);
+  LLDB_LOGF(log, "FreeBSDThread::%s () PC=0x%8.8" PRIx64, __FUNCTION__, pc);
   lldb::BreakpointSiteSP bp_site(
       GetProcess()->GetBreakpointSiteList().FindByAddress(pc));
 

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Wed Jul 24 10:56:10 2019
@@ -154,9 +154,8 @@ Status ProcessFreeBSD::DoResume() {
     do_step = true;
   }
 
-  if (log)
-    log->Printf("process %" PRIu64 " resuming (%s)", GetID(),
-                do_step ? "step" : "continue");
+  LLDB_LOGF(log, "process %" PRIu64 " resuming (%s)", GetID(),
+            do_step ? "step" : "continue");
   if (do_step && !software_single_step)
     m_monitor->SingleStep(GetID(), m_resume_signo);
   else
@@ -168,9 +167,8 @@ Status ProcessFreeBSD::DoResume() {
 bool ProcessFreeBSD::UpdateThreadList(ThreadList &old_thread_list,
                                       ThreadList &new_thread_list) {
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
-  if (log)
-    log->Printf("ProcessFreeBSD::%s (pid = %" PRIu64 ")", __FUNCTION__,
-                GetID());
+  LLDB_LOGF(log, "ProcessFreeBSD::%s (pid = %" PRIu64 ")", __FUNCTION__,
+            GetID());
 
   std::vector<lldb::pid_t> tds;
   if (!GetMonitor().GetCurrentThreadIDs(tds)) {
@@ -183,20 +181,18 @@ bool ProcessFreeBSD::UpdateThreadList(Th
     ThreadSP thread_sp(old_thread_list_copy.RemoveThreadByID(tid, false));
     if (!thread_sp) {
       thread_sp.reset(new FreeBSDThread(*this, tid));
-      if (log)
-        log->Printf("ProcessFreeBSD::%s new tid = %" PRIu64, __FUNCTION__, tid);
+      LLDB_LOGF(log, "ProcessFreeBSD::%s new tid = %" PRIu64, __FUNCTION__,
+                tid);
     } else {
-      if (log)
-        log->Printf("ProcessFreeBSD::%s existing tid = %" PRIu64, __FUNCTION__,
-                    tid);
+      LLDB_LOGF(log, "ProcessFreeBSD::%s existing tid = %" PRIu64, __FUNCTION__,
+                tid);
     }
     new_thread_list.AddThread(thread_sp);
   }
   for (size_t i = 0; i < old_thread_list_copy.GetSize(false); ++i) {
     ThreadSP old_thread_sp(old_thread_list_copy.GetThreadAtIndex(i, false));
     if (old_thread_sp) {
-      if (log)
-        log->Printf("ProcessFreeBSD::%s remove tid", __FUNCTION__);
+      LLDB_LOGF(log, "ProcessFreeBSD::%s remove tid", __FUNCTION__);
     }
   }
 
@@ -698,14 +694,13 @@ Status ProcessFreeBSD::EnableWatchpoint(
     user_id_t watchID = wp->GetID();
     addr_t addr = wp->GetLoadAddress();
     Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
-    if (log)
-      log->Printf("ProcessFreeBSD::EnableWatchpoint(watchID = %" PRIu64 ")",
-                  watchID);
+    LLDB_LOGF(log, "ProcessFreeBSD::EnableWatchpoint(watchID = %" PRIu64 ")",
+              watchID);
     if (wp->IsEnabled()) {
-      if (log)
-        log->Printf("ProcessFreeBSD::EnableWatchpoint(watchID = %" PRIu64
-                    ") addr = 0x%8.8" PRIx64 ": watchpoint already enabled.",
-                    watchID, (uint64_t)addr);
+      LLDB_LOGF(log,
+                "ProcessFreeBSD::EnableWatchpoint(watchID = %" PRIu64
+                ") addr = 0x%8.8" PRIx64 ": watchpoint already enabled.",
+                watchID, (uint64_t)addr);
       return error;
     }
 
@@ -753,14 +748,13 @@ Status ProcessFreeBSD::DisableWatchpoint
     user_id_t watchID = wp->GetID();
     addr_t addr = wp->GetLoadAddress();
     Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_WATCHPOINTS));
-    if (log)
-      log->Printf("ProcessFreeBSD::DisableWatchpoint(watchID = %" PRIu64 ")",
-                  watchID);
+    LLDB_LOGF(log, "ProcessFreeBSD::DisableWatchpoint(watchID = %" PRIu64 ")",
+              watchID);
     if (!wp->IsEnabled()) {
-      if (log)
-        log->Printf("ProcessFreeBSD::DisableWatchpoint(watchID = %" PRIu64
-                    ") addr = 0x%8.8" PRIx64 ": watchpoint already disabled.",
-                    watchID, (uint64_t)addr);
+      LLDB_LOGF(log,
+                "ProcessFreeBSD::DisableWatchpoint(watchID = %" PRIu64
+                ") addr = 0x%8.8" PRIx64 ": watchpoint already disabled.",
+                watchID, (uint64_t)addr);
       // This is needed (for now) to keep watchpoints disabled correctly
       wp->SetEnabled(false, notify);
       return error;
@@ -970,8 +964,9 @@ Status ProcessFreeBSD::SetSoftwareSingle
 
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
   if (log) {
-    log->Printf("ProcessFreeBSD::%s addr = 0x%" PRIx64, __FUNCTION__, addr);
-    log->Printf("SoftwareBreakpoint::%s addr = 0x%" PRIx64, __FUNCTION__, addr);
+    LLDB_LOGF(log, "ProcessFreeBSD::%s addr = 0x%" PRIx64, __FUNCTION__, addr);
+    LLDB_LOGF(log, "SoftwareBreakpoint::%s addr = 0x%" PRIx64, __FUNCTION__,
+              addr);
   }
 
   // Validate the address.
@@ -984,9 +979,8 @@ Status ProcessFreeBSD::SetSoftwareSingle
   sw_step_break->SetCallback(SingleStepBreakpointHit, this, true);
   sw_step_break->SetBreakpointKind("software-signle-step");
 
-  if (log)
-    log->Printf("ProcessFreeBSD::%s addr = 0x%" PRIx64 " -- SUCCESS",
-                __FUNCTION__, addr);
+  LLDB_LOGF(log, "ProcessFreeBSD::%s addr = 0x%" PRIx64 " -- SUCCESS",
+            __FUNCTION__, addr);
 
   m_threads_stepping_with_breakpoint.insert({tid, sw_step_break->GetID()});
   return Status();

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Wed Jul 24 10:56:10 2019
@@ -66,13 +66,14 @@ extern long PtraceWrapper(int req, lldb:
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE));
 
   if (log) {
-    log->Printf("ptrace(%s, %" PRIu64 ", %p, %x) called from file %s line %d",
-                reqName, pid, addr, data, file, line);
+    LLDB_LOGF(log,
+              "ptrace(%s, %" PRIu64 ", %p, %x) called from file %s line %d",
+              reqName, pid, addr, data, file, line);
     if (req == PT_IO) {
       struct ptrace_io_desc *pi = (struct ptrace_io_desc *)addr;
 
-      log->Printf("PT_IO: op=%s offs=%zx size=%zu", Get_PT_IO_OP(pi->piod_op),
-                  (size_t)pi->piod_offs, pi->piod_len);
+      LLDB_LOGF(log, "PT_IO: op=%s offs=%zx size=%zu",
+                Get_PT_IO_OP(pi->piod_op), (size_t)pi->piod_offs, pi->piod_len);
     }
   }
 
@@ -101,7 +102,7 @@ extern long PtraceWrapper(int req, lldb:
     default:
       str = "<unknown>";
     }
-    log->Printf("ptrace() failed; errno=%d (%s)", errno, str);
+    LLDB_LOGF(log, "ptrace() failed; errno=%d (%s)", errno, str);
   }
 
   if (log) {
@@ -109,15 +110,15 @@ extern long PtraceWrapper(int req, lldb:
     if (req == PT_GETREGS) {
       struct reg *r = (struct reg *)addr;
 
-      log->Printf("PT_GETREGS: rip=0x%lx rsp=0x%lx rbp=0x%lx rax=0x%lx",
-                  r->r_rip, r->r_rsp, r->r_rbp, r->r_rax);
+      LLDB_LOGF(log, "PT_GETREGS: rip=0x%lx rsp=0x%lx rbp=0x%lx rax=0x%lx",
+                r->r_rip, r->r_rsp, r->r_rbp, r->r_rax);
     }
     if (req == PT_GETDBREGS || req == PT_SETDBREGS) {
       struct dbreg *r = (struct dbreg *)addr;
       char setget = (req == PT_GETDBREGS) ? 'G' : 'S';
 
       for (int i = 0; i <= 7; i++)
-        log->Printf("PT_%cETDBREGS: dr[%d]=0x%lx", setget, i, r->dr[i]);
+        LLDB_LOGF(log, "PT_%cETDBREGS: dr[%d]=0x%lx", setget, i, r->dr[i]);
     }
 #endif
   }
@@ -1037,9 +1038,8 @@ bool ProcessMonitor::MonitorCallback(Pro
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
 
   if (exited) {
-    if (log)
-      log->Printf("ProcessMonitor::%s() got exit signal, tid = %" PRIu64,
-                  __FUNCTION__, pid);
+    LLDB_LOGF(log, "ProcessMonitor::%s() got exit signal, tid = %" PRIu64,
+              __FUNCTION__, pid);
     message = ProcessMessage::Exit(pid, status);
     process->SendMessage(message);
     return pid == process->GetID();
@@ -1087,10 +1087,10 @@ ProcessMessage ProcessMonitor::MonitorSI
     unsigned long data = 0;
     if (!monitor->GetEventMessage(tid, &data))
       data = -1;
-    if (log)
-      log->Printf("ProcessMonitor::%s() received exit? event, data = %lx, tid "
-                  "= %" PRIu64,
-                  __FUNCTION__, data, tid);
+    LLDB_LOGF(log,
+              "ProcessMonitor::%s() received exit? event, data = %lx, tid "
+              "= %" PRIu64,
+              __FUNCTION__, data, tid);
     message = ProcessMessage::Limbo(tid, (data >> 8));
     break;
   }
@@ -1101,26 +1101,25 @@ ProcessMessage ProcessMonitor::MonitorSI
   // Map TRAP_CAP to a trace trap in the absense of a more specific handler.
   case TRAP_CAP:
 #endif
-    if (log)
-      log->Printf("ProcessMonitor::%s() received trace event, tid = %" PRIu64
-                  "  : si_code = %d",
-                  __FUNCTION__, tid, info->si_code);
+    LLDB_LOGF(log,
+              "ProcessMonitor::%s() received trace event, tid = %" PRIu64
+              "  : si_code = %d",
+              __FUNCTION__, tid, info->si_code);
     message = ProcessMessage::Trace(tid);
     break;
 
   case SI_KERNEL:
   case TRAP_BRKPT:
     if (monitor->m_process->IsSoftwareStepBreakpoint(tid)) {
-      if (log)
-        log->Printf("ProcessMonitor::%s() received sw single step breakpoint "
-                    "event, tid = %" PRIu64,
-                    __FUNCTION__, tid);
+      LLDB_LOGF(log,
+                "ProcessMonitor::%s() received sw single step breakpoint "
+                "event, tid = %" PRIu64,
+                __FUNCTION__, tid);
       message = ProcessMessage::Trace(tid);
     } else {
-      if (log)
-        log->Printf(
-            "ProcessMonitor::%s() received breakpoint event, tid = %" PRIu64,
-            __FUNCTION__, tid);
+      LLDB_LOGF(
+          log, "ProcessMonitor::%s() received breakpoint event, tid = %" PRIu64,
+          __FUNCTION__, tid);
       message = ProcessMessage::Break(tid);
     }
     break;
@@ -1146,22 +1145,19 @@ ProcessMessage ProcessMonitor::MonitorSi
   //
   // Similarly, ACK signals generated by this monitor.
   if (info->si_code == SI_USER) {
-    if (log)
-      log->Printf(
-          "ProcessMonitor::%s() received signal %s with code %s, pid = %d",
-          __FUNCTION__,
-          monitor->m_process->GetUnixSignals()->GetSignalAsCString(signo),
-          "SI_USER", info->si_pid);
+    LLDB_LOGF(log,
+              "ProcessMonitor::%s() received signal %s with code %s, pid = %d",
+              __FUNCTION__,
+              monitor->m_process->GetUnixSignals()->GetSignalAsCString(signo),
+              "SI_USER", info->si_pid);
     if (info->si_pid == getpid())
       return ProcessMessage::SignalDelivered(tid, signo);
     else
       return ProcessMessage::Signal(tid, signo);
   }
 
-  if (log)
-    log->Printf(
-        "ProcessMonitor::%s() received signal %s", __FUNCTION__,
-        monitor->m_process->GetUnixSignals()->GetSignalAsCString(signo));
+  LLDB_LOGF(log, "ProcessMonitor::%s() received signal %s", __FUNCTION__,
+            monitor->m_process->GetUnixSignals()->GetSignalAsCString(signo));
 
   switch (signo) {
   case SIGSEGV:
@@ -1313,14 +1309,14 @@ bool ProcessMonitor::Resume(lldb::tid_t
         m_process->GetUnixSignals()->GetSignalAsCString(signo);
     if (signame == nullptr)
       signame = "<none>";
-    log->Printf("ProcessMonitor::%s() resuming pid %" PRIu64 " with signal %s",
-                __FUNCTION__, GetPID(), signame);
+    LLDB_LOGF(log,
+              "ProcessMonitor::%s() resuming pid %" PRIu64 " with signal %s",
+              __FUNCTION__, GetPID(), signame);
   }
   ResumeOperation op(signo, result);
   DoOperation(&op);
-  if (log)
-    log->Printf("ProcessMonitor::%s() resuming result = %s", __FUNCTION__,
-                result ? "true" : "false");
+  LLDB_LOGF(log, "ProcessMonitor::%s() resuming result = %s", __FUNCTION__,
+            result ? "true" : "false");
   return result;
 }
 

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp Wed Jul 24 10:56:10 2019
@@ -346,8 +346,7 @@ bool NativeRegisterContextLinux_arm::IsF
 uint32_t NativeRegisterContextLinux_arm::NumSupportedHardwareBreakpoints() {
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS));
 
-  if (log)
-    log->Printf("NativeRegisterContextLinux_arm::%s()", __FUNCTION__);
+  LLDB_LOGF(log, "NativeRegisterContextLinux_arm::%s()", __FUNCTION__);
 
   Status error;
 
@@ -458,8 +457,7 @@ Status NativeRegisterContextLinux_arm::G
     uint32_t &bp_index, lldb::addr_t trap_addr) {
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS));
 
-  if (log)
-    log->Printf("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
+  LLDB_LOGF(log, "NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
 
   lldb::addr_t break_addr;
 
@@ -479,8 +477,7 @@ Status NativeRegisterContextLinux_arm::G
 Status NativeRegisterContextLinux_arm::ClearAllHardwareBreakpoints() {
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS));
 
-  if (log)
-    log->Printf("NativeRegisterContextLinux_arm::%s()", __FUNCTION__);
+  LLDB_LOGF(log, "NativeRegisterContextLinux_arm::%s()", __FUNCTION__);
 
   Status error;
 

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp Wed Jul 24 10:56:10 2019
@@ -347,8 +347,7 @@ bool NativeRegisterContextLinux_arm64::I
 uint32_t NativeRegisterContextLinux_arm64::NumSupportedHardwareBreakpoints() {
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS));
 
-  if (log)
-    log->Printf("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
+  LLDB_LOGF(log, "NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
 
   Status error;
 
@@ -458,8 +457,7 @@ Status NativeRegisterContextLinux_arm64:
     uint32_t &bp_index, lldb::addr_t trap_addr) {
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS));
 
-  if (log)
-    log->Printf("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
+  LLDB_LOGF(log, "NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
 
   lldb::addr_t break_addr;
 
@@ -479,8 +477,7 @@ Status NativeRegisterContextLinux_arm64:
 Status NativeRegisterContextLinux_arm64::ClearAllHardwareBreakpoints() {
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS));
 
-  if (log)
-    log->Printf("NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
+  LLDB_LOGF(log, "NativeRegisterContextLinux_arm64::%s()", __FUNCTION__);
 
   Status error;
 

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp Wed Jul 24 10:56:10 2019
@@ -1191,8 +1191,8 @@ uint32_t NativeRegisterContextLinux_x86_
         return wp_index;
     }
     if (error.Fail() && log) {
-      log->Printf("NativeRegisterContextLinux_x86_64::%s Error: %s",
-                  __FUNCTION__, error.AsCString());
+      LLDB_LOGF(log, "NativeRegisterContextLinux_x86_64::%s Error: %s",
+                __FUNCTION__, error.AsCString());
     }
   }
   return LLDB_INVALID_INDEX32;

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp Wed Jul 24 10:56:10 2019
@@ -133,9 +133,10 @@ bool NativeThreadLinux::GetStopReason(Th
   case eStateStepping:
   case eStateDetached:
     if (log) {
-      log->Printf("NativeThreadLinux::%s tid %" PRIu64
-                  " in state %s cannot answer stop reason",
-                  __FUNCTION__, GetID(), StateAsCString(m_state));
+      LLDB_LOGF(log,
+                "NativeThreadLinux::%s tid %" PRIu64
+                " in state %s cannot answer stop reason",
+                __FUNCTION__, GetID(), StateAsCString(m_state));
     }
     return false;
   }
@@ -273,9 +274,8 @@ Status NativeThreadLinux::SingleStep(uin
 void NativeThreadLinux::SetStoppedBySignal(uint32_t signo,
                                            const siginfo_t *info) {
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
-  if (log)
-    log->Printf("NativeThreadLinux::%s called with signal 0x%02" PRIx32,
-                __FUNCTION__, signo);
+  LLDB_LOGF(log, "NativeThreadLinux::%s called with signal 0x%02" PRIx32,
+            __FUNCTION__, signo);
 
   SetStopped();
 
@@ -327,8 +327,7 @@ void NativeThreadLinux::SetStopped() {
 
 void NativeThreadLinux::SetStoppedByExec() {
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
-  if (log)
-    log->Printf("NativeThreadLinux::%s()", __FUNCTION__);
+  LLDB_LOGF(log, "NativeThreadLinux::%s()", __FUNCTION__);
 
   SetStopped();
 
@@ -412,19 +411,19 @@ Status NativeThreadLinux::RequestStop()
   lldb::pid_t pid = process.GetID();
   lldb::tid_t tid = GetID();
 
-  if (log)
-    log->Printf("NativeThreadLinux::%s requesting thread stop(pid: %" PRIu64
-                ", tid: %" PRIu64 ")",
-                __FUNCTION__, pid, tid);
+  LLDB_LOGF(log,
+            "NativeThreadLinux::%s requesting thread stop(pid: %" PRIu64
+            ", tid: %" PRIu64 ")",
+            __FUNCTION__, pid, tid);
 
   Status err;
   errno = 0;
   if (::tgkill(pid, tid, SIGSTOP) != 0) {
     err.SetErrorToErrno();
-    if (log)
-      log->Printf("NativeThreadLinux::%s tgkill(%" PRIu64 ", %" PRIu64
-                  ", SIGSTOP) failed: %s",
-                  __FUNCTION__, pid, tid, err.AsCString());
+    LLDB_LOGF(log,
+              "NativeThreadLinux::%s tgkill(%" PRIu64 ", %" PRIu64
+              ", SIGSTOP) failed: %s",
+              __FUNCTION__, pid, tid, err.AsCString());
   }
 
   return err;

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp Wed Jul 24 10:56:10 2019
@@ -70,8 +70,8 @@ bool CommunicationKDP::SendRequestAndGet
     if (log) {
       PacketStreamType log_strm;
       DumpPacket(log_strm, request_packet.GetData(), request_packet.GetSize());
-      log->Printf("error: kdp running, not sending packet: %.*s",
-                  (uint32_t)log_strm.GetSize(), log_strm.GetData());
+      LLDB_LOGF(log, "error: kdp running, not sending packet: %.*s",
+                (uint32_t)log_strm.GetSize(), log_strm.GetData());
     }
     return false;
   }
@@ -140,7 +140,7 @@ bool CommunicationKDP::SendRequestPacket
     if (log) {
       PacketStreamType log_strm;
       DumpPacket(log_strm, packet_data, packet_size);
-      log->Printf("%.*s", (uint32_t)log_strm.GetSize(), log_strm.GetData());
+      LLDB_LOGF(log, "%.*s", (uint32_t)log_strm.GetSize(), log_strm.GetData());
     }
     ConnectionStatus status = eConnectionStatusSuccess;
 
@@ -149,10 +149,10 @@ bool CommunicationKDP::SendRequestPacket
     if (bytes_written == packet_size)
       return true;
 
-    if (log)
-      log->Printf("error: failed to send packet entire packet %" PRIu64
-                  " of %" PRIu64 " bytes sent",
-                  (uint64_t)bytes_written, (uint64_t)packet_size);
+    LLDB_LOGF(log,
+              "error: failed to send packet entire packet %" PRIu64
+              " of %" PRIu64 " bytes sent",
+              (uint64_t)bytes_written, (uint64_t)packet_size);
   }
   return false;
 }
@@ -241,8 +241,8 @@ bool CommunicationKDP::CheckForPacket(co
     if (log && log->GetVerbose()) {
       PacketStreamType log_strm;
       DumpHexBytes(&log_strm, src, src_len, UINT32_MAX, LLDB_INVALID_ADDRESS);
-      log->Printf("CommunicationKDP::%s adding %u bytes: %s", __FUNCTION__,
-                  (uint32_t)src_len, log_strm.GetData());
+      LLDB_LOGF(log, "CommunicationKDP::%s adding %u bytes: %s", __FUNCTION__,
+                (uint32_t)src_len, log_strm.GetData());
     }
     m_bytes.append((const char *)src, src_len);
   }
@@ -314,7 +314,8 @@ bool CommunicationKDP::CheckForPacket(co
           PacketStreamType log_strm;
           DumpPacket(log_strm, packet);
 
-          log->Printf("%.*s", (uint32_t)log_strm.GetSize(), log_strm.GetData());
+          LLDB_LOGF(log, "%.*s", (uint32_t)log_strm.GetSize(),
+                    log_strm.GetData());
         }
         return true;
       }
@@ -323,9 +324,8 @@ bool CommunicationKDP::CheckForPacket(co
     default:
       // Unrecognized reply command byte, erase this byte and try to get back
       // on track
-      if (log)
-        log->Printf("CommunicationKDP::%s: tossing junk byte: 0x%2.2x",
-                    __FUNCTION__, (uint8_t)m_bytes[0]);
+      LLDB_LOGF(log, "CommunicationKDP::%s: tossing junk byte: 0x%2.2x",
+                __FUNCTION__, (uint8_t)m_bytes[0]);
       m_bytes.erase(0, 1);
       break;
     }

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Wed Jul 24 10:56:10 2019
@@ -394,8 +394,7 @@ void ProcessKDP::DidAttach(ArchSpec &pro
   Process::DidAttach(process_arch);
 
   Log *log(ProcessKDPLog::GetLogIfAllCategoriesSet(KDP_LOG_PROCESS));
-  if (log)
-    log->Printf("ProcessKDP::DidAttach()");
+  LLDB_LOGF(log, "ProcessKDP::DidAttach()");
   if (GetID() != LLDB_INVALID_PROCESS_ID) {
     GetHostArchitecture(process_arch);
   }
@@ -429,15 +428,13 @@ Status ProcessKDP::DoResume() {
     const StateType thread_resume_state =
         kernel_thread_sp->GetTemporaryResumeState();
 
-    if (log)
-      log->Printf("ProcessKDP::DoResume() thread_resume_state = %s",
-                  StateAsCString(thread_resume_state));
+    LLDB_LOGF(log, "ProcessKDP::DoResume() thread_resume_state = %s",
+              StateAsCString(thread_resume_state));
     switch (thread_resume_state) {
     case eStateSuspended:
       // Nothing to do here when a thread will stay suspended we just leave the
       // CPU mask bit set to zero for the thread
-      if (log)
-        log->Printf("ProcessKDP::DoResume() = suspended???");
+      LLDB_LOGF(log, "ProcessKDP::DoResume() = suspended???");
       break;
 
     case eStateStepping: {
@@ -445,9 +442,9 @@ Status ProcessKDP::DoResume() {
           kernel_thread_sp->GetRegisterContext());
 
       if (reg_ctx_sp) {
-        if (log)
-          log->Printf(
-              "ProcessKDP::DoResume () reg_ctx_sp->HardwareSingleStep (true);");
+        LLDB_LOGF(
+            log,
+            "ProcessKDP::DoResume () reg_ctx_sp->HardwareSingleStep (true);");
         reg_ctx_sp->HardwareSingleStep(true);
         resume = true;
       } else {
@@ -462,9 +459,8 @@ Status ProcessKDP::DoResume() {
           kernel_thread_sp->GetRegisterContext());
 
       if (reg_ctx_sp) {
-        if (log)
-          log->Printf("ProcessKDP::DoResume () reg_ctx_sp->HardwareSingleStep "
-                      "(false);");
+        LLDB_LOGF(log, "ProcessKDP::DoResume () reg_ctx_sp->HardwareSingleStep "
+                       "(false);");
         reg_ctx_sp->HardwareSingleStep(false);
         resume = true;
       } else {
@@ -481,8 +477,7 @@ Status ProcessKDP::DoResume() {
   }
 
   if (resume) {
-    if (log)
-      log->Printf("ProcessKDP::DoResume () sending resume");
+    LLDB_LOGF(log, "ProcessKDP::DoResume () sending resume");
 
     if (m_comm.SendRequestResume()) {
       m_async_broadcaster.BroadcastEvent(eBroadcastBitAsyncContinue);
@@ -550,8 +545,7 @@ Status ProcessKDP::DoHalt(bool &caused_s
 Status ProcessKDP::DoDetach(bool keep_stopped) {
   Status error;
   Log *log(ProcessKDPLog::GetLogIfAllCategoriesSet(KDP_LOG_PROCESS));
-  if (log)
-    log->Printf("ProcessKDP::DoDetach(keep_stopped = %i)", keep_stopped);
+  LLDB_LOGF(log, "ProcessKDP::DoDetach(keep_stopped = %i)", keep_stopped);
 
   if (m_comm.IsRunning()) {
     // We are running and we can't interrupt a running kernel, so we need to
@@ -734,8 +728,7 @@ void ProcessKDP::DebuggerInitialize(lldb
 bool ProcessKDP::StartAsyncThread() {
   Log *log(ProcessKDPLog::GetLogIfAllCategoriesSet(KDP_LOG_PROCESS));
 
-  if (log)
-    log->Printf("ProcessKDP::StartAsyncThread ()");
+  LLDB_LOGF(log, "ProcessKDP::StartAsyncThread ()");
 
   if (m_async_thread.IsJoinable())
     return true;
@@ -755,8 +748,7 @@ bool ProcessKDP::StartAsyncThread() {
 void ProcessKDP::StopAsyncThread() {
   Log *log(ProcessKDPLog::GetLogIfAllCategoriesSet(KDP_LOG_PROCESS));
 
-  if (log)
-    log->Printf("ProcessKDP::StopAsyncThread ()");
+  LLDB_LOGF(log, "ProcessKDP::StopAsyncThread ()");
 
   m_async_broadcaster.BroadcastEvent(eBroadcastBitAsyncThreadShouldExit);
 
@@ -771,10 +763,10 @@ void *ProcessKDP::AsyncThread(void *arg)
   const lldb::pid_t pid = process->GetID();
 
   Log *log(ProcessKDPLog::GetLogIfAllCategoriesSet(KDP_LOG_PROCESS));
-  if (log)
-    log->Printf("ProcessKDP::AsyncThread (arg = %p, pid = %" PRIu64
-                ") thread starting...",
-                arg, pid);
+  LLDB_LOGF(log,
+            "ProcessKDP::AsyncThread (arg = %p, pid = %" PRIu64
+            ") thread starting...",
+            arg, pid);
 
   ListenerSP listener_sp(Listener::MakeListener("ProcessKDP::AsyncThread"));
   EventSP event_sp;
@@ -786,16 +778,16 @@ void *ProcessKDP::AsyncThread(void *arg)
       desired_event_mask) {
     bool done = false;
     while (!done) {
-      if (log)
-        log->Printf("ProcessKDP::AsyncThread (pid = %" PRIu64
-                    ") listener.WaitForEvent (NULL, event_sp)...",
-                    pid);
+      LLDB_LOGF(log,
+                "ProcessKDP::AsyncThread (pid = %" PRIu64
+                ") listener.WaitForEvent (NULL, event_sp)...",
+                pid);
       if (listener_sp->GetEvent(event_sp, llvm::None)) {
         uint32_t event_type = event_sp->GetType();
-        if (log)
-          log->Printf("ProcessKDP::AsyncThread (pid = %" PRIu64
-                      ") Got an event of type: %d...",
-                      pid, event_type);
+        LLDB_LOGF(log,
+                  "ProcessKDP::AsyncThread (pid = %" PRIu64
+                  ") Got an event of type: %d...",
+                  pid, event_type);
 
         // When we are running, poll for 1 second to try and get an exception
         // to indicate the process has stopped. If we don't get one, check to
@@ -834,38 +826,38 @@ void *ProcessKDP::AsyncThread(void *arg)
           } break;
 
           case eBroadcastBitAsyncThreadShouldExit:
-            if (log)
-              log->Printf("ProcessKDP::AsyncThread (pid = %" PRIu64
-                          ") got eBroadcastBitAsyncThreadShouldExit...",
-                          pid);
+            LLDB_LOGF(log,
+                      "ProcessKDP::AsyncThread (pid = %" PRIu64
+                      ") got eBroadcastBitAsyncThreadShouldExit...",
+                      pid);
             done = true;
             is_running = false;
             break;
 
           default:
-            if (log)
-              log->Printf("ProcessKDP::AsyncThread (pid = %" PRIu64
-                          ") got unknown event 0x%8.8x",
-                          pid, event_type);
+            LLDB_LOGF(log,
+                      "ProcessKDP::AsyncThread (pid = %" PRIu64
+                      ") got unknown event 0x%8.8x",
+                      pid, event_type);
             done = true;
             is_running = false;
             break;
           }
         } while (is_running);
       } else {
-        if (log)
-          log->Printf("ProcessKDP::AsyncThread (pid = %" PRIu64
-                      ") listener.WaitForEvent (NULL, event_sp) => false",
-                      pid);
+        LLDB_LOGF(log,
+                  "ProcessKDP::AsyncThread (pid = %" PRIu64
+                  ") listener.WaitForEvent (NULL, event_sp) => false",
+                  pid);
         done = true;
       }
     }
   }
 
-  if (log)
-    log->Printf("ProcessKDP::AsyncThread (arg = %p, pid = %" PRIu64
-                ") thread exiting...",
-                arg, pid);
+  LLDB_LOGF(log,
+            "ProcessKDP::AsyncThread (arg = %p, pid = %" PRIu64
+            ") thread exiting...",
+            arg, pid);
 
   process->m_async_thread.Reset();
   return NULL;

Modified: lldb/trunk/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp Wed Jul 24 10:56:10 2019
@@ -906,8 +906,8 @@ uint32_t NativeRegisterContextNetBSD_x86
         return wp_index;
     }
     if (error.Fail() && log) {
-      log->Printf("NativeRegisterContextNetBSD_x86_64::%s Error: %s",
-                  __FUNCTION__, error.AsCString());
+      LLDB_LOGF(log, "NativeRegisterContextNetBSD_x86_64::%s Error: %s",
+                __FUNCTION__, error.AsCString());
     }
   }
   return LLDB_INVALID_INDEX32;

Modified: lldb/trunk/source/Plugins/Process/Utility/AuxVector.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/AuxVector.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/AuxVector.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/AuxVector.cpp Wed Jul 24 10:56:10 2019
@@ -43,9 +43,9 @@ void AuxVector::DumpToLog(lldb_private::
 
   log->PutCString("AuxVector: ");
   for (auto entry : m_auxv_entries) {
-    log->Printf("   %s [%" PRIu64 "]: %" PRIx64,
-                GetEntryName(static_cast<EntryType>(entry.first)), entry.first,
-                entry.second);
+    LLDB_LOGF(log, "   %s [%" PRIu64 "]: %" PRIx64,
+              GetEntryName(static_cast<EntryType>(entry.first)), entry.first,
+              entry.second);
   }
 }
 

Modified: lldb/trunk/source/Plugins/Process/Utility/HistoryThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/HistoryThread.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/HistoryThread.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/HistoryThread.cpp Wed Jul 24 10:56:10 2019
@@ -32,17 +32,15 @@ HistoryThread::HistoryThread(lldb_privat
       m_queue_id(LLDB_INVALID_QUEUE_ID) {
   m_unwinder_up.reset(new HistoryUnwind(*this, pcs));
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
-  if (log)
-    log->Printf("%p HistoryThread::HistoryThread", static_cast<void *>(this));
+  LLDB_LOGF(log, "%p HistoryThread::HistoryThread", static_cast<void *>(this));
 }
 
 //  Destructor
 
 HistoryThread::~HistoryThread() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
-  if (log)
-    log->Printf("%p HistoryThread::~HistoryThread (tid=0x%" PRIx64 ")",
-                static_cast<void *>(this), GetID());
+  LLDB_LOGF(log, "%p HistoryThread::~HistoryThread (tid=0x%" PRIx64 ")",
+            static_cast<void *>(this), GetID());
   DestroyThread();
 }
 

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp Wed Jul 24 10:56:10 2019
@@ -1111,9 +1111,10 @@ int RegisterContextDarwin_arm::WriteRegi
 void RegisterContextDarwin_arm::LogDBGRegisters(Log *log, const DBG &dbg) {
   if (log) {
     for (uint32_t i = 0; i < 16; i++)
-      log->Printf("BVR%-2u/BCR%-2u = { 0x%8.8x, 0x%8.8x } WVR%-2u/WCR%-2u = { "
-                  "0x%8.8x, 0x%8.8x }",
-                  i, i, dbg.bvr[i], dbg.bcr[i], i, i, dbg.wvr[i], dbg.wcr[i]);
+      LLDB_LOGF(log,
+                "BVR%-2u/BCR%-2u = { 0x%8.8x, 0x%8.8x } WVR%-2u/WCR%-2u = { "
+                "0x%8.8x, 0x%8.8x }",
+                i, i, dbg.bvr[i], dbg.bcr[i], i, i, dbg.wvr[i], dbg.wcr[i]);
   }
 }
 
@@ -1514,8 +1515,6 @@ uint32_t RegisterContextDarwin_arm::NumS
     // Zero is reserved for the BRP count, so don't increment it if it is zero
     if (g_num_supported_hw_breakpoints > 0)
       g_num_supported_hw_breakpoints++;
-    //        if (log) log->Printf ("DBGDIDR=0x%8.8x (number BRP pairs = %u)",
-    //        register_DBGDIDR, g_num_supported_hw_breakpoints);
   }
   return g_num_supported_hw_breakpoints;
 #else
@@ -1642,8 +1641,6 @@ uint32_t RegisterContextDarwin_arm::NumS
     uint32_t register_DBGDIDR;
     asm("mrc p14, 0, %0, c0, c0, 0" : "=r"(register_DBGDIDR));
     g_num_supported_hw_watchpoints = Bits32(register_DBGDIDR, 31, 28) + 1;
-    //        if (log) log->Printf ("DBGDIDR=0x%8.8x (number WRP pairs = %u)",
-    //        register_DBGDIDR, g_num_supported_hw_watchpoints);
   }
   return g_num_supported_hw_watchpoints;
 #else
@@ -1656,10 +1653,6 @@ uint32_t RegisterContextDarwin_arm::SetH
                                                           size_t size,
                                                           bool read,
                                                           bool write) {
-  //    if (log) log->Printf
-  //    ("RegisterContextDarwin_arm::EnableHardwareWatchpoint(addr = %8.8p, size
-  //    = %u, read = %u, write = %u)", addr, size, read, write);
-
   const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints();
 
   // Can't watch zero bytes

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp Wed Jul 24 10:56:10 2019
@@ -285,10 +285,11 @@ int RegisterContextDarwin_arm64::WriteRe
 void RegisterContextDarwin_arm64::LogDBGRegisters(Log *log, const DBG &dbg) {
   if (log) {
     for (uint32_t i = 0; i < 16; i++)
-      log->Printf("BVR%-2u/BCR%-2u = { 0x%8.8" PRIu64 ", 0x%8.8" PRIu64
-                  " } WVR%-2u/WCR%-2u "
-                  "= { 0x%8.8" PRIu64 ", 0x%8.8" PRIu64 " }",
-                  i, i, dbg.bvr[i], dbg.bcr[i], i, i, dbg.wvr[i], dbg.wcr[i]);
+      LLDB_LOGF(log,
+                "BVR%-2u/BCR%-2u = { 0x%8.8" PRIu64 ", 0x%8.8" PRIu64
+                " } WVR%-2u/WCR%-2u "
+                "= { 0x%8.8" PRIu64 ", 0x%8.8" PRIu64 " }",
+                i, i, dbg.bvr[i], dbg.bcr[i], i, i, dbg.wvr[i], dbg.wcr[i]);
   }
 }
 

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp Wed Jul 24 10:56:10 2019
@@ -496,11 +496,11 @@ int RegisterContextDarwin_i386::GetSetFo
 void RegisterContextDarwin_i386::LogGPR(Log *log, const char *title) {
   if (log) {
     if (title)
-      log->Printf("%s", title);
+      LLDB_LOGF(log, "%s", title);
     for (uint32_t i = 0; i < k_num_gpr_registers; i++) {
       uint32_t reg = gpr_eax + i;
-      log->Printf("%12s = 0x%8.8x", g_register_infos[reg].name,
-                  (&gpr.eax)[reg]);
+      LLDB_LOGF(log, "%12s = 0x%8.8x", g_register_infos[reg].name,
+                (&gpr.eax)[reg]);
     }
   }
 }

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=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Wed Jul 24 10:56:10 2019
@@ -2087,8 +2087,9 @@ void RegisterContextLLDB::UnwindLogMsg(c
     }
     va_end(args);
 
-    log->Printf("%*sth%d/fr%u %s", m_frame_number < 100 ? m_frame_number : 100,
-                "", m_thread.GetIndexID(), m_frame_number, logmsg);
+    LLDB_LOGF(log, "%*sth%d/fr%u %s",
+              m_frame_number < 100 ? m_frame_number : 100, "",
+              m_thread.GetIndexID(), m_frame_number, logmsg);
     free(logmsg);
   }
 }
@@ -2108,8 +2109,9 @@ void RegisterContextLLDB::UnwindLogMsgVe
     }
     va_end(args);
 
-    log->Printf("%*sth%d/fr%u %s", m_frame_number < 100 ? m_frame_number : 100,
-                "", m_thread.GetIndexID(), m_frame_number, logmsg);
+    LLDB_LOGF(log, "%*sth%d/fr%u %s",
+              m_frame_number < 100 ? m_frame_number : 100, "",
+              m_thread.GetIndexID(), m_frame_number, logmsg);
     free(logmsg);
   }
 }

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=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Wed Jul 24 10:56:10 2019
@@ -104,8 +104,8 @@ bool UnwindLLDB::AddFirstFrame() {
 unwind_done:
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND));
   if (log) {
-    log->Printf("th%d Unwind of this thread is complete.",
-                m_thread.GetIndexID());
+    LLDB_LOGF(log, "th%d Unwind of this thread is complete.",
+              m_thread.GetIndexID());
   }
   m_unwind_complete = true;
   return false;
@@ -140,10 +140,10 @@ UnwindLLDB::CursorSP UnwindLLDB::GetOneM
   // is going to blow out the stack space. If we're still unwinding at that
   // point, we're probably never going to finish.
   if (cur_idx >= max_stack_depth) {
-    if (log)
-      log->Printf("%*sFrame %d unwound too many frames, assuming unwind has "
-                  "gone astray, stopping.",
-                  cur_idx < 100 ? cur_idx : 100, "", cur_idx);
+    LLDB_LOGF(log,
+              "%*sFrame %d unwound too many frames, assuming unwind has "
+              "gone astray, stopping.",
+              cur_idx < 100 ? cur_idx : 100, "", cur_idx);
     return nullptr;
   }
 
@@ -161,9 +161,8 @@ UnwindLLDB::CursorSP UnwindLLDB::GetOneM
       return GetOneMoreFrame(abi);
     }
 
-    if (log)
-      log->Printf("%*sFrame %d did not get a RegisterContext, stopping.",
-                  cur_idx < 100 ? cur_idx : 100, "", cur_idx);
+    LLDB_LOGF(log, "%*sFrame %d did not get a RegisterContext, stopping.",
+              cur_idx < 100 ? cur_idx : 100, "", cur_idx);
     return nullptr;
   }
 
@@ -181,10 +180,10 @@ UnwindLLDB::CursorSP UnwindLLDB::GetOneM
       return GetOneMoreFrame(abi);
     }
 
-    if (log)
-      log->Printf("%*sFrame %d invalid RegisterContext for this frame, "
-                  "stopping stack walk",
-                  cur_idx < 100 ? cur_idx : 100, "", cur_idx);
+    LLDB_LOGF(log,
+              "%*sFrame %d invalid RegisterContext for this frame, "
+              "stopping stack walk",
+              cur_idx < 100 ? cur_idx : 100, "", cur_idx);
     return nullptr;
   }
   if (!reg_ctx_sp->GetCFA(cursor_sp->cfa)) {
@@ -201,10 +200,9 @@ UnwindLLDB::CursorSP UnwindLLDB::GetOneM
       return GetOneMoreFrame(abi);
     }
 
-    if (log)
-      log->Printf(
-          "%*sFrame %d did not get CFA for this frame, stopping stack walk",
-          cur_idx < 100 ? cur_idx : 100, "", cur_idx);
+    LLDB_LOGF(log,
+              "%*sFrame %d did not get CFA for this frame, stopping stack walk",
+              cur_idx < 100 ? cur_idx : 100, "", cur_idx);
     return nullptr;
   }
   if (abi && !abi->CallFrameAddressIsValid(cursor_sp->cfa)) {
@@ -230,17 +228,17 @@ UnwindLLDB::CursorSP UnwindLLDB::GetOneM
           return GetOneMoreFrame(abi);
         }
 
-        if (log)
-          log->Printf("%*sFrame %d did not get a valid CFA for this frame, "
-                      "stopping stack walk",
-                      cur_idx < 100 ? cur_idx : 100, "", cur_idx);
+        LLDB_LOGF(log,
+                  "%*sFrame %d did not get a valid CFA for this frame, "
+                  "stopping stack walk",
+                  cur_idx < 100 ? cur_idx : 100, "", cur_idx);
         return nullptr;
       } else {
-        if (log)
-          log->Printf("%*sFrame %d had a bad CFA value but we switched the "
-                      "UnwindPlan being used and got one that looks more "
-                      "realistic.",
-                      cur_idx < 100 ? cur_idx : 100, "", cur_idx);
+        LLDB_LOGF(log,
+                  "%*sFrame %d had a bad CFA value but we switched the "
+                  "UnwindPlan being used and got one that looks more "
+                  "realistic.",
+                  cur_idx < 100 ? cur_idx : 100, "", cur_idx);
       }
     }
   }
@@ -258,10 +256,9 @@ UnwindLLDB::CursorSP UnwindLLDB::GetOneM
       return GetOneMoreFrame(abi);
     }
 
-    if (log)
-      log->Printf(
-          "%*sFrame %d did not get PC for this frame, stopping stack walk",
-          cur_idx < 100 ? cur_idx : 100, "", cur_idx);
+    LLDB_LOGF(log,
+              "%*sFrame %d did not get PC for this frame, stopping stack walk",
+              cur_idx < 100 ? cur_idx : 100, "", cur_idx);
     return nullptr;
   }
   if (abi && !abi->CodeAddressIsValid(cursor_sp->start_pc)) {
@@ -278,18 +275,17 @@ UnwindLLDB::CursorSP UnwindLLDB::GetOneM
       return GetOneMoreFrame(abi);
     }
 
-    if (log)
-      log->Printf("%*sFrame %d did not get a valid PC, stopping stack walk",
-                  cur_idx < 100 ? cur_idx : 100, "", cur_idx);
+    LLDB_LOGF(log, "%*sFrame %d did not get a valid PC, stopping stack walk",
+              cur_idx < 100 ? cur_idx : 100, "", cur_idx);
     return nullptr;
   }
   // Infinite loop where the current cursor is the same as the previous one...
   if (prev_frame->start_pc == cursor_sp->start_pc &&
       prev_frame->cfa == cursor_sp->cfa) {
-    if (log)
-      log->Printf("th%d pc of this frame is the same as the previous frame and "
-                  "CFAs for both frames are identical -- stopping unwind",
-                  m_thread.GetIndexID());
+    LLDB_LOGF(log,
+              "th%d pc of this frame is the same as the previous frame and "
+              "CFAs for both frames are identical -- stopping unwind",
+              m_thread.GetIndexID());
     return nullptr;
   }
 
@@ -337,9 +333,8 @@ bool UnwindLLDB::AddOneMoreFrame(ABI *ab
     new_frame = GetOneMoreFrame(abi);
 
   if (new_frame == nullptr) {
-    if (log)
-      log->Printf("th%d Unwind of this thread is complete.",
-                  m_thread.GetIndexID());
+    LLDB_LOGF(log, "th%d Unwind of this thread is complete.",
+              m_thread.GetIndexID());
     m_unwind_complete = true;
     return false;
   }

Modified: lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp Wed Jul 24 10:56:10 2019
@@ -417,7 +417,7 @@ static void ParseFreeBSDPrStatus(ThreadD
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
   if (log) {
     if (pr_version > 1)
-      log->Printf("FreeBSD PRSTATUS unexpected version %d", pr_version);
+      LLDB_LOGF(log, "FreeBSD PRSTATUS unexpected version %d", pr_version);
   }
 
   // Skip padding, pr_statussz, pr_gregsetsz, pr_fpregsetsz, pr_osreldate

Modified: lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.cpp Wed Jul 24 10:56:10 2019
@@ -181,9 +181,8 @@ ThreadElfCore::CreateRegisterContextForF
     }
 
     if (!reg_interface) {
-      if (log)
-        log->Printf("elf-core::%s:: Architecture(%d) or OS(%d) not supported",
-                    __FUNCTION__, arch.GetMachine(), arch.GetTriple().getOS());
+      LLDB_LOGF(log, "elf-core::%s:: Architecture(%d) or OS(%d) not supported",
+                __FUNCTION__, arch.GetMachine(), arch.GetTriple().getOS());
       assert(false && "Architecture or OS not supported");
     }
 

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp Wed Jul 24 10:56:10 2019
@@ -63,18 +63,16 @@ StateType GDBRemoteClientBase::SendConti
     case PacketResult::Success:
       break;
     default:
-      if (log)
-        log->Printf("GDBRemoteClientBase::%s () ReadPacket(...) => false",
-                    __FUNCTION__);
+      LLDB_LOGF(log, "GDBRemoteClientBase::%s () ReadPacket(...) => false",
+                __FUNCTION__);
       return eStateInvalid;
     }
     if (response.Empty())
       return eStateInvalid;
 
     const char stop_type = response.GetChar();
-    if (log)
-      log->Printf("GDBRemoteClientBase::%s () got packet: %s", __FUNCTION__,
-                  response.GetStringRef().c_str());
+    LLDB_LOGF(log, "GDBRemoteClientBase::%s () got packet: %s", __FUNCTION__,
+              response.GetStringRef().c_str());
 
     switch (stop_type) {
     case 'W':
@@ -84,9 +82,8 @@ StateType GDBRemoteClientBase::SendConti
       // ERROR
       return eStateInvalid;
     default:
-      if (log)
-        log->Printf("GDBRemoteClientBase::%s () unrecognized async packet",
-                    __FUNCTION__);
+      LLDB_LOGF(log, "GDBRemoteClientBase::%s () unrecognized async packet",
+                __FUNCTION__);
       return eStateInvalid;
     case 'O': {
       std::string inferior_stdout;
@@ -162,10 +159,10 @@ GDBRemoteClientBase::SendPacketAndWaitFo
   if (!lock) {
     if (Log *log =
             ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS))
-      log->Printf("GDBRemoteClientBase::%s failed to get mutex, not sending "
-                  "packet '%.*s' (send_async=%d)",
-                  __FUNCTION__, int(payload.size()), payload.data(),
-                  send_async);
+      LLDB_LOGF(log,
+                "GDBRemoteClientBase::%s failed to get mutex, not sending "
+                "packet '%.*s' (send_async=%d)",
+                __FUNCTION__, int(payload.size()), payload.data(), send_async);
     return PacketResult::ErrorSendFailed;
   }
 
@@ -181,10 +178,10 @@ GDBRemoteClientBase::SendPacketAndReceiv
   if (!lock) {
     if (Log *log =
             ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS))
-      log->Printf("GDBRemoteClientBase::%s failed to get mutex, not sending "
-                  "packet '%.*s' (send_async=%d)",
-                  __FUNCTION__, int(payload.size()), payload.data(),
-                  send_async);
+      LLDB_LOGF(log,
+                "GDBRemoteClientBase::%s failed to get mutex, not sending "
+                "packet '%.*s' (send_async=%d)",
+                __FUNCTION__, int(payload.size()), payload.data(), send_async);
     return PacketResult::ErrorSendFailed;
   }
 
@@ -214,13 +211,13 @@ GDBRemoteClientBase::SendPacketAndWaitFo
       return packet_result;
     // Response says it wasn't valid
     Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PACKETS);
-    if (log)
-      log->Printf(
-          "error: packet with payload \"%.*s\" got invalid response \"%s\": %s",
-          int(payload.size()), payload.data(), response.GetStringRef().c_str(),
-          (i == (max_response_retries - 1))
-              ? "using invalid response and giving up"
-              : "ignoring response and waiting for another");
+    LLDB_LOGF(
+        log,
+        "error: packet with payload \"%.*s\" got invalid response \"%s\": %s",
+        int(payload.size()), payload.data(), response.GetStringRef().c_str(),
+        (i == (max_response_retries - 1))
+            ? "using invalid response and giving up"
+            : "ignoring response and waiting for another");
   }
   return packet_result;
 }
@@ -228,16 +225,14 @@ GDBRemoteClientBase::SendPacketAndWaitFo
 bool GDBRemoteClientBase::SendvContPacket(llvm::StringRef payload,
                                           StringExtractorGDBRemote &response) {
   Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
-  if (log)
-    log->Printf("GDBRemoteCommunicationClient::%s ()", __FUNCTION__);
+  LLDB_LOGF(log, "GDBRemoteCommunicationClient::%s ()", __FUNCTION__);
 
   // we want to lock down packet sending while we continue
   Lock lock(*this, true);
 
-  if (log)
-    log->Printf(
-        "GDBRemoteCommunicationClient::%s () sending vCont packet: %.*s",
-        __FUNCTION__, int(payload.size()), payload.data());
+  LLDB_LOGF(log,
+            "GDBRemoteCommunicationClient::%s () sending vCont packet: %.*s",
+            __FUNCTION__, int(payload.size()), payload.data());
 
   if (SendPacketNoLock(payload) != PacketResult::Success)
     return false;
@@ -315,18 +310,16 @@ void GDBRemoteClientBase::ContinueLock::
 GDBRemoteClientBase::ContinueLock::LockResult
 GDBRemoteClientBase::ContinueLock::lock() {
   Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS);
-  if (log)
-    log->Printf("GDBRemoteClientBase::ContinueLock::%s() resuming with %s",
-                __FUNCTION__, m_comm.m_continue_packet.c_str());
+  LLDB_LOGF(log, "GDBRemoteClientBase::ContinueLock::%s() resuming with %s",
+            __FUNCTION__, m_comm.m_continue_packet.c_str());
 
   lldbassert(!m_acquired);
   std::unique_lock<std::mutex> lock(m_comm.m_mutex);
   m_comm.m_cv.wait(lock, [this] { return m_comm.m_async_count == 0; });
   if (m_comm.m_should_stop) {
     m_comm.m_should_stop = false;
-    if (log)
-      log->Printf("GDBRemoteClientBase::ContinueLock::%s() cancelled",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "GDBRemoteClientBase::ContinueLock::%s() cancelled",
+              __FUNCTION__);
     return LockResult::Cancelled;
   }
   if (m_comm.SendPacketNoLock(m_comm.m_continue_packet) !=
@@ -368,9 +361,8 @@ void GDBRemoteClientBase::Lock::SyncWith
       size_t bytes_written = m_comm.Write(&ctrl_c, 1, status, nullptr);
       if (bytes_written == 0) {
         --m_comm.m_async_count;
-        if (log)
-          log->Printf("GDBRemoteClientBase::Lock::Lock failed to send "
-                      "interrupt packet");
+        LLDB_LOGF(log, "GDBRemoteClientBase::Lock::Lock failed to send "
+                       "interrupt packet");
         return;
       }
       if (log)

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=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Wed Jul 24 10:56:10 2019
@@ -99,8 +99,7 @@ size_t GDBRemoteCommunication::SendAck()
   ConnectionStatus status = eConnectionStatusSuccess;
   char ch = '+';
   const size_t bytes_written = Write(&ch, 1, status, nullptr);
-  if (log)
-    log->Printf("<%4" PRIu64 "> send packet: %c", (uint64_t)bytes_written, ch);
+  LLDB_LOGF(log, "<%4" PRIu64 "> send packet: %c", (uint64_t)bytes_written, ch);
   m_history.AddPacket(ch, GDBRemoteCommunicationHistory::ePacketTypeSend,
                       bytes_written);
   return bytes_written;
@@ -111,8 +110,7 @@ size_t GDBRemoteCommunication::SendNack(
   ConnectionStatus status = eConnectionStatusSuccess;
   char ch = '-';
   const size_t bytes_written = Write(&ch, 1, status, nullptr);
-  if (log)
-    log->Printf("<%4" PRIu64 "> send packet: %c", (uint64_t)bytes_written, ch);
+  LLDB_LOGF(log, "<%4" PRIu64 "> send packet: %c", (uint64_t)bytes_written, ch);
   m_history.AddPacket(ch, GDBRemoteCommunicationHistory::ePacketTypeSend,
                       bytes_written);
   return bytes_written;
@@ -172,8 +170,8 @@ GDBRemoteCommunication::SendRawPacketNoL
         strm.Printf("%*s", (int)3, p);
         log->PutString(strm.GetString());
       } else
-        log->Printf("<%4" PRIu64 "> send packet: %.*s", (uint64_t)bytes_written,
-                    (int)packet_length, packet_data);
+        LLDB_LOGF(log, "<%4" PRIu64 "> send packet: %.*s",
+                  (uint64_t)bytes_written, (int)packet_length, packet_data);
     }
 
     m_history.AddPacket(packet.str(), packet_length,
@@ -186,9 +184,8 @@ GDBRemoteCommunication::SendRawPacketNoL
       else
         return PacketResult::Success;
     } else {
-      if (log)
-        log->Printf("error: failed to send packet: %.*s", (int)packet_length,
-                    packet_data);
+      LLDB_LOGF(log, "error: failed to send packet: %.*s", (int)packet_length,
+                packet_data);
     }
   }
   return PacketResult::ErrorSendFailed;
@@ -489,11 +486,10 @@ bool GDBRemoteCommunication::DecompressP
         llvm::StringRef(m_bytes).substr(1, hash_mark_idx - 1));
     bool success = packet_checksum == actual_checksum;
     if (!success) {
-      if (log)
-        log->Printf(
-            "error: checksum mismatch: %.*s expected 0x%2.2x, got 0x%2.2x",
-            (int)(pkt_size), m_bytes.c_str(), (uint8_t)packet_checksum,
-            (uint8_t)actual_checksum);
+      LLDB_LOGF(log,
+                "error: checksum mismatch: %.*s expected 0x%2.2x, got 0x%2.2x",
+                (int)(pkt_size), m_bytes.c_str(), (uint8_t)packet_checksum,
+                (uint8_t)actual_checksum);
     }
     // Send the ack or nack if needed
     if (!success) {
@@ -651,8 +647,8 @@ GDBRemoteCommunication::CheckForPacket(c
   if (src && src_len > 0) {
     if (log && log->GetVerbose()) {
       StreamString s;
-      log->Printf("GDBRemoteCommunication::%s adding %u bytes: %.*s",
-                  __FUNCTION__, (uint32_t)src_len, (uint32_t)src_len, src);
+      LLDB_LOGF(log, "GDBRemoteCommunication::%s adding %u bytes: %.*s",
+                __FUNCTION__, (uint32_t)src_len, (uint32_t)src_len, src);
     }
     m_bytes.append((const char *)src, src_len);
   }
@@ -733,9 +729,8 @@ GDBRemoteCommunication::CheckForPacket(c
           break;
         }
       }
-      if (log)
-        log->Printf("GDBRemoteCommunication::%s tossing %u junk bytes: '%.*s'",
-                    __FUNCTION__, idx - 1, idx - 1, m_bytes.c_str());
+      LLDB_LOGF(log, "GDBRemoteCommunication::%s tossing %u junk bytes: '%.*s'",
+                __FUNCTION__, idx - 1, idx - 1, m_bytes.c_str());
       m_bytes.erase(0, idx - 1);
     } break;
     }
@@ -800,13 +795,13 @@ GDBRemoteCommunication::CheckForPacket(c
           log->PutString(strm.GetString());
         } else {
           if (CompressionIsEnabled())
-            log->Printf("<%4" PRIu64 ":%" PRIu64 "> read packet: %.*s",
-                        (uint64_t)original_packet_size, (uint64_t)total_length,
-                        (int)(total_length), m_bytes.c_str());
+            LLDB_LOGF(log, "<%4" PRIu64 ":%" PRIu64 "> read packet: %.*s",
+                      (uint64_t)original_packet_size, (uint64_t)total_length,
+                      (int)(total_length), m_bytes.c_str());
           else
-            log->Printf("<%4" PRIu64 "> read packet: %.*s",
-                        (uint64_t)total_length, (int)(total_length),
-                        m_bytes.c_str());
+            LLDB_LOGF(log, "<%4" PRIu64 "> read packet: %.*s",
+                      (uint64_t)total_length, (int)(total_length),
+                      m_bytes.c_str());
         }
       }
 
@@ -853,11 +848,11 @@ GDBRemoteCommunication::CheckForPacket(c
                 llvm::StringRef(m_bytes).slice(content_start, content_end));
             success = packet_checksum == actual_checksum;
             if (!success) {
-              if (log)
-                log->Printf("error: checksum mismatch: %.*s expected 0x%2.2x, "
-                            "got 0x%2.2x",
-                            (int)(total_length), m_bytes.c_str(),
-                            (uint8_t)packet_checksum, (uint8_t)actual_checksum);
+              LLDB_LOGF(log,
+                        "error: checksum mismatch: %.*s expected 0x%2.2x, "
+                        "got 0x%2.2x",
+                        (int)(total_length), m_bytes.c_str(),
+                        (uint8_t)packet_checksum, (uint8_t)actual_checksum);
             }
             // Send the ack or nack if needed
             if (!success)
@@ -867,9 +862,8 @@ GDBRemoteCommunication::CheckForPacket(c
           }
         } else {
           success = false;
-          if (log)
-            log->Printf("error: invalid checksum in packet: '%s'\n",
-                        m_bytes.c_str());
+          LLDB_LOGF(log, "error: invalid checksum in packet: '%s'\n",
+                    m_bytes.c_str());
         }
       }
 
@@ -933,10 +927,8 @@ Status GDBRemoteCommunication::StartDebu
     const char *url, Platform *platform, ProcessLaunchInfo &launch_info,
     uint16_t *port, const Args *inferior_args, int pass_comm_fd) {
   Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
-  if (log)
-    log->Printf("GDBRemoteCommunication::%s(url=%s, port=%" PRIu16 ")",
-                __FUNCTION__, url ? url : "<empty>",
-                port ? *port : uint16_t(0));
+  LLDB_LOGF(log, "GDBRemoteCommunication::%s(url=%s, port=%" PRIu16 ")",
+            __FUNCTION__, url ? url : "<empty>", port ? *port : uint16_t(0));
 
   Status error;
   // If we locate debugserver, keep that located version around
@@ -953,10 +945,10 @@ Status GDBRemoteCommunication::StartDebu
   if (!env_debugserver_path.empty()) {
     debugserver_file_spec.SetFile(env_debugserver_path,
                                   FileSpec::Style::native);
-    if (log)
-      log->Printf("GDBRemoteCommunication::%s() gdb-remote stub exe path set "
-                  "from environment variable: %s",
-                  __FUNCTION__, env_debugserver_path.c_str());
+    LLDB_LOGF(log,
+              "GDBRemoteCommunication::%s() gdb-remote stub exe path set "
+              "from environment variable: %s",
+              __FUNCTION__, env_debugserver_path.c_str());
   } else
     debugserver_file_spec = g_debugserver_file_spec;
   bool debugserver_exists =
@@ -968,10 +960,9 @@ Status GDBRemoteCommunication::StartDebu
       debugserver_file_spec.AppendPathComponent(DEBUGSERVER_BASENAME);
       debugserver_exists = FileSystem::Instance().Exists(debugserver_file_spec);
       if (debugserver_exists) {
-        if (log)
-          log->Printf(
-              "GDBRemoteCommunication::%s() found gdb-remote stub exe '%s'",
-              __FUNCTION__, debugserver_file_spec.GetPath().c_str());
+        LLDB_LOGF(log,
+                  "GDBRemoteCommunication::%s() found gdb-remote stub exe '%s'",
+                  __FUNCTION__, debugserver_file_spec.GetPath().c_str());
 
         g_debugserver_file_spec = debugserver_file_spec;
       } else {
@@ -985,10 +976,10 @@ Status GDBRemoteCommunication::StartDebu
           // exist
           debugserver_exists = true;
         } else {
-          if (log)
-            log->Printf("GDBRemoteCommunication::%s() could not find "
-                        "gdb-remote stub exe '%s'",
-                        __FUNCTION__, debugserver_file_spec.GetPath().c_str());
+          LLDB_LOGF(log,
+                    "GDBRemoteCommunication::%s() could not find "
+                    "gdb-remote stub exe '%s'",
+                    __FUNCTION__, debugserver_file_spec.GetPath().c_str());
         }
         // Don't cache the platform specific GDB server binary as it could
         // change from platform to platform
@@ -1052,10 +1043,10 @@ Status GDBRemoteCommunication::StartDebu
         error = socket_pipe.CreateWithUniqueName("debugserver-named-pipe",
                                                  false, named_pipe_path);
         if (error.Fail()) {
-          if (log)
-            log->Printf("GDBRemoteCommunication::%s() "
-                        "named pipe creation failed: %s",
-                        __FUNCTION__, error.AsCString());
+          LLDB_LOGF(log,
+                    "GDBRemoteCommunication::%s() "
+                    "named pipe creation failed: %s",
+                    __FUNCTION__, error.AsCString());
           return error;
         }
         debugserver_args.AppendArgument(llvm::StringRef("--named-pipe"));
@@ -1065,10 +1056,10 @@ Status GDBRemoteCommunication::StartDebu
         // using using an unnamed pipe...
         error = socket_pipe.CreateNew(true);
         if (error.Fail()) {
-          if (log)
-            log->Printf("GDBRemoteCommunication::%s() "
-                        "unnamed pipe creation failed: %s",
-                        __FUNCTION__, error.AsCString());
+          LLDB_LOGF(log,
+                    "GDBRemoteCommunication::%s() "
+                    "unnamed pipe creation failed: %s",
+                    __FUNCTION__, error.AsCString());
           return error;
         }
         pipe_t write = socket_pipe.GetWritePipe();
@@ -1081,10 +1072,10 @@ Status GDBRemoteCommunication::StartDebu
         // debugserver connect to us..
         error = StartListenThread("127.0.0.1", 0);
         if (error.Fail()) {
-          if (log)
-            log->Printf("GDBRemoteCommunication::%s() unable to start listen "
-                        "thread: %s",
-                        __FUNCTION__, error.AsCString());
+          LLDB_LOGF(log,
+                    "GDBRemoteCommunication::%s() unable to start listen "
+                    "thread: %s",
+                    __FUNCTION__, error.AsCString());
           return error;
         }
 
@@ -1104,9 +1095,8 @@ Status GDBRemoteCommunication::StartDebu
             *port = port_;
         } else {
           error.SetErrorString("failed to bind to port 0 on 127.0.0.1");
-          if (log)
-            log->Printf("GDBRemoteCommunication::%s() failed: %s", __FUNCTION__,
-                        error.AsCString());
+          LLDB_LOGF(log, "GDBRemoteCommunication::%s() failed: %s",
+                    __FUNCTION__, error.AsCString());
           return error;
         }
       }
@@ -1148,10 +1138,10 @@ Status GDBRemoteCommunication::StartDebu
 
       if (has_env_var) {
         debugserver_args.AppendArgument(llvm::StringRef(extra_arg));
-        if (log)
-          log->Printf("GDBRemoteCommunication::%s adding env var %s contents "
-                      "to stub command line (%s)",
-                      __FUNCTION__, env_var_name, extra_arg.c_str());
+        LLDB_LOGF(log,
+                  "GDBRemoteCommunication::%s adding env var %s contents "
+                  "to stub command line (%s)",
+                  __FUNCTION__, env_var_name, extra_arg.c_str());
       }
     } while (has_env_var);
 
@@ -1177,8 +1167,8 @@ Status GDBRemoteCommunication::StartDebu
       StreamString string_stream;
       Platform *const platform = nullptr;
       launch_info.Dump(string_stream, platform);
-      log->Printf("launch info for gdb-remote stub:\n%s",
-                  string_stream.GetData());
+      LLDB_LOGF(log, "launch info for gdb-remote stub:\n%s",
+                string_stream.GetData());
     }
     error = Host::LaunchProcess(launch_info);
 
@@ -1188,11 +1178,10 @@ Status GDBRemoteCommunication::StartDebu
       if (named_pipe_path.size() > 0) {
         error = socket_pipe.OpenAsReader(named_pipe_path, false);
         if (error.Fail())
-          if (log)
-            log->Printf("GDBRemoteCommunication::%s() "
-                        "failed to open named pipe %s for reading: %s",
-                        __FUNCTION__, named_pipe_path.c_str(),
-                        error.AsCString());
+          LLDB_LOGF(log,
+                    "GDBRemoteCommunication::%s() "
+                    "failed to open named pipe %s for reading: %s",
+                    __FUNCTION__, named_pipe_path.c_str(), error.AsCString());
       }
 
       if (socket_pipe.CanWrite())
@@ -1209,24 +1198,22 @@ Status GDBRemoteCommunication::StartDebu
           uint16_t child_port = StringConvert::ToUInt32(port_cstr, 0);
           if (*port == 0 || *port == child_port) {
             *port = child_port;
-            if (log)
-              log->Printf("GDBRemoteCommunication::%s() "
-                          "debugserver listens %u port",
-                          __FUNCTION__, *port);
+            LLDB_LOGF(log,
+                      "GDBRemoteCommunication::%s() "
+                      "debugserver listens %u port",
+                      __FUNCTION__, *port);
           } else {
-            if (log)
-              log->Printf("GDBRemoteCommunication::%s() "
-                          "debugserver listening on port "
-                          "%d but requested port was %d",
-                          __FUNCTION__, (uint32_t)child_port,
-                          (uint32_t)(*port));
+            LLDB_LOGF(log,
+                      "GDBRemoteCommunication::%s() "
+                      "debugserver listening on port "
+                      "%d but requested port was %d",
+                      __FUNCTION__, (uint32_t)child_port, (uint32_t)(*port));
           }
         } else {
-          if (log)
-            log->Printf("GDBRemoteCommunication::%s() "
-                        "failed to read a port value from pipe %s: %s",
-                        __FUNCTION__, named_pipe_path.c_str(),
-                        error.AsCString());
+          LLDB_LOGF(log,
+                    "GDBRemoteCommunication::%s() "
+                    "failed to read a port value from pipe %s: %s",
+                    __FUNCTION__, named_pipe_path.c_str(), error.AsCString());
         }
         socket_pipe.Close();
       }
@@ -1234,10 +1221,9 @@ Status GDBRemoteCommunication::StartDebu
       if (named_pipe_path.size() > 0) {
         const auto err = socket_pipe.Delete(named_pipe_path);
         if (err.Fail()) {
-          if (log)
-            log->Printf(
-                "GDBRemoteCommunication::%s failed to delete pipe %s: %s",
-                __FUNCTION__, named_pipe_path.c_str(), err.AsCString());
+          LLDB_LOGF(log,
+                    "GDBRemoteCommunication::%s failed to delete pipe %s: %s",
+                    __FUNCTION__, named_pipe_path.c_str(), err.AsCString());
         }
       }
 
@@ -1249,9 +1235,8 @@ Status GDBRemoteCommunication::StartDebu
   }
 
   if (error.Fail()) {
-    if (log)
-      log->Printf("GDBRemoteCommunication::%s() failed: %s", __FUNCTION__,
-                  error.AsCString());
+    LLDB_LOGF(log, "GDBRemoteCommunication::%s() failed: %s", __FUNCTION__,
+              error.AsCString());
   }
 
   return error;

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Wed Jul 24 10:56:10 2019
@@ -439,8 +439,7 @@ void GDBRemoteCommunicationClient::GetRe
         m_max_packet_size = UINT64_MAX; // Must have been a garbled response
         Log *log(
             ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
-        if (log)
-          log->Printf("Garbled PacketSize spec in qSupported response");
+        LLDB_LOGF(log, "Garbled PacketSize spec in qSupported response");
       }
     }
   }
@@ -525,9 +524,10 @@ GDBRemoteCommunicationClient::SendThread
   if (!lock) {
     if (Log *log = ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(
             GDBR_LOG_PROCESS | GDBR_LOG_PACKETS))
-      log->Printf("GDBRemoteCommunicationClient::%s: Didn't get sequence mutex "
-                  "for %s packet.",
-                  __FUNCTION__, payload.GetData());
+      LLDB_LOGF(log,
+                "GDBRemoteCommunicationClient::%s: Didn't get sequence mutex "
+                "for %s packet.",
+                __FUNCTION__, payload.GetData());
     return PacketResult::ErrorNoSequenceLock;
   }
 
@@ -660,10 +660,10 @@ GDBRemoteCommunicationClient::SendPacket
   if (!lock) {
     Log *log(ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_PROCESS |
                                                            GDBR_LOG_PACKETS));
-    if (log)
-      log->Printf("error: failed to get packet sequence mutex, not sending "
-                  "packets with prefix '%s'",
-                  payload_prefix);
+    LLDB_LOGF(log,
+              "error: failed to get packet sequence mutex, not sending "
+              "packets with prefix '%s'",
+              payload_prefix);
     return PacketResult::ErrorNoSequenceLock;
   }
 
@@ -1284,14 +1284,15 @@ bool GDBRemoteCommunicationClient::GetHo
             assert(byte_order == m_host_arch.GetByteOrder());
           }
 
-          if (log)
-            log->Printf("GDBRemoteCommunicationClient::%s parsed host "
-                        "architecture as %s, triple as %s from triple text %s",
-                        __FUNCTION__, m_host_arch.GetArchitectureName()
-                                          ? m_host_arch.GetArchitectureName()
-                                          : "<null-arch-name>",
-                        m_host_arch.GetTriple().getTriple().c_str(),
-                        triple.c_str());
+          LLDB_LOGF(log,
+                    "GDBRemoteCommunicationClient::%s parsed host "
+                    "architecture as %s, triple as %s from triple text %s",
+                    __FUNCTION__,
+                    m_host_arch.GetArchitectureName()
+                        ? m_host_arch.GetArchitectureName()
+                        : "<null-arch-name>",
+                    m_host_arch.GetTriple().getTriple().c_str(),
+                    triple.c_str());
         }
         if (!distribution_id.empty())
           m_host_arch.SetDistributionId(distribution_id.c_str());
@@ -2064,12 +2065,10 @@ bool GDBRemoteCommunicationClient::GetCu
           break;
         case llvm::Triple::Wasm:
         case llvm::Triple::XCOFF:
-          if (log)
-            log->Printf("error: not supported target architecture");
+          LLDB_LOGF(log, "error: not supported target architecture");
           return false;
         case llvm::Triple::UnknownObjectFormat:
-          if (log)
-            log->Printf("error: failed to determine target architecture");
+          LLDB_LOGF(log, "error: failed to determine target architecture");
           return false;
         }
 
@@ -2641,9 +2640,8 @@ bool GDBRemoteCommunicationClient::GetTh
 uint8_t GDBRemoteCommunicationClient::SendGDBStoppointTypePacket(
     GDBStoppointType type, bool insert, addr_t addr, uint32_t length) {
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
-  if (log)
-    log->Printf("GDBRemoteCommunicationClient::%s() %s at addr = 0x%" PRIx64,
-                __FUNCTION__, insert ? "add" : "remove", addr);
+  LLDB_LOGF(log, "GDBRemoteCommunicationClient::%s() %s at addr = 0x%" PRIx64,
+            __FUNCTION__, insert ? "add" : "remove", addr);
 
   // Check if the stub is known not to support this breakpoint type
   if (!SupportsGDBStoppointPacket(type))
@@ -2745,9 +2743,8 @@ size_t GDBRemoteCommunicationClient::Get
 #if !defined(LLDB_CONFIGURATION_DEBUG)
     Log *log(ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_PROCESS |
                                                            GDBR_LOG_PACKETS));
-    if (log)
-      log->Printf("error: failed to get packet sequence mutex, not sending "
-                  "packet 'qfThreadInfo'");
+    LLDB_LOGF(log, "error: failed to get packet sequence mutex, not sending "
+                   "packet 'qfThreadInfo'");
 #endif
     sequence_mutex_unavailable = true;
   }
@@ -3873,9 +3870,9 @@ void GDBRemoteCommunicationClient::Serve
 
     } else if (Log *log = ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(
                    GDBR_LOG_PROCESS | GDBR_LOG_PACKETS)) {
-      log->Printf(
-          "GDBRemoteCommunicationClient::%s: Didn't get sequence mutex.",
-          __FUNCTION__);
+      LLDB_LOGF(log,
+                "GDBRemoteCommunicationClient::%s: Didn't get sequence mutex.",
+                __FUNCTION__);
     }
   }
 }
@@ -3899,26 +3896,27 @@ GDBRemoteCommunicationClient::GetSupport
           !m_supported_async_json_packets_sp->GetAsArray()) {
         // We were returned something other than a JSON array.  This is
         // invalid.  Clear it out.
-        if (log)
-          log->Printf("GDBRemoteCommunicationClient::%s(): "
-                      "QSupportedAsyncJSONPackets returned invalid "
-                      "result: %s",
-                      __FUNCTION__, response.GetStringRef().c_str());
+        LLDB_LOGF(log,
+                  "GDBRemoteCommunicationClient::%s(): "
+                  "QSupportedAsyncJSONPackets returned invalid "
+                  "result: %s",
+                  __FUNCTION__, response.GetStringRef().c_str());
         m_supported_async_json_packets_sp.reset();
       }
     } else {
-      if (log)
-        log->Printf("GDBRemoteCommunicationClient::%s(): "
-                    "QSupportedAsyncJSONPackets unsupported",
-                    __FUNCTION__);
+      LLDB_LOGF(log,
+                "GDBRemoteCommunicationClient::%s(): "
+                "QSupportedAsyncJSONPackets unsupported",
+                __FUNCTION__);
     }
 
     if (log && m_supported_async_json_packets_sp) {
       StreamString stream;
       m_supported_async_json_packets_sp->Dump(stream);
-      log->Printf("GDBRemoteCommunicationClient::%s(): supported async "
-                  "JSON packets: %s",
-                  __FUNCTION__, stream.GetData());
+      LLDB_LOGF(log,
+                "GDBRemoteCommunicationClient::%s(): supported async "
+                "JSON packets: %s",
+                __FUNCTION__, stream.GetData());
     }
   }
 

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp Wed Jul 24 10:56:10 2019
@@ -95,10 +95,10 @@ void GDBRemoteCommunicationHistory::Dump
     const Entry &entry = m_packets[idx];
     if (entry.type == ePacketTypeInvalid || entry.packet.data.empty())
       break;
-    log->Printf("history[%u] tid=0x%4.4" PRIx64 " <%4u> %s packet: %s",
-                entry.packet_idx, entry.tid, entry.bytes_transmitted,
-                (entry.type == ePacketTypeSend) ? "send" : "read",
-                entry.packet.data.c_str());
+    LLDB_LOGF(log, "history[%u] tid=0x%4.4" PRIx64 " <%4u> %s packet: %s",
+              entry.packet_idx, entry.tid, entry.bytes_transmitted,
+              (entry.type == ePacketTypeSend) ? "send" : "read",
+              entry.packet.data.c_str());
   }
 }
 

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp Wed Jul 24 10:56:10 2019
@@ -139,10 +139,9 @@ GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::SendIllFormedResponse(
     const StringExtractorGDBRemote &failed_packet, const char *message) {
   Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PACKETS));
-  if (log)
-    log->Printf("GDBRemoteCommunicationServer::%s: ILLFORMED: '%s' (%s)",
-                __FUNCTION__, failed_packet.GetStringRef().c_str(),
-                message ? message : "");
+  LLDB_LOGF(log, "GDBRemoteCommunicationServer::%s: ILLFORMED: '%s' (%s)",
+            __FUNCTION__, failed_packet.GetStringRef().c_str(),
+            message ? message : "");
   return SendErrorResponse(0x03);
 }
 

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp Wed Jul 24 10:56:10 2019
@@ -421,8 +421,7 @@ GDBRemoteCommunicationServerCommon::Hand
     StringExtractorGDBRemote &packet) {
 #if !defined(LLDB_DISABLE_POSIX)
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("GDBRemoteCommunicationServerCommon::%s begin", __FUNCTION__);
+  LLDB_LOGF(log, "GDBRemoteCommunicationServerCommon::%s begin", __FUNCTION__);
 
   // Packet format: "qUserName:%i" where %i is the uid
   packet.SetFilePos(::strlen("qUserName:"));
@@ -435,8 +434,7 @@ GDBRemoteCommunicationServerCommon::Hand
       return SendPacketNoLock(response.GetString());
     }
   }
-  if (log)
-    log->Printf("GDBRemoteCommunicationServerCommon::%s end", __FUNCTION__);
+  LLDB_LOGF(log, "GDBRemoteCommunicationServerCommon::%s end", __FUNCTION__);
 #endif
   return SendErrorResponse(5);
 }
@@ -1017,9 +1015,8 @@ GDBRemoteCommunicationServerCommon::Hand
                   m_process_launch_info.GetExecutableFile().SetFile(
                       arg, FileSpec::Style::native);
                 m_process_launch_info.GetArguments().AppendArgument(arg);
-                if (log)
-                  log->Printf("LLGSPacketHandler::%s added arg %d: \"%s\"",
-                              __FUNCTION__, actual_arg_index, arg.c_str());
+                LLDB_LOGF(log, "LLGSPacketHandler::%s added arg %d: \"%s\"",
+                          __FUNCTION__, actual_arg_index, arg.c_str());
                 ++actual_arg_index;
               }
             }

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp Wed Jul 24 10:56:10 2019
@@ -249,18 +249,18 @@ Status GDBRemoteCommunicationServerLLGS:
     // Setup stdout/stderr mapping from inferior to $O
     auto terminal_fd = m_debugged_process_up->GetTerminalFileDescriptor();
     if (terminal_fd >= 0) {
-      if (log)
-        log->Printf("ProcessGDBRemoteCommunicationServerLLGS::%s setting "
-                    "inferior STDIO fd to %d",
-                    __FUNCTION__, terminal_fd);
+      LLDB_LOGF(log,
+                "ProcessGDBRemoteCommunicationServerLLGS::%s setting "
+                "inferior STDIO fd to %d",
+                __FUNCTION__, terminal_fd);
       Status status = SetSTDIOFileDescriptor(terminal_fd);
       if (status.Fail())
         return status;
     } else {
-      if (log)
-        log->Printf("ProcessGDBRemoteCommunicationServerLLGS::%s ignoring "
-                    "inferior STDIO since terminal fd reported as %d",
-                    __FUNCTION__, terminal_fd);
+      LLDB_LOGF(log,
+                "ProcessGDBRemoteCommunicationServerLLGS::%s ignoring "
+                "inferior STDIO since terminal fd reported as %d",
+                __FUNCTION__, terminal_fd);
     }
   } else {
     LLDB_LOG(log,
@@ -278,9 +278,8 @@ Status GDBRemoteCommunicationServerLLGS:
 
 Status GDBRemoteCommunicationServerLLGS::AttachToProcess(lldb::pid_t pid) {
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64,
-                __FUNCTION__, pid);
+  LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64,
+            __FUNCTION__, pid);
 
   // Before we try to attach, make sure we aren't already monitoring something
   // else.
@@ -304,18 +303,18 @@ Status GDBRemoteCommunicationServerLLGS:
   // Setup stdout/stderr mapping from inferior.
   auto terminal_fd = m_debugged_process_up->GetTerminalFileDescriptor();
   if (terminal_fd >= 0) {
-    if (log)
-      log->Printf("ProcessGDBRemoteCommunicationServerLLGS::%s setting "
-                  "inferior STDIO fd to %d",
-                  __FUNCTION__, terminal_fd);
+    LLDB_LOGF(log,
+              "ProcessGDBRemoteCommunicationServerLLGS::%s setting "
+              "inferior STDIO fd to %d",
+              __FUNCTION__, terminal_fd);
     Status status = SetSTDIOFileDescriptor(terminal_fd);
     if (status.Fail())
       return status;
   } else {
-    if (log)
-      log->Printf("ProcessGDBRemoteCommunicationServerLLGS::%s ignoring "
-                  "inferior STDIO since terminal fd reported as %d",
-                  __FUNCTION__, terminal_fd);
+    LLDB_LOGF(log,
+              "ProcessGDBRemoteCommunicationServerLLGS::%s ignoring "
+              "inferior STDIO since terminal fd reported as %d",
+              __FUNCTION__, terminal_fd);
   }
 
   printf("Attached to process %" PRIu64 "...\n", pid);
@@ -327,10 +326,11 @@ void GDBRemoteCommunicationServerLLGS::I
   assert(process && "process cannot be NULL");
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
   if (log) {
-    log->Printf("GDBRemoteCommunicationServerLLGS::%s called with "
-                "NativeProcessProtocol pid %" PRIu64 ", current state: %s",
-                __FUNCTION__, process->GetID(),
-                StateAsCString(process->GetState()));
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s called with "
+              "NativeProcessProtocol pid %" PRIu64 ", current state: %s",
+              __FUNCTION__, process->GetID(),
+              StateAsCString(process->GetState()));
   }
 }
 
@@ -431,10 +431,9 @@ static JSONObject::SP GetRegistersAsJSON
     const RegisterInfo *const reg_info_p =
         reg_ctx.GetRegisterInfoAtIndex(reg_num);
     if (reg_info_p == nullptr) {
-      if (log)
-        log->Printf(
-            "%s failed to get register info for register index %" PRIu32,
-            __FUNCTION__, reg_num);
+      LLDB_LOGF(log,
+                "%s failed to get register info for register index %" PRIu32,
+                __FUNCTION__, reg_num);
       continue;
     }
 
@@ -445,11 +444,10 @@ static JSONObject::SP GetRegistersAsJSON
     RegisterValue reg_value;
     Status error = reg_ctx.ReadRegister(reg_info_p, reg_value);
     if (error.Fail()) {
-      if (log)
-        log->Printf("%s failed to read register '%s' index %" PRIu32 ": %s",
-                    __FUNCTION__,
-                    reg_info_p->name ? reg_info_p->name : "<unnamed-register>",
-                    reg_num, error.AsCString());
+      LLDB_LOGF(log, "%s failed to read register '%s' index %" PRIu32 ": %s",
+                __FUNCTION__,
+                reg_info_p->name ? reg_info_p->name : "<unnamed-register>",
+                reg_num, error.AsCString());
       continue;
     }
 
@@ -511,11 +509,12 @@ static JSONArray::SP GetJSONThreadsInfo(
 
     const int signum = tid_stop_info.details.signal.signo;
     if (log) {
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
-                  " tid %" PRIu64
-                  " got signal signo = %d, reason = %d, exc_type = %" PRIu64,
-                  __FUNCTION__, process.GetID(), tid, signum,
-                  tid_stop_info.reason, tid_stop_info.details.exception.type);
+      LLDB_LOGF(log,
+                "GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
+                " tid %" PRIu64
+                " got signal signo = %d, reason = %d, exc_type = %" PRIu64,
+                __FUNCTION__, process.GetID(), tid, signum,
+                tid_stop_info.reason, tid_stop_info.details.exception.type);
     }
 
     JSONObject::SP thread_obj_sp = std::make_shared<JSONObject>();
@@ -684,12 +683,10 @@ GDBRemoteCommunicationServerLLGS::SendSt
       RegisterValue reg_value;
       Status error = reg_ctx.ReadRegister(reg_info_p, reg_value);
       if (error.Fail()) {
-        if (log)
-          log->Printf("%s failed to read register '%s' index %" PRIu32 ": %s",
-                      __FUNCTION__,
-                      reg_info_p->name ? reg_info_p->name
-                                       : "<unnamed-register>",
-                      reg_to_read, error.AsCString());
+        LLDB_LOGF(log, "%s failed to read register '%s' index %" PRIu32 ": %s",
+                  __FUNCTION__,
+                  reg_info_p->name ? reg_info_p->name : "<unnamed-register>",
+                  reg_to_read, error.AsCString());
         continue;
       }
 
@@ -713,25 +710,24 @@ GDBRemoteCommunicationServerLLGS::SendSt
   const RegisterSet *reg_set_p;
   if (reg_ctx.GetRegisterSetCount() > 0 &&
       ((reg_set_p = reg_ctx.GetRegisterSet(0)) != nullptr)) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s expediting registers "
-                  "from set '%s' (registers set count: %zu)",
-                  __FUNCTION__,
-                  reg_set_p->name ? reg_set_p->name : "<unnamed-set>",
-                  reg_set_p->num_registers);
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s expediting registers "
+              "from set '%s' (registers set count: %zu)",
+              __FUNCTION__, reg_set_p->name ? reg_set_p->name : "<unnamed-set>",
+              reg_set_p->num_registers);
 
     for (const uint32_t *reg_num_p = reg_set_p->registers;
          *reg_num_p != LLDB_INVALID_REGNUM; ++reg_num_p) {
       const RegisterInfo *const reg_info_p =
           reg_ctx.GetRegisterInfoAtIndex(*reg_num_p);
       if (reg_info_p == nullptr) {
-        if (log)
-          log->Printf("GDBRemoteCommunicationServerLLGS::%s failed to get "
-                      "register info for register set '%s', register index "
-                      "%" PRIu32,
-                      __FUNCTION__,
-                      reg_set_p->name ? reg_set_p->name : "<unnamed-set>",
-                      *reg_num_p);
+        LLDB_LOGF(log,
+                  "GDBRemoteCommunicationServerLLGS::%s failed to get "
+                  "register info for register set '%s', register index "
+                  "%" PRIu32,
+                  __FUNCTION__,
+                  reg_set_p->name ? reg_set_p->name : "<unnamed-set>",
+                  *reg_num_p);
       } else if (reg_info_p->value_regs == nullptr) {
         // Only expediate registers that are not contained in other registers.
         RegisterValue reg_value;
@@ -742,13 +738,12 @@ GDBRemoteCommunicationServerLLGS::SendSt
                                             &reg_value, lldb::eByteOrderBig);
           response.PutChar(';');
         } else {
-          if (log)
-            log->Printf("GDBRemoteCommunicationServerLLGS::%s failed to read "
-                        "register '%s' index %" PRIu32 ": %s",
-                        __FUNCTION__,
-                        reg_info_p->name ? reg_info_p->name
-                                         : "<unnamed-register>",
-                        *reg_num_p, error.AsCString());
+          LLDB_LOGF(log,
+                    "GDBRemoteCommunicationServerLLGS::%s failed to read "
+                    "register '%s' index %" PRIu32 ": %s",
+                    __FUNCTION__,
+                    reg_info_p->name ? reg_info_p->name : "<unnamed-register>",
+                    *reg_num_p, error.AsCString());
         }
       }
     }
@@ -787,15 +782,14 @@ void GDBRemoteCommunicationServerLLGS::H
   assert(process && "process cannot be NULL");
 
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("GDBRemoteCommunicationServerLLGS::%s called", __FUNCTION__);
+  LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s called", __FUNCTION__);
 
   PacketResult result = SendStopReasonForState(StateType::eStateExited);
   if (result != PacketResult::Success) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s failed to send stop "
-                  "notification for PID %" PRIu64 ", state: eStateExited",
-                  __FUNCTION__, process->GetID());
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s failed to send stop "
+              "notification for PID %" PRIu64 ", state: eStateExited",
+              __FUNCTION__, process->GetID());
   }
 
   // Close the pipe to the inferior terminal i/o if we launched it and set one
@@ -812,8 +806,7 @@ void GDBRemoteCommunicationServerLLGS::H
   assert(process && "process cannot be NULL");
 
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("GDBRemoteCommunicationServerLLGS::%s called", __FUNCTION__);
+  LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s called", __FUNCTION__);
 
   // Send the stop reason unless this is the stop after the launch or attach.
   switch (m_inferior_prev_state) {
@@ -825,10 +818,10 @@ void GDBRemoteCommunicationServerLLGS::H
     // In all other cases, send the stop reason.
     PacketResult result = SendStopReasonForState(StateType::eStateStopped);
     if (result != PacketResult::Success) {
-      if (log)
-        log->Printf("GDBRemoteCommunicationServerLLGS::%s failed to send stop "
-                    "notification for PID %" PRIu64 ", state: eStateExited",
-                    __FUNCTION__, process->GetID());
+      LLDB_LOGF(log,
+                "GDBRemoteCommunicationServerLLGS::%s failed to send stop "
+                "notification for PID %" PRIu64 ", state: eStateExited",
+                __FUNCTION__, process->GetID());
     }
     break;
   }
@@ -839,9 +832,10 @@ void GDBRemoteCommunicationServerLLGS::P
   assert(process && "process cannot be NULL");
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
   if (log) {
-    log->Printf("GDBRemoteCommunicationServerLLGS::%s called with "
-                "NativeProcessProtocol pid %" PRIu64 ", state: %s",
-                __FUNCTION__, process->GetID(), StateAsCString(state));
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s called with "
+              "NativeProcessProtocol pid %" PRIu64 ", state: %s",
+              __FUNCTION__, process->GetID(), StateAsCString(state));
   }
 
   switch (state) {
@@ -868,9 +862,10 @@ void GDBRemoteCommunicationServerLLGS::P
 
   default:
     if (log) {
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s didn't handle state "
-                  "change for pid %" PRIu64 ", new state: %s",
-                  __FUNCTION__, process->GetID(), StateAsCString(state));
+      LLDB_LOGF(log,
+                "GDBRemoteCommunicationServerLLGS::%s didn't handle state "
+                "change for pid %" PRIu64 ", new state: %s",
+                __FUNCTION__, process->GetID(), StateAsCString(state));
     }
     break;
   }
@@ -888,10 +883,10 @@ void GDBRemoteCommunicationServerLLGS::D
 
   if (!m_handshake_completed) {
     if (!HandshakeWithClient()) {
-      if (log)
-        log->Printf("GDBRemoteCommunicationServerLLGS::%s handshake with "
-                    "client failed, exiting",
-                    __FUNCTION__);
+      LLDB_LOGF(log,
+                "GDBRemoteCommunicationServerLLGS::%s handshake with "
+                "client failed, exiting",
+                __FUNCTION__);
       m_mainloop.RequestTermination();
       return;
     }
@@ -908,10 +903,10 @@ void GDBRemoteCommunicationServerLLGS::D
       break; // No more packets in the queue
 
     if ((result != PacketResult::Success)) {
-      if (log)
-        log->Printf("GDBRemoteCommunicationServerLLGS::%s processing a packet "
-                    "failed: %s",
-                    __FUNCTION__, error.AsCString());
+      LLDB_LOGF(log,
+                "GDBRemoteCommunicationServerLLGS::%s processing a packet "
+                "failed: %s",
+                __FUNCTION__, error.AsCString());
       m_mainloop.RequestTermination();
       break;
     }
@@ -982,9 +977,10 @@ void GDBRemoteCommunicationServerLLGS::S
     // Not much we can do about the failure. Log it and continue without
     // forwarding.
     if (Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS))
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s Failed to set up stdio "
-                  "forwarding: %s",
-                  __FUNCTION__, error.AsCString());
+      LLDB_LOGF(log,
+                "GDBRemoteCommunicationServerLLGS::%s Failed to set up stdio "
+                "forwarding: %s",
+                __FUNCTION__, error.AsCString());
   }
 }
 
@@ -1008,10 +1004,11 @@ void GDBRemoteCommunicationServerLLGS::S
     case eConnectionStatusError:
     case eConnectionStatusNoConnection:
       if (Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS))
-        log->Printf("GDBRemoteCommunicationServerLLGS::%s Stopping stdio "
-                    "forwarding as communication returned status %d (error: "
-                    "%s)",
-                    __FUNCTION__, status, error.AsCString());
+        LLDB_LOGF(log,
+                  "GDBRemoteCommunicationServerLLGS::%s Stopping stdio "
+                  "forwarding as communication returned status %d (error: "
+                  "%s)",
+                  __FUNCTION__, status, error.AsCString());
       m_stdio_handle_up.reset();
       return;
 
@@ -1349,15 +1346,14 @@ GDBRemoteCommunicationServerLLGS::Handle
 GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServerLLGS::Handle_C(StringExtractorGDBRemote &packet) {
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD));
-  if (log)
-    log->Printf("GDBRemoteCommunicationServerLLGS::%s called", __FUNCTION__);
+  LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s called", __FUNCTION__);
 
   // Ensure we have a native process.
   if (!m_debugged_process_up) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s no debugged process "
-                  "shared pointer",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s no debugged process "
+              "shared pointer",
+              __FUNCTION__);
     return SendErrorResponse(0x36);
   }
 
@@ -1430,8 +1426,7 @@ GDBRemoteCommunicationServerLLGS::Handle
 GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServerLLGS::Handle_c(StringExtractorGDBRemote &packet) {
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD));
-  if (log)
-    log->Printf("GDBRemoteCommunicationServerLLGS::%s called", __FUNCTION__);
+  LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s called", __FUNCTION__);
 
   packet.SetFilePos(packet.GetFilePos() + ::strlen("c"));
 
@@ -1445,10 +1440,10 @@ GDBRemoteCommunicationServerLLGS::Handle
 
   // Ensure we have a native process.
   if (!m_debugged_process_up) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s no debugged process "
-                  "shared pointer",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s no debugged process "
+              "shared pointer",
+              __FUNCTION__);
     return SendErrorResponse(0x36);
   }
 
@@ -1480,17 +1475,16 @@ GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServerLLGS::Handle_vCont(
     StringExtractorGDBRemote &packet) {
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("GDBRemoteCommunicationServerLLGS::%s handling vCont packet",
-                __FUNCTION__);
+  LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s handling vCont packet",
+            __FUNCTION__);
 
   packet.SetFilePos(::strlen("vCont"));
 
   if (packet.GetBytesLeft() == 0) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s missing action from "
-                  "vCont package",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s missing action from "
+              "vCont package",
+              __FUNCTION__);
     return SendIllFormedResponse(packet, "Missing action from vCont package");
   }
 
@@ -1958,10 +1952,10 @@ GDBRemoteCommunicationServerLLGS::Handle
   const uint32_t reg_index =
       packet.GetHexMaxU32(false, std::numeric_limits<uint32_t>::max());
   if (reg_index == std::numeric_limits<uint32_t>::max()) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, could not "
-                  "parse register number from request \"%s\"",
-                  __FUNCTION__, packet.GetStringRef().c_str());
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s failed, could not "
+              "parse register number from request \"%s\"",
+              __FUNCTION__, packet.GetStringRef().c_str());
     return SendErrorResponse(0x15);
   }
 
@@ -1978,20 +1972,19 @@ GDBRemoteCommunicationServerLLGS::Handle
   // Return the end of registers response if we've iterated one past the end of
   // the register set.
   if (reg_index >= reg_context.GetUserRegisterCount()) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, requested "
-                  "register %" PRIu32 " beyond register count %" PRIu32,
-                  __FUNCTION__, reg_index,
-                  reg_context.GetUserRegisterCount());
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s failed, requested "
+              "register %" PRIu32 " beyond register count %" PRIu32,
+              __FUNCTION__, reg_index, reg_context.GetUserRegisterCount());
     return SendErrorResponse(0x15);
   }
 
   const RegisterInfo *reg_info = reg_context.GetRegisterInfoAtIndex(reg_index);
   if (!reg_info) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, requested "
-                  "register %" PRIu32 " returned NULL",
-                  __FUNCTION__, reg_index);
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s failed, requested "
+              "register %" PRIu32 " returned NULL",
+              __FUNCTION__, reg_index);
     return SendErrorResponse(0x15);
   }
 
@@ -2002,20 +1995,20 @@ GDBRemoteCommunicationServerLLGS::Handle
   RegisterValue reg_value;
   Status error = reg_context.ReadRegister(reg_info, reg_value);
   if (error.Fail()) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, read of "
-                  "requested register %" PRIu32 " (%s) failed: %s",
-                  __FUNCTION__, reg_index, reg_info->name, error.AsCString());
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s failed, read of "
+              "requested register %" PRIu32 " (%s) failed: %s",
+              __FUNCTION__, reg_index, reg_info->name, error.AsCString());
     return SendErrorResponse(0x15);
   }
 
   const uint8_t *const data =
       reinterpret_cast<const uint8_t *>(reg_value.GetBytes());
   if (!data) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s failed to get data "
-                  "bytes from requested register %" PRIu32,
-                  __FUNCTION__, reg_index);
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s failed to get data "
+              "bytes from requested register %" PRIu32,
+              __FUNCTION__, reg_index);
     return SendErrorResponse(0x15);
   }
 
@@ -2039,10 +2032,10 @@ GDBRemoteCommunicationServerLLGS::Handle
   const uint32_t reg_index =
       packet.GetHexMaxU32(false, std::numeric_limits<uint32_t>::max());
   if (reg_index == std::numeric_limits<uint32_t>::max()) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, could not "
-                  "parse register number from request \"%s\"",
-                  __FUNCTION__, packet.GetStringRef().c_str());
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s failed, could not "
+              "parse register number from request \"%s\"",
+              __FUNCTION__, packet.GetStringRef().c_str());
     return SendErrorResponse(0x29);
   }
 
@@ -2058,10 +2051,10 @@ GDBRemoteCommunicationServerLLGS::Handle
   // Get the thread to use.
   NativeThreadProtocol *thread = GetThreadFromSuffix(packet);
   if (!thread) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, no thread "
-                  "available (thread index 0)",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s failed, no thread "
+              "available (thread index 0)",
+              __FUNCTION__);
     return SendErrorResponse(0x28);
   }
 
@@ -2069,20 +2062,20 @@ GDBRemoteCommunicationServerLLGS::Handle
   NativeRegisterContext &reg_context = thread->GetRegisterContext();
   const RegisterInfo *reg_info = reg_context.GetRegisterInfoAtIndex(reg_index);
   if (!reg_info) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, requested "
-                  "register %" PRIu32 " returned NULL",
-                  __FUNCTION__, reg_index);
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s failed, requested "
+              "register %" PRIu32 " returned NULL",
+              __FUNCTION__, reg_index);
     return SendErrorResponse(0x48);
   }
 
   // Return the end of registers response if we've iterated one past the end of
   // the register set.
   if (reg_index >= reg_context.GetUserRegisterCount()) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, requested "
-                  "register %" PRIu32 " beyond register count %" PRIu32,
-                  __FUNCTION__, reg_index, reg_context.GetUserRegisterCount());
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s failed, requested "
+              "register %" PRIu32 " beyond register count %" PRIu32,
+              __FUNCTION__, reg_index, reg_context.GetUserRegisterCount());
     return SendErrorResponse(0x47);
   }
 
@@ -2101,10 +2094,10 @@ GDBRemoteCommunicationServerLLGS::Handle
       m_debugged_process_up->GetArchitecture().GetByteOrder());
   Status error = reg_context.WriteRegister(reg_info, reg_value);
   if (error.Fail()) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, write of "
-                  "requested register %" PRIu32 " (%s) failed: %s",
-                  __FUNCTION__, reg_index, reg_info->name, error.AsCString());
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s failed, write of "
+              "requested register %" PRIu32 " (%s) failed: %s",
+              __FUNCTION__, reg_index, reg_info->name, error.AsCString());
     return SendErrorResponse(0x32);
   }
 
@@ -2118,20 +2111,20 @@ GDBRemoteCommunicationServerLLGS::Handle
   // Fail if we don't have a current process.
   if (!m_debugged_process_up ||
       (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
-    if (log)
-      log->Printf(
-          "GDBRemoteCommunicationServerLLGS::%s failed, no process available",
-          __FUNCTION__);
+    LLDB_LOGF(
+        log,
+        "GDBRemoteCommunicationServerLLGS::%s failed, no process available",
+        __FUNCTION__);
     return SendErrorResponse(0x15);
   }
 
   // Parse out which variant of $H is requested.
   packet.SetFilePos(strlen("H"));
   if (packet.GetBytesLeft() < 1) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, H command "
-                  "missing {g,c} variant",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s failed, H command "
+              "missing {g,c} variant",
+              __FUNCTION__);
     return SendIllFormedResponse(packet, "H command missing {g,c} variant");
   }
 
@@ -2144,10 +2137,10 @@ GDBRemoteCommunicationServerLLGS::Handle
     break;
 
   default:
-    if (log)
-      log->Printf(
-          "GDBRemoteCommunicationServerLLGS::%s failed, invalid $H variant %c",
-          __FUNCTION__, h_variant);
+    LLDB_LOGF(
+        log,
+        "GDBRemoteCommunicationServerLLGS::%s failed, invalid $H variant %c",
+        __FUNCTION__, h_variant);
     return SendIllFormedResponse(packet,
                                  "H variant unsupported, should be c or g");
   }
@@ -2162,10 +2155,10 @@ GDBRemoteCommunicationServerLLGS::Handle
   if (tid != LLDB_INVALID_THREAD_ID && tid != 0) {
     NativeThreadProtocol *thread = m_debugged_process_up->GetThreadByID(tid);
     if (!thread) {
-      if (log)
-        log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, tid %" PRIu64
-                    " not found",
-                    __FUNCTION__, tid);
+      LLDB_LOGF(log,
+                "GDBRemoteCommunicationServerLLGS::%s failed, tid %" PRIu64
+                " not found",
+                __FUNCTION__, tid);
       return SendErrorResponse(0x15);
     }
   }
@@ -2196,10 +2189,10 @@ GDBRemoteCommunicationServerLLGS::Handle
   // Fail if we don't have a current process.
   if (!m_debugged_process_up ||
       (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
-    if (log)
-      log->Printf(
-          "GDBRemoteCommunicationServerLLGS::%s failed, no process available",
-          __FUNCTION__);
+    LLDB_LOGF(
+        log,
+        "GDBRemoteCommunicationServerLLGS::%s failed, no process available",
+        __FUNCTION__);
     return SendErrorResponse(0x15);
   }
 
@@ -2257,10 +2250,10 @@ GDBRemoteCommunicationServerLLGS::Handle
 
   if (!m_debugged_process_up ||
       (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
-    if (log)
-      log->Printf(
-          "GDBRemoteCommunicationServerLLGS::%s failed, no process available",
-          __FUNCTION__);
+    LLDB_LOGF(
+        log,
+        "GDBRemoteCommunicationServerLLGS::%s failed, no process available",
+        __FUNCTION__);
     return SendErrorResponse(0x15);
   }
 
@@ -2284,10 +2277,10 @@ GDBRemoteCommunicationServerLLGS::Handle
 
   const uint64_t byte_count = packet.GetHexMaxU64(false, 0);
   if (byte_count == 0) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s nothing to read: "
-                  "zero-length packet",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s nothing to read: "
+              "zero-length packet",
+              __FUNCTION__);
     return SendOKResponse();
   }
 
@@ -2301,20 +2294,20 @@ GDBRemoteCommunicationServerLLGS::Handle
   Status error = m_debugged_process_up->ReadMemoryWithoutTrap(
       read_addr, &buf[0], byte_count, bytes_read);
   if (error.Fail()) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
-                  " mem 0x%" PRIx64 ": failed to read. Error: %s",
-                  __FUNCTION__, m_debugged_process_up->GetID(), read_addr,
-                  error.AsCString());
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
+              " mem 0x%" PRIx64 ": failed to read. Error: %s",
+              __FUNCTION__, m_debugged_process_up->GetID(), read_addr,
+              error.AsCString());
     return SendErrorResponse(0x08);
   }
 
   if (bytes_read == 0) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
-                  " mem 0x%" PRIx64 ": read 0 of %" PRIu64 " requested bytes",
-                  __FUNCTION__, m_debugged_process_up->GetID(), read_addr,
-                  byte_count);
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
+              " mem 0x%" PRIx64 ": read 0 of %" PRIu64 " requested bytes",
+              __FUNCTION__, m_debugged_process_up->GetID(), read_addr,
+              byte_count);
     return SendErrorResponse(0x08);
   }
 
@@ -2338,10 +2331,10 @@ GDBRemoteCommunicationServerLLGS::Handle
 
   if (!m_debugged_process_up ||
       (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
-    if (log)
-      log->Printf(
-          "GDBRemoteCommunicationServerLLGS::%s failed, no process available",
-          __FUNCTION__);
+    LLDB_LOGF(
+        log,
+        "GDBRemoteCommunicationServerLLGS::%s failed, no process available",
+        __FUNCTION__);
     return SendErrorResponse(0x15);
   }
 
@@ -2426,10 +2419,10 @@ GDBRemoteCommunicationServerLLGS::Handle
   // since we won't have a NativeProcessProtocol.
   if (!m_debugged_process_up ||
       (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
-    if (log)
-      log->Printf(
-          "GDBRemoteCommunicationServerLLGS::%s failed, no process available",
-          __FUNCTION__);
+    LLDB_LOGF(
+        log,
+        "GDBRemoteCommunicationServerLLGS::%s failed, no process available",
+        __FUNCTION__);
     return SendErrorResponse(0x15);
   }
 
@@ -2454,10 +2447,10 @@ GDBRemoteCommunicationServerLLGS::Handle
   // Ensure we have a process.
   if (!m_debugged_process_up ||
       (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
-    if (log)
-      log->Printf(
-          "GDBRemoteCommunicationServerLLGS::%s failed, no process available",
-          __FUNCTION__);
+    LLDB_LOGF(
+        log,
+        "GDBRemoteCommunicationServerLLGS::%s failed, no process available",
+        __FUNCTION__);
     return SendErrorResponse(0x15);
   }
 
@@ -2703,10 +2696,10 @@ GDBRemoteCommunicationServerLLGS::Handle
   // Ensure we have a process.
   if (!m_debugged_process_up ||
       (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
-    if (log)
-      log->Printf(
-          "GDBRemoteCommunicationServerLLGS::%s failed, no process available",
-          __FUNCTION__);
+    LLDB_LOGF(
+        log,
+        "GDBRemoteCommunicationServerLLGS::%s failed, no process available",
+        __FUNCTION__);
     return SendErrorResponse(0x32);
   }
 
@@ -2735,11 +2728,11 @@ GDBRemoteCommunicationServerLLGS::Handle
   actions.SetDefaultThreadActionIfNeeded(eStateStopped, 0);
   Status error = m_debugged_process_up->Resume(actions);
   if (error.Fail()) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
-                  " tid %" PRIu64 " Resume() failed with error: %s",
-                  __FUNCTION__, m_debugged_process_up->GetID(), tid,
-                  error.AsCString());
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64
+              " tid %" PRIu64 " Resume() failed with error: %s",
+              __FUNCTION__, m_debugged_process_up->GetID(), tid,
+              error.AsCString());
     return SendErrorResponse(0x49);
   }
 
@@ -2986,18 +2979,18 @@ GDBRemoteCommunicationServerLLGS::Handle
                                  "vAttach failed to parse the process id");
 
   // Attempt to attach.
-  if (log)
-    log->Printf("GDBRemoteCommunicationServerLLGS::%s attempting to attach to "
-                "pid %" PRIu64,
-                __FUNCTION__, pid);
+  LLDB_LOGF(log,
+            "GDBRemoteCommunicationServerLLGS::%s attempting to attach to "
+            "pid %" PRIu64,
+            __FUNCTION__, pid);
 
   Status error = AttachToProcess(pid);
 
   if (error.Fail()) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s failed to attach to "
-                  "pid %" PRIu64 ": %s\n",
-                  __FUNCTION__, pid, error.AsCString());
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s failed to attach to "
+              "pid %" PRIu64 ": %s\n",
+              __FUNCTION__, pid, error.AsCString());
     return SendErrorResponse(error);
   }
 
@@ -3014,10 +3007,10 @@ GDBRemoteCommunicationServerLLGS::Handle
   // Fail if we don't have a current process.
   if (!m_debugged_process_up ||
       (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
-    if (log)
-      log->Printf(
-          "GDBRemoteCommunicationServerLLGS::%s failed, no process available",
-          __FUNCTION__);
+    LLDB_LOGF(
+        log,
+        "GDBRemoteCommunicationServerLLGS::%s failed, no process available",
+        __FUNCTION__);
     return SendErrorResponse(0x15);
   }
 
@@ -3041,11 +3034,10 @@ GDBRemoteCommunicationServerLLGS::Handle
 
   const Status error = m_debugged_process_up->Detach();
   if (error.Fail()) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s failed to detach from "
-                  "pid %" PRIu64 ": %s\n",
-                  __FUNCTION__, m_debugged_process_up->GetID(),
-                  error.AsCString());
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s failed to detach from "
+              "pid %" PRIu64 ": %s\n",
+              __FUNCTION__, m_debugged_process_up->GetID(), error.AsCString());
     return SendErrorResponse(0x01);
   }
 
@@ -3060,10 +3052,10 @@ GDBRemoteCommunicationServerLLGS::Handle
   packet.SetFilePos(strlen("qThreadStopInfo"));
   const lldb::tid_t tid = packet.GetHexMaxU32(false, LLDB_INVALID_THREAD_ID);
   if (tid == LLDB_INVALID_THREAD_ID) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s failed, could not "
-                  "parse thread id from request \"%s\"",
-                  __FUNCTION__, packet.GetStringRef().c_str());
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s failed, could not "
+              "parse thread id from request \"%s\"",
+              __FUNCTION__, packet.GetStringRef().c_str());
     return SendErrorResponse(0x15);
   }
   return SendStopReplyPacketForThread(tid);
@@ -3195,15 +3187,15 @@ void GDBRemoteCommunicationServerLLGS::M
       connection->Disconnect(&error);
 
       if (error.Success()) {
-        if (log)
-          log->Printf("GDBRemoteCommunicationServerLLGS::%s disconnect process "
-                      "terminal stdio - SUCCESS",
-                      __FUNCTION__);
+        LLDB_LOGF(log,
+                  "GDBRemoteCommunicationServerLLGS::%s disconnect process "
+                  "terminal stdio - SUCCESS",
+                  __FUNCTION__);
       } else {
-        if (log)
-          log->Printf("GDBRemoteCommunicationServerLLGS::%s disconnect process "
-                      "terminal stdio - FAIL: %s",
-                      __FUNCTION__, error.AsCString());
+        LLDB_LOGF(log,
+                  "GDBRemoteCommunicationServerLLGS::%s disconnect process "
+                  "terminal stdio - FAIL: %s",
+                  __FUNCTION__, error.AsCString());
       }
     }
   }
@@ -3233,11 +3225,11 @@ NativeThreadProtocol *GDBRemoteCommunica
 
   // Parse out the ';'.
   if (packet.GetBytesLeft() < 1 || packet.GetChar() != ';') {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s gdb-remote parse "
-                  "error: expected ';' prior to start of thread suffix: packet "
-                  "contents = '%s'",
-                  __FUNCTION__, packet.GetStringRef().c_str());
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s gdb-remote parse "
+              "error: expected ';' prior to start of thread suffix: packet "
+              "contents = '%s'",
+              __FUNCTION__, packet.GetStringRef().c_str());
     return nullptr;
   }
 
@@ -3246,11 +3238,11 @@ NativeThreadProtocol *GDBRemoteCommunica
 
   // Parse out thread: portion.
   if (strncmp(packet.Peek(), "thread:", strlen("thread:")) != 0) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerLLGS::%s gdb-remote parse "
-                  "error: expected 'thread:' but not found, packet contents = "
-                  "'%s'",
-                  __FUNCTION__, packet.GetStringRef().c_str());
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerLLGS::%s gdb-remote parse "
+              "error: expected 'thread:' but not found, packet contents = "
+              "'%s'",
+              __FUNCTION__, packet.GetStringRef().c_str());
     return nullptr;
   }
   packet.SetFilePos(packet.GetFilePos() + strlen("thread:"));

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp Wed Jul 24 10:56:10 2019
@@ -104,8 +104,8 @@ Status GDBRemoteCommunicationServerPlatf
     hostname = "127.0.0.1";
 
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
-  if (log)
-    log->Printf("Launching debugserver with: %s:%u...", hostname.c_str(), port);
+  LLDB_LOGF(log, "Launching debugserver with: %s:%u...", hostname.c_str(),
+            port);
 
   // Do not run in a new session so that it can not linger after the platform
   // closes.
@@ -161,9 +161,8 @@ GDBRemoteCommunicationServerPlatform::Ha
   // process...
 
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
-  if (log)
-    log->Printf("GDBRemoteCommunicationServerPlatform::%s() called",
-                __FUNCTION__);
+  LLDB_LOGF(log, "GDBRemoteCommunicationServerPlatform::%s() called",
+            __FUNCTION__);
 
   ConnectionFileDescriptor file_conn;
   std::string hostname;
@@ -183,17 +182,17 @@ GDBRemoteCommunicationServerPlatform::Ha
   Status error =
       LaunchGDBServer(Args(), hostname, debugserver_pid, port, socket_name);
   if (error.Fail()) {
-    if (log)
-      log->Printf("GDBRemoteCommunicationServerPlatform::%s() debugserver "
-                  "launch failed: %s",
-                  __FUNCTION__, error.AsCString());
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerPlatform::%s() debugserver "
+              "launch failed: %s",
+              __FUNCTION__, error.AsCString());
     return SendErrorResponse(9);
   }
 
-  if (log)
-    log->Printf("GDBRemoteCommunicationServerPlatform::%s() debugserver "
-                "launched successfully as pid %" PRIu64,
-                __FUNCTION__, debugserver_pid);
+  LLDB_LOGF(log,
+            "GDBRemoteCommunicationServerPlatform::%s() debugserver "
+            "launched successfully as pid %" PRIu64,
+            __FUNCTION__, debugserver_pid);
 
   StreamGDBRemote response;
   response.Printf("pid:%" PRIu64 ";port:%u;", debugserver_pid,

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp Wed Jul 24 10:56:10 2019
@@ -206,11 +206,14 @@ bool GDBRemoteRegisterContext::ReadRegis
         } else {
           Log *log(ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_THREAD |
                                                                 GDBR_LOG_PACKETS));
-          if (log)
-            log->Printf ("error: GDBRemoteRegisterContext::ReadRegisterBytes tried to read the "
-                        "entire register context at once, expected at least %" PRId64 " bytes "
-                        "but only got %" PRId64 " bytes.", m_reg_data.GetByteSize(),
-                        buffer_sp->GetByteSize());
+          LLDB_LOGF(
+              log,
+              "error: GDBRemoteRegisterContext::ReadRegisterBytes tried "
+              "to read the "
+              "entire register context at once, expected at least %" PRId64
+              " bytes "
+              "but only got %" PRId64 " bytes.",
+              m_reg_data.GetByteSize(), buffer_sp->GetByteSize());
         }
       }
       return false;
@@ -390,13 +393,15 @@ bool GDBRemoteRegisterContext::WriteRegi
         if (log->GetVerbose()) {
           StreamString strm;
           gdb_comm.DumpHistory(strm);
-          log->Printf("error: failed to get packet sequence mutex, not sending "
-                      "write register for \"%s\":\n%s",
-                      reg_info->name, strm.GetData());
+          LLDB_LOGF(log,
+                    "error: failed to get packet sequence mutex, not sending "
+                    "write register for \"%s\":\n%s",
+                    reg_info->name, strm.GetData());
         } else
-          log->Printf("error: failed to get packet sequence mutex, not sending "
-                      "write register for \"%s\"",
-                      reg_info->name);
+          LLDB_LOGF(log,
+                    "error: failed to get packet sequence mutex, not sending "
+                    "write register for \"%s\"",
+                    reg_info->name);
       }
     }
   }
@@ -494,12 +499,14 @@ bool GDBRemoteRegisterContext::ReadAllRe
       if (log->GetVerbose()) {
         StreamString strm;
         gdb_comm.DumpHistory(strm);
-        log->Printf("error: failed to get packet sequence mutex, not sending "
-                    "read all registers:\n%s",
-                    strm.GetData());
+        LLDB_LOGF(log,
+                  "error: failed to get packet sequence mutex, not sending "
+                  "read all registers:\n%s",
+                  strm.GetData());
       } else
-        log->Printf("error: failed to get packet sequence mutex, not sending "
-                    "read all registers");
+        LLDB_LOGF(log,
+                  "error: failed to get packet sequence mutex, not sending "
+                  "read all registers");
     }
   }
 
@@ -667,12 +674,14 @@ bool GDBRemoteRegisterContext::WriteAllR
       if (log->GetVerbose()) {
         StreamString strm;
         gdb_comm.DumpHistory(strm);
-        log->Printf("error: failed to get packet sequence mutex, not sending "
-                    "write all registers:\n%s",
-                    strm.GetData());
+        LLDB_LOGF(log,
+                  "error: failed to get packet sequence mutex, not sending "
+                  "write all registers:\n%s",
+                  strm.GetData());
       } else
-        log->Printf("error: failed to get packet sequence mutex, not sending "
-                    "write all registers");
+        LLDB_LOGF(log,
+                  "error: failed to get packet sequence mutex, not sending "
+                  "write all registers");
     }
   }
   return false;

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=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Wed Jul 24 10:56:10 2019
@@ -354,10 +354,10 @@ ProcessGDBRemote::ProcessGDBRemote(lldb:
 
   if (m_async_listener_sp->StartListeningForEvents(
           &m_async_broadcaster, async_event_mask) != async_event_mask) {
-    if (log)
-      log->Printf("ProcessGDBRemote::%s failed to listen for "
-                  "m_async_broadcaster events",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "ProcessGDBRemote::%s failed to listen for "
+              "m_async_broadcaster events",
+              __FUNCTION__);
   }
 
   const uint32_t gdb_event_mask =
@@ -365,9 +365,9 @@ ProcessGDBRemote::ProcessGDBRemote(lldb:
       GDBRemoteCommunication::eBroadcastBitGdbReadThreadGotNotify;
   if (m_async_listener_sp->StartListeningForEvents(
           &m_gdb_comm, gdb_event_mask) != gdb_event_mask) {
-    if (log)
-      log->Printf("ProcessGDBRemote::%s failed to listen for m_gdb_comm events",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "ProcessGDBRemote::%s failed to listen for m_gdb_comm events",
+              __FUNCTION__);
   }
 
   const uint64_t timeout_seconds =
@@ -785,15 +785,15 @@ Status ProcessGDBRemote::DoConnectRemote
                                      pid, remote_url.str().c_str());
   }
 
-  if (log)
-    log->Printf("ProcessGDBRemote::%s pid %" PRIu64
-                ": normalizing target architecture initial triple: %s "
-                "(GetTarget().GetArchitecture().IsValid() %s, "
-                "m_gdb_comm.GetHostArchitecture().IsValid(): %s)",
-                __FUNCTION__, GetID(),
-                GetTarget().GetArchitecture().GetTriple().getTriple().c_str(),
-                GetTarget().GetArchitecture().IsValid() ? "true" : "false",
-                m_gdb_comm.GetHostArchitecture().IsValid() ? "true" : "false");
+  LLDB_LOGF(log,
+            "ProcessGDBRemote::%s pid %" PRIu64
+            ": normalizing target architecture initial triple: %s "
+            "(GetTarget().GetArchitecture().IsValid() %s, "
+            "m_gdb_comm.GetHostArchitecture().IsValid(): %s)",
+            __FUNCTION__, GetID(),
+            GetTarget().GetArchitecture().GetTriple().getTriple().c_str(),
+            GetTarget().GetArchitecture().IsValid() ? "true" : "false",
+            m_gdb_comm.GetHostArchitecture().IsValid() ? "true" : "false");
 
   if (error.Success() && !GetTarget().GetArchitecture().IsValid() &&
       m_gdb_comm.GetHostArchitecture().IsValid()) {
@@ -805,11 +805,11 @@ Status ProcessGDBRemote::DoConnectRemote
       GetTarget().SetArchitecture(m_gdb_comm.GetHostArchitecture());
   }
 
-  if (log)
-    log->Printf("ProcessGDBRemote::%s pid %" PRIu64
-                ": normalized target architecture triple: %s",
-                __FUNCTION__, GetID(),
-                GetTarget().GetArchitecture().GetTriple().getTriple().c_str());
+  LLDB_LOGF(log,
+            "ProcessGDBRemote::%s pid %" PRIu64
+            ": normalized target architecture triple: %s",
+            __FUNCTION__, GetID(),
+            GetTarget().GetArchitecture().GetTriple().getTriple().c_str());
 
   if (error.Success()) {
     PlatformSP platform_sp = GetTarget().GetPlatform();
@@ -834,8 +834,7 @@ Status ProcessGDBRemote::DoLaunch(lldb_p
   Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
   Status error;
 
-  if (log)
-    log->Printf("ProcessGDBRemote::%s() entered", __FUNCTION__);
+  LLDB_LOGF(log, "ProcessGDBRemote::%s() entered", __FUNCTION__);
 
   uint32_t launch_flags = launch_info.GetFlags().Get();
   FileSpec stdin_file_spec{};
@@ -862,15 +861,17 @@ Status ProcessGDBRemote::DoLaunch(lldb_p
 
   if (log) {
     if (stdin_file_spec || stdout_file_spec || stderr_file_spec)
-      log->Printf("ProcessGDBRemote::%s provided with STDIO paths via "
-                  "launch_info: stdin=%s, stdout=%s, stderr=%s",
-                  __FUNCTION__,
-                  stdin_file_spec ? stdin_file_spec.GetCString() : "<null>",
-                  stdout_file_spec ? stdout_file_spec.GetCString() : "<null>",
-                  stderr_file_spec ? stderr_file_spec.GetCString() : "<null>");
+      LLDB_LOGF(log,
+                "ProcessGDBRemote::%s provided with STDIO paths via "
+                "launch_info: stdin=%s, stdout=%s, stderr=%s",
+                __FUNCTION__,
+                stdin_file_spec ? stdin_file_spec.GetCString() : "<null>",
+                stdout_file_spec ? stdout_file_spec.GetCString() : "<null>",
+                stderr_file_spec ? stderr_file_spec.GetCString() : "<null>");
     else
-      log->Printf("ProcessGDBRemote::%s no STDIO paths given via launch_info",
-                  __FUNCTION__);
+      LLDB_LOGF(log,
+                "ProcessGDBRemote::%s no STDIO paths given via launch_info",
+                __FUNCTION__);
   }
 
   const bool disable_stdio = (launch_flags & eLaunchFlagDisableSTDIO) != 0;
@@ -925,24 +926,23 @@ Status ProcessGDBRemote::DoLaunch(lldb_p
           if (!stderr_file_spec)
             stderr_file_spec = slave_name;
         }
-        if (log)
-          log->Printf(
-              "ProcessGDBRemote::%s adjusted STDIO paths for local platform "
-              "(IsHost() is true) using slave: stdin=%s, stdout=%s, stderr=%s",
-              __FUNCTION__,
-              stdin_file_spec ? stdin_file_spec.GetCString() : "<null>",
-              stdout_file_spec ? stdout_file_spec.GetCString() : "<null>",
-              stderr_file_spec ? stderr_file_spec.GetCString() : "<null>");
-      }
-
-      if (log)
-        log->Printf("ProcessGDBRemote::%s final STDIO paths after all "
-                    "adjustments: stdin=%s, stdout=%s, stderr=%s",
-                    __FUNCTION__,
-                    stdin_file_spec ? stdin_file_spec.GetCString() : "<null>",
-                    stdout_file_spec ? stdout_file_spec.GetCString() : "<null>",
-                    stderr_file_spec ? stderr_file_spec.GetCString()
-                                     : "<null>");
+        LLDB_LOGF(
+            log,
+            "ProcessGDBRemote::%s adjusted STDIO paths for local platform "
+            "(IsHost() is true) using slave: stdin=%s, stdout=%s, stderr=%s",
+            __FUNCTION__,
+            stdin_file_spec ? stdin_file_spec.GetCString() : "<null>",
+            stdout_file_spec ? stdout_file_spec.GetCString() : "<null>",
+            stderr_file_spec ? stderr_file_spec.GetCString() : "<null>");
+      }
+
+      LLDB_LOGF(log,
+                "ProcessGDBRemote::%s final STDIO paths after all "
+                "adjustments: stdin=%s, stdout=%s, stderr=%s",
+                __FUNCTION__,
+                stdin_file_spec ? stdin_file_spec.GetCString() : "<null>",
+                stdout_file_spec ? stdout_file_spec.GetCString() : "<null>",
+                stderr_file_spec ? stderr_file_spec.GetCString() : "<null>");
 
       if (stdin_file_spec)
         m_gdb_comm.SetSTDIN(stdin_file_spec);
@@ -988,9 +988,8 @@ Status ProcessGDBRemote::DoLaunch(lldb_p
       }
 
       if (GetID() == LLDB_INVALID_PROCESS_ID) {
-        if (log)
-          log->Printf("failed to connect to debugserver: %s",
-                      error.AsCString());
+        LLDB_LOGF(log, "failed to connect to debugserver: %s",
+                  error.AsCString());
         KillDebugserverProcess();
         return error;
       }
@@ -1020,8 +1019,7 @@ Status ProcessGDBRemote::DoLaunch(lldb_p
         }
       }
     } else {
-      if (log)
-        log->Printf("failed to connect to debugserver: %s", error.AsCString());
+      LLDB_LOGF(log, "failed to connect to debugserver: %s", error.AsCString());
     }
   } else {
     // Set our user ID to an invalid process ID.
@@ -1040,9 +1038,8 @@ Status ProcessGDBRemote::ConnectToDebugs
   Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
 
   if (!connect_url.empty()) {
-    if (log)
-      log->Printf("ProcessGDBRemote::%s Connecting to %s", __FUNCTION__,
-                  connect_url.str().c_str());
+    LLDB_LOGF(log, "ProcessGDBRemote::%s Connecting to %s", __FUNCTION__,
+              connect_url.str().c_str());
     std::unique_ptr<ConnectionFileDescriptor> conn_up(
         new ConnectionFileDescriptor());
     if (conn_up) {
@@ -1116,8 +1113,7 @@ Status ProcessGDBRemote::ConnectToDebugs
 
 void ProcessGDBRemote::DidLaunchOrAttach(ArchSpec &process_arch) {
   Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
-  if (log)
-    log->Printf("ProcessGDBRemote::%s()", __FUNCTION__);
+  LLDB_LOGF(log, "ProcessGDBRemote::%s()", __FUNCTION__);
   if (GetID() != LLDB_INVALID_PROCESS_ID) {
     BuildDynamicRegisterInfo(false);
 
@@ -1130,43 +1126,42 @@ void ProcessGDBRemote::DidLaunchOrAttach
     const ArchSpec &remote_process_arch = m_gdb_comm.GetProcessArchitecture();
     if (remote_process_arch.IsValid()) {
       process_arch = remote_process_arch;
-      if (log)
-        log->Printf("ProcessGDBRemote::%s gdb-remote had process architecture, "
-                    "using %s %s",
-                    __FUNCTION__,
-                    process_arch.GetArchitectureName()
-                        ? process_arch.GetArchitectureName()
-                        : "<null>",
-                    process_arch.GetTriple().getTriple().c_str()
-                        ? process_arch.GetTriple().getTriple().c_str()
-                        : "<null>");
+      LLDB_LOGF(log,
+                "ProcessGDBRemote::%s gdb-remote had process architecture, "
+                "using %s %s",
+                __FUNCTION__,
+                process_arch.GetArchitectureName()
+                    ? process_arch.GetArchitectureName()
+                    : "<null>",
+                process_arch.GetTriple().getTriple().c_str()
+                    ? process_arch.GetTriple().getTriple().c_str()
+                    : "<null>");
     } else {
       process_arch = m_gdb_comm.GetHostArchitecture();
-      if (log)
-        log->Printf("ProcessGDBRemote::%s gdb-remote did not have process "
-                    "architecture, using gdb-remote host architecture %s %s",
-                    __FUNCTION__,
-                    process_arch.GetArchitectureName()
-                        ? process_arch.GetArchitectureName()
-                        : "<null>",
-                    process_arch.GetTriple().getTriple().c_str()
-                        ? process_arch.GetTriple().getTriple().c_str()
-                        : "<null>");
+      LLDB_LOGF(log,
+                "ProcessGDBRemote::%s gdb-remote did not have process "
+                "architecture, using gdb-remote host architecture %s %s",
+                __FUNCTION__,
+                process_arch.GetArchitectureName()
+                    ? process_arch.GetArchitectureName()
+                    : "<null>",
+                process_arch.GetTriple().getTriple().c_str()
+                    ? process_arch.GetTriple().getTriple().c_str()
+                    : "<null>");
     }
 
     if (process_arch.IsValid()) {
       const ArchSpec &target_arch = GetTarget().GetArchitecture();
       if (target_arch.IsValid()) {
-        if (log)
-          log->Printf(
-              "ProcessGDBRemote::%s analyzing target arch, currently %s %s",
-              __FUNCTION__,
-              target_arch.GetArchitectureName()
-                  ? target_arch.GetArchitectureName()
-                  : "<null>",
-              target_arch.GetTriple().getTriple().c_str()
-                  ? target_arch.GetTriple().getTriple().c_str()
-                  : "<null>");
+        LLDB_LOGF(log,
+                  "ProcessGDBRemote::%s analyzing target arch, currently %s %s",
+                  __FUNCTION__,
+                  target_arch.GetArchitectureName()
+                      ? target_arch.GetArchitectureName()
+                      : "<null>",
+                  target_arch.GetTriple().getTriple().c_str()
+                      ? target_arch.GetTriple().getTriple().c_str()
+                      : "<null>");
 
         // If the remote host is ARM and we have apple as the vendor, then
         // ARM executables and shared libraries can have mixed ARM
@@ -1180,16 +1175,16 @@ void ProcessGDBRemote::DidLaunchOrAttach
              process_arch.GetMachine() == llvm::Triple::thumb) &&
             process_arch.GetTriple().getVendor() == llvm::Triple::Apple) {
           GetTarget().SetArchitecture(process_arch);
-          if (log)
-            log->Printf("ProcessGDBRemote::%s remote process is ARM/Apple, "
-                        "setting target arch to %s %s",
-                        __FUNCTION__,
-                        process_arch.GetArchitectureName()
-                            ? process_arch.GetArchitectureName()
-                            : "<null>",
-                        process_arch.GetTriple().getTriple().c_str()
-                            ? process_arch.GetTriple().getTriple().c_str()
-                            : "<null>");
+          LLDB_LOGF(log,
+                    "ProcessGDBRemote::%s remote process is ARM/Apple, "
+                    "setting target arch to %s %s",
+                    __FUNCTION__,
+                    process_arch.GetArchitectureName()
+                        ? process_arch.GetArchitectureName()
+                        : "<null>",
+                    process_arch.GetTriple().getTriple().c_str()
+                        ? process_arch.GetTriple().getTriple().c_str()
+                        : "<null>");
         } else {
           // Fill in what is missing in the triple
           const llvm::Triple &remote_triple = process_arch.GetTriple();
@@ -1211,16 +1206,16 @@ void ProcessGDBRemote::DidLaunchOrAttach
           }
         }
 
-        if (log)
-          log->Printf("ProcessGDBRemote::%s final target arch after "
-                      "adjustments for remote architecture: %s %s",
-                      __FUNCTION__,
-                      target_arch.GetArchitectureName()
-                          ? target_arch.GetArchitectureName()
-                          : "<null>",
-                      target_arch.GetTriple().getTriple().c_str()
-                          ? target_arch.GetTriple().getTriple().c_str()
-                          : "<null>");
+        LLDB_LOGF(log,
+                  "ProcessGDBRemote::%s final target arch after "
+                  "adjustments for remote architecture: %s %s",
+                  __FUNCTION__,
+                  target_arch.GetArchitectureName()
+                      ? target_arch.GetArchitectureName()
+                      : "<null>",
+                  target_arch.GetTriple().getTriple().c_str()
+                      ? target_arch.GetTriple().getTriple().c_str()
+                      : "<null>");
       } else {
         // The target doesn't have a valid architecture yet, set it from the
         // architecture we got from the remote GDB server
@@ -1247,8 +1242,7 @@ Status ProcessGDBRemote::DoAttachToProce
   Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
   Status error;
 
-  if (log)
-    log->Printf("ProcessGDBRemote::%s()", __FUNCTION__);
+  LLDB_LOGF(log, "ProcessGDBRemote::%s()", __FUNCTION__);
 
   // Clear out and clean up from any current state
   Clear();
@@ -1359,8 +1353,7 @@ Status ProcessGDBRemote::WillResume() {
 Status ProcessGDBRemote::DoResume() {
   Status error;
   Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
-  if (log)
-    log->Printf("ProcessGDBRemote::Resume()");
+  LLDB_LOGF(log, "ProcessGDBRemote::Resume()");
 
   ListenerSP listener_sp(
       Listener::MakeListener("gdb-remote.resume-packet-sent"));
@@ -1547,9 +1540,8 @@ Status ProcessGDBRemote::DoResume() {
       EventSP event_sp;
       if (!m_async_thread.IsJoinable()) {
         error.SetErrorString("Trying to resume but the async thread is dead.");
-        if (log)
-          log->Printf("ProcessGDBRemote::DoResume: Trying to resume but the "
-                      "async thread is dead.");
+        LLDB_LOGF(log, "ProcessGDBRemote::DoResume: Trying to resume but the "
+                       "async thread is dead.");
         return error;
       }
 
@@ -1560,14 +1552,13 @@ Status ProcessGDBRemote::DoResume() {
 
       if (!listener_sp->GetEvent(event_sp, std::chrono::seconds(5))) {
         error.SetErrorString("Resume timed out.");
-        if (log)
-          log->Printf("ProcessGDBRemote::DoResume: Resume timed out.");
+        LLDB_LOGF(log, "ProcessGDBRemote::DoResume: Resume timed out.");
       } else if (event_sp->BroadcasterIs(&m_async_broadcaster)) {
         error.SetErrorString("Broadcast continue, but the async thread was "
                              "killed before we got an ack back.");
-        if (log)
-          log->Printf("ProcessGDBRemote::DoResume: Broadcast continue, but the "
-                      "async thread was killed before we got an ack back.");
+        LLDB_LOGF(log,
+                  "ProcessGDBRemote::DoResume: Broadcast continue, but the "
+                  "async thread was killed before we got an ack back.");
         return error;
       }
     }
@@ -1979,8 +1970,7 @@ ThreadSP ProcessGDBRemote::SetThreadStop
               if (watch_id == LLDB_INVALID_WATCH_ID) {
                 Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(
                     GDBR_LOG_WATCHPOINTS));
-                if (log)
-                  log->Printf("failed to find watchpoint");
+                LLDB_LOGF(log, "failed to find watchpoint");
               }
               thread_sp->SetStopInfo(StopInfo::CreateStopReasonWithWatchpointID(
                   *thread_sp, watch_id, wp_hit_addr));
@@ -2501,8 +2491,7 @@ Status ProcessGDBRemote::DoHalt(bool &ca
 Status ProcessGDBRemote::DoDetach(bool keep_stopped) {
   Status error;
   Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
-  if (log)
-    log->Printf("ProcessGDBRemote::DoDetach(keep_stopped: %i)", keep_stopped);
+  LLDB_LOGF(log, "ProcessGDBRemote::DoDetach(keep_stopped: %i)", keep_stopped);
 
   error = m_gdb_comm.Detach(keep_stopped);
   if (log) {
@@ -2510,8 +2499,9 @@ Status ProcessGDBRemote::DoDetach(bool k
       log->PutCString(
           "ProcessGDBRemote::DoDetach() detach packet sent successfully");
     else
-      log->Printf("ProcessGDBRemote::DoDetach() detach packet send failed: %s",
-                  error.AsCString() ? error.AsCString() : "<unknown error>");
+      LLDB_LOGF(log,
+                "ProcessGDBRemote::DoDetach() detach packet send failed: %s",
+                error.AsCString() ? error.AsCString() : "<unknown error>");
   }
 
   if (!error.Success())
@@ -2530,8 +2520,7 @@ Status ProcessGDBRemote::DoDetach(bool k
 Status ProcessGDBRemote::DoDestroy() {
   Status error;
   Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
-  if (log)
-    log->Printf("ProcessGDBRemote::DoDestroy()");
+  LLDB_LOGF(log, "ProcessGDBRemote::DoDestroy()");
 
   // There is a bug in older iOS debugservers where they don't shut down the
   // process they are debugging properly.  If the process is sitting at a
@@ -2586,11 +2575,11 @@ Status ProcessGDBRemote::DoDestroy() {
               reason = stop_info_sp->GetStopReason();
             if (reason == eStopReasonBreakpoint ||
                 reason == eStopReasonException) {
-              if (log)
-                log->Printf(
-                    "ProcessGDBRemote::DoDestroy() - thread: 0x%4.4" PRIx64
-                    " stopped with reason: %s.",
-                    thread_sp->GetProtocolID(), stop_info_sp->GetDescription());
+              LLDB_LOGF(log,
+                        "ProcessGDBRemote::DoDestroy() - thread: 0x%4.4" PRIx64
+                        " stopped with reason: %s.",
+                        thread_sp->GetProtocolID(),
+                        stop_info_sp->GetDescription());
               stop_looks_like_crash = true;
               break;
             }
@@ -2622,10 +2611,10 @@ Status ProcessGDBRemote::DoDestroy() {
                 reason = stop_info_sp->GetStopReason();
               if (reason != eStopReasonBreakpoint &&
                   reason != eStopReasonException) {
-                if (log)
-                  log->Printf("ProcessGDBRemote::DoDestroy() - Suspending "
-                              "thread: 0x%4.4" PRIx64 " before running.",
-                              thread_sp->GetProtocolID());
+                LLDB_LOGF(log,
+                          "ProcessGDBRemote::DoDestroy() - Suspending "
+                          "thread: 0x%4.4" PRIx64 " before running.",
+                          thread_sp->GetProtocolID());
                 thread_sp->SetResumeState(eStateSuspended);
               }
             }
@@ -2669,30 +2658,28 @@ Status ProcessGDBRemote::DoDestroy() {
             int status;
             ::pid_t reap_pid;
             reap_pid = waitpid(GetID(), &status, WNOHANG);
-            if (log)
-              log->Printf("Reaped pid: %d, status: %d.\n", reap_pid, status);
+            LLDB_LOGF(log, "Reaped pid: %d, status: %d.\n", reap_pid, status);
           }
 #endif
           SetLastStopPacket(response);
           ClearThreadIDList();
           exit_status = response.GetHexU8();
         } else {
-          if (log)
-            log->Printf("ProcessGDBRemote::DoDestroy - got unexpected response "
-                        "to k packet: %s",
-                        response.GetStringRef().c_str());
+          LLDB_LOGF(log,
+                    "ProcessGDBRemote::DoDestroy - got unexpected response "
+                    "to k packet: %s",
+                    response.GetStringRef().c_str());
           exit_string.assign("got unexpected response to k packet: ");
           exit_string.append(response.GetStringRef());
         }
       } else {
-        if (log)
-          log->Printf("ProcessGDBRemote::DoDestroy - failed to send k packet");
+        LLDB_LOGF(log, "ProcessGDBRemote::DoDestroy - failed to send k packet");
         exit_string.assign("failed to send the k packet");
       }
     } else {
-      if (log)
-        log->Printf("ProcessGDBRemote::DoDestroy - killed or interrupted while "
-                    "attaching");
+      LLDB_LOGF(log,
+                "ProcessGDBRemote::DoDestroy - killed or interrupted while "
+                "attaching");
       exit_string.assign("killed or interrupted while attaching.");
     }
   } else {
@@ -2715,8 +2702,7 @@ void ProcessGDBRemote::SetLastStopPacket
       response.GetStringRef().find(";reason:exec;") != std::string::npos;
   if (did_exec) {
     Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
-    if (log)
-      log->Printf("ProcessGDBRemote::SetLastStopPacket () - detected exec");
+    LLDB_LOGF(log, "ProcessGDBRemote::SetLastStopPacket () - detected exec");
 
     m_thread_list_real.Clear();
     m_thread_list.Clear();
@@ -3078,11 +3064,11 @@ lldb::addr_t ProcessGDBRemote::DoAllocat
       m_addr_to_mmap_size[allocated_addr] = size;
     else {
       allocated_addr = LLDB_INVALID_ADDRESS;
-      if (log)
-        log->Printf("ProcessGDBRemote::%s no direct stub support for memory "
-                    "allocation, and InferiorCallMmap also failed - is stub "
-                    "missing register context save/restore capability?",
-                    __FUNCTION__);
+      LLDB_LOGF(log,
+                "ProcessGDBRemote::%s no direct stub support for memory "
+                "allocation, and InferiorCallMmap also failed - is stub "
+                "missing register context save/restore capability?",
+                __FUNCTION__);
     }
   }
 
@@ -3173,17 +3159,17 @@ Status ProcessGDBRemote::EnableBreakpoin
   const addr_t addr = bp_site->GetLoadAddress();
 
   // Log that a breakpoint was requested
-  if (log)
-    log->Printf("ProcessGDBRemote::EnableBreakpointSite (size_id = %" PRIu64
-                ") address = 0x%" PRIx64,
-                site_id, (uint64_t)addr);
+  LLDB_LOGF(log,
+            "ProcessGDBRemote::EnableBreakpointSite (size_id = %" PRIu64
+            ") address = 0x%" PRIx64,
+            site_id, (uint64_t)addr);
 
   // Breakpoint already exists and is enabled
   if (bp_site->IsEnabled()) {
-    if (log)
-      log->Printf("ProcessGDBRemote::EnableBreakpointSite (size_id = %" PRIu64
-                  ") address = 0x%" PRIx64 " -- SUCCESS (already enabled)",
-                  site_id, (uint64_t)addr);
+    LLDB_LOGF(log,
+              "ProcessGDBRemote::EnableBreakpointSite (size_id = %" PRIu64
+              ") address = 0x%" PRIx64 " -- SUCCESS (already enabled)",
+              site_id, (uint64_t)addr);
     return error;
   }
 
@@ -3231,8 +3217,7 @@ Status ProcessGDBRemote::EnableBreakpoin
     // We reach here when software breakpoints have been found to be
     // unsupported. For future calls to set a breakpoint, we will not attempt
     // to set a breakpoint with a type that is known not to be supported.
-    if (log)
-      log->Printf("Software breakpoints are unsupported");
+    LLDB_LOGF(log, "Software breakpoints are unsupported");
 
     // So we will fall through and try a hardware breakpoint
   }
@@ -3270,8 +3255,7 @@ Status ProcessGDBRemote::EnableBreakpoin
 
     // We will reach here when the stub gives an unsupported response to a
     // hardware breakpoint
-    if (log)
-      log->Printf("Hardware breakpoints are unsupported");
+    LLDB_LOGF(log, "Hardware breakpoints are unsupported");
 
     // Finally we will falling through to a #trap style breakpoint
   }
@@ -3293,10 +3277,10 @@ Status ProcessGDBRemote::DisableBreakpoi
   addr_t addr = bp_site->GetLoadAddress();
   user_id_t site_id = bp_site->GetID();
   Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_BREAKPOINTS));
-  if (log)
-    log->Printf("ProcessGDBRemote::DisableBreakpointSite (site_id = %" PRIu64
-                ") addr = 0x%8.8" PRIx64,
-                site_id, (uint64_t)addr);
+  LLDB_LOGF(log,
+            "ProcessGDBRemote::DisableBreakpointSite (site_id = %" PRIu64
+            ") addr = 0x%8.8" PRIx64,
+            site_id, (uint64_t)addr);
 
   if (bp_site->IsEnabled()) {
     const size_t bp_op_size = GetSoftwareBreakpointTrapOpcode(bp_site);
@@ -3328,10 +3312,10 @@ Status ProcessGDBRemote::DisableBreakpoi
     if (error.Success())
       bp_site->SetEnabled(false);
   } else {
-    if (log)
-      log->Printf("ProcessGDBRemote::DisableBreakpointSite (site_id = %" PRIu64
-                  ") addr = 0x%8.8" PRIx64 " -- SUCCESS (already disabled)",
-                  site_id, (uint64_t)addr);
+    LLDB_LOGF(log,
+              "ProcessGDBRemote::DisableBreakpointSite (site_id = %" PRIu64
+              ") addr = 0x%8.8" PRIx64 " -- SUCCESS (already disabled)",
+              site_id, (uint64_t)addr);
     return error;
   }
 
@@ -3363,14 +3347,13 @@ Status ProcessGDBRemote::EnableWatchpoin
     addr_t addr = wp->GetLoadAddress();
     Log *log(
         ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_WATCHPOINTS));
-    if (log)
-      log->Printf("ProcessGDBRemote::EnableWatchpoint(watchID = %" PRIu64 ")",
-                  watchID);
+    LLDB_LOGF(log, "ProcessGDBRemote::EnableWatchpoint(watchID = %" PRIu64 ")",
+              watchID);
     if (wp->IsEnabled()) {
-      if (log)
-        log->Printf("ProcessGDBRemote::EnableWatchpoint(watchID = %" PRIu64
-                    ") addr = 0x%8.8" PRIx64 ": watchpoint already enabled.",
-                    watchID, (uint64_t)addr);
+      LLDB_LOGF(log,
+                "ProcessGDBRemote::EnableWatchpoint(watchID = %" PRIu64
+                ") addr = 0x%8.8" PRIx64 ": watchpoint already enabled.",
+                watchID, (uint64_t)addr);
       return error;
     }
 
@@ -3403,16 +3386,16 @@ Status ProcessGDBRemote::DisableWatchpoi
 
     addr_t addr = wp->GetLoadAddress();
 
-    if (log)
-      log->Printf("ProcessGDBRemote::DisableWatchpoint (watchID = %" PRIu64
-                  ") addr = 0x%8.8" PRIx64,
-                  watchID, (uint64_t)addr);
+    LLDB_LOGF(log,
+              "ProcessGDBRemote::DisableWatchpoint (watchID = %" PRIu64
+              ") addr = 0x%8.8" PRIx64,
+              watchID, (uint64_t)addr);
 
     if (!wp->IsEnabled()) {
-      if (log)
-        log->Printf("ProcessGDBRemote::DisableWatchpoint (watchID = %" PRIu64
-                    ") addr = 0x%8.8" PRIx64 " -- SUCCESS (already disabled)",
-                    watchID, (uint64_t)addr);
+      LLDB_LOGF(log,
+                "ProcessGDBRemote::DisableWatchpoint (watchID = %" PRIu64
+                ") addr = 0x%8.8" PRIx64 " -- SUCCESS (already disabled)",
+                watchID, (uint64_t)addr);
       // See also 'class WatchpointSentry' within StopInfo.cpp. This disabling
       // attempt might come from the user-supplied actions, we'll route it in
       // order for the watchpoint object to intelligently process this action.
@@ -3447,8 +3430,7 @@ void ProcessGDBRemote::Clear() {
 Status ProcessGDBRemote::DoSignal(int signo) {
   Status error;
   Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
-  if (log)
-    log->Printf("ProcessGDBRemote::DoSignal (signal = %d)", signo);
+  LLDB_LOGF(log, "ProcessGDBRemote::DoSignal (signal = %d)", signo);
 
   if (!m_gdb_comm.SendAsyncSignal(signo))
     error.SetErrorStringWithFormat("failed to send signal %i", signo);
@@ -3586,9 +3568,8 @@ Status ProcessGDBRemote::LaunchAndConnec
     if (error.Fail()) {
       Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
 
-      if (log)
-        log->Printf("failed to start debugserver process: %s",
-                    error.AsCString());
+      LLDB_LOGF(log, "failed to start debugserver process: %s",
+                error.AsCString());
       return error;
     }
 
@@ -3614,15 +3595,14 @@ bool ProcessGDBRemote::MonitorDebugserve
   Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
   const bool handled = true;
 
-  if (log)
-    log->Printf("ProcessGDBRemote::%s(process_wp, pid=%" PRIu64
-                ", signo=%i (0x%x), exit_status=%i)",
-                __FUNCTION__, debugserver_pid, signo, signo, exit_status);
+  LLDB_LOGF(log,
+            "ProcessGDBRemote::%s(process_wp, pid=%" PRIu64
+            ", signo=%i (0x%x), exit_status=%i)",
+            __FUNCTION__, debugserver_pid, signo, signo, exit_status);
 
   std::shared_ptr<ProcessGDBRemote> process_sp = process_wp.lock();
-  if (log)
-    log->Printf("ProcessGDBRemote::%s(process = %p)", __FUNCTION__,
-                static_cast<void *>(process_sp.get()));
+  LLDB_LOGF(log, "ProcessGDBRemote::%s(process = %p)", __FUNCTION__,
+            static_cast<void *>(process_sp.get()));
   if (!process_sp || process_sp->m_debugserver_pid != debugserver_pid)
     return handled;
 
@@ -3692,8 +3672,7 @@ void ProcessGDBRemote::DebuggerInitializ
 bool ProcessGDBRemote::StartAsyncThread() {
   Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
 
-  if (log)
-    log->Printf("ProcessGDBRemote::%s ()", __FUNCTION__);
+  LLDB_LOGF(log, "ProcessGDBRemote::%s ()", __FUNCTION__);
 
   std::lock_guard<std::recursive_mutex> guard(m_async_thread_state_mutex);
   if (!m_async_thread.IsJoinable()) {
@@ -3709,10 +3688,11 @@ bool ProcessGDBRemote::StartAsyncThread(
       return false;
     }
     m_async_thread = *async_thread;
-  } else if (log)
-    log->Printf("ProcessGDBRemote::%s () - Called when Async thread was "
-                "already running.",
-                __FUNCTION__);
+  } else
+    LLDB_LOGF(log,
+              "ProcessGDBRemote::%s () - Called when Async thread was "
+              "already running.",
+              __FUNCTION__);
 
   return m_async_thread.IsJoinable();
 }
@@ -3720,8 +3700,7 @@ bool ProcessGDBRemote::StartAsyncThread(
 void ProcessGDBRemote::StopAsyncThread() {
   Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
 
-  if (log)
-    log->Printf("ProcessGDBRemote::%s ()", __FUNCTION__);
+  LLDB_LOGF(log, "ProcessGDBRemote::%s ()", __FUNCTION__);
 
   std::lock_guard<std::recursive_mutex> guard(m_async_thread_state_mutex);
   if (m_async_thread.IsJoinable()) {
@@ -3733,8 +3712,9 @@ void ProcessGDBRemote::StopAsyncThread()
     // Stop the stdio thread
     m_async_thread.Join(nullptr);
     m_async_thread.Reset();
-  } else if (log)
-    log->Printf(
+  } else
+    LLDB_LOGF(
+        log,
         "ProcessGDBRemote::%s () - Called when Async thread was not running.",
         __FUNCTION__);
 }
@@ -3768,25 +3748,25 @@ thread_result_t ProcessGDBRemote::AsyncT
   ProcessGDBRemote *process = (ProcessGDBRemote *)arg;
 
   Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
-  if (log)
-    log->Printf("ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64
-                ") thread starting...",
-                __FUNCTION__, arg, process->GetID());
+  LLDB_LOGF(log,
+            "ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64
+            ") thread starting...",
+            __FUNCTION__, arg, process->GetID());
 
   EventSP event_sp;
   bool done = false;
   while (!done) {
-    if (log)
-      log->Printf("ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64
-                  ") listener.WaitForEvent (NULL, event_sp)...",
-                  __FUNCTION__, arg, process->GetID());
+    LLDB_LOGF(log,
+              "ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64
+              ") listener.WaitForEvent (NULL, event_sp)...",
+              __FUNCTION__, arg, process->GetID());
     if (process->m_async_listener_sp->GetEvent(event_sp, llvm::None)) {
       const uint32_t event_type = event_sp->GetType();
       if (event_sp->BroadcasterIs(&process->m_async_broadcaster)) {
-        if (log)
-          log->Printf("ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64
-                      ") Got an event of type: %d...",
-                      __FUNCTION__, arg, process->GetID(), event_type);
+        LLDB_LOGF(log,
+                  "ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64
+                  ") Got an event of type: %d...",
+                  __FUNCTION__, arg, process->GetID(), event_type);
 
         switch (event_type) {
         case eBroadcastBitAsyncContinue: {
@@ -3797,10 +3777,10 @@ thread_result_t ProcessGDBRemote::AsyncT
             const char *continue_cstr =
                 (const char *)continue_packet->GetBytes();
             const size_t continue_cstr_len = continue_packet->GetByteSize();
-            if (log)
-              log->Printf("ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64
-                          ") got eBroadcastBitAsyncContinue: %s",
-                          __FUNCTION__, arg, process->GetID(), continue_cstr);
+            LLDB_LOGF(log,
+                      "ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64
+                      ") got eBroadcastBitAsyncContinue: %s",
+                      __FUNCTION__, arg, process->GetID(), continue_cstr);
 
             if (::strstr(continue_cstr, "vAttach") == nullptr)
               process->SetPrivateState(eStateRunning);
@@ -3891,18 +3871,18 @@ thread_result_t ProcessGDBRemote::AsyncT
         break;
 
         case eBroadcastBitAsyncThreadShouldExit:
-          if (log)
-            log->Printf("ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64
-                        ") got eBroadcastBitAsyncThreadShouldExit...",
-                        __FUNCTION__, arg, process->GetID());
+          LLDB_LOGF(log,
+                    "ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64
+                    ") got eBroadcastBitAsyncThreadShouldExit...",
+                    __FUNCTION__, arg, process->GetID());
           done = true;
           break;
 
         default:
-          if (log)
-            log->Printf("ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64
-                        ") got unknown event 0x%8.8x",
-                        __FUNCTION__, arg, process->GetID(), event_type);
+          LLDB_LOGF(log,
+                    "ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64
+                    ") got unknown event 0x%8.8x",
+                    __FUNCTION__, arg, process->GetID(), event_type);
           done = true;
           break;
         }
@@ -3925,27 +3905,27 @@ thread_result_t ProcessGDBRemote::AsyncT
         }
 
         default:
-          if (log)
-            log->Printf("ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64
-                        ") got unknown event 0x%8.8x",
-                        __FUNCTION__, arg, process->GetID(), event_type);
+          LLDB_LOGF(log,
+                    "ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64
+                    ") got unknown event 0x%8.8x",
+                    __FUNCTION__, arg, process->GetID(), event_type);
           done = true;
           break;
         }
       }
     } else {
-      if (log)
-        log->Printf("ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64
-                    ") listener.WaitForEvent (NULL, event_sp) => false",
-                    __FUNCTION__, arg, process->GetID());
+      LLDB_LOGF(log,
+                "ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64
+                ") listener.WaitForEvent (NULL, event_sp) => false",
+                __FUNCTION__, arg, process->GetID());
       done = true;
     }
   }
 
-  if (log)
-    log->Printf("ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64
-                ") thread exiting...",
-                __FUNCTION__, arg, process->GetID());
+  LLDB_LOGF(log,
+            "ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64
+            ") thread exiting...",
+            __FUNCTION__, arg, process->GetID());
 
   return {};
 }
@@ -3977,8 +3957,7 @@ bool ProcessGDBRemote::NewThreadNotifyBr
   // thread when it starts to
   // run so I can stop it if that's what I want to do.
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
-  if (log)
-    log->Printf("Hit New Thread Notification breakpoint.");
+  LLDB_LOGF(log, "Hit New Thread Notification breakpoint.");
   return false;
 }
 
@@ -4023,7 +4002,7 @@ bool ProcessGDBRemote::StartNoticingNewT
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
   if (m_thread_create_bp_sp) {
     if (log && log->GetVerbose())
-      log->Printf("Enabled noticing new thread breakpoint.");
+      LLDB_LOGF(log, "Enabled noticing new thread breakpoint.");
     m_thread_create_bp_sp->SetEnabled(true);
   } else {
     PlatformSP platform_sp(GetTarget().GetPlatform());
@@ -4032,14 +4011,13 @@ bool ProcessGDBRemote::StartNoticingNewT
           platform_sp->SetThreadCreationBreakpoint(GetTarget());
       if (m_thread_create_bp_sp) {
         if (log && log->GetVerbose())
-          log->Printf(
-              "Successfully created new thread notification breakpoint %i",
+          LLDB_LOGF(
+              log, "Successfully created new thread notification breakpoint %i",
               m_thread_create_bp_sp->GetID());
         m_thread_create_bp_sp->SetCallback(
             ProcessGDBRemote::NewThreadNotifyBreakpointHit, this, true);
       } else {
-        if (log)
-          log->Printf("Failed to create new thread notification breakpoint.");
+        LLDB_LOGF(log, "Failed to create new thread notification breakpoint.");
       }
     }
   }
@@ -4049,7 +4027,7 @@ bool ProcessGDBRemote::StartNoticingNewT
 bool ProcessGDBRemote::StopNoticingNewThreads() {
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
   if (log && log->GetVerbose())
-    log->Printf("Disabling new thread notification breakpoint.");
+    LLDB_LOGF(log, "Disabling new thread notification breakpoint.");
 
   if (m_thread_create_bp_sp)
     m_thread_create_bp_sp->SetEnabled(false);
@@ -4325,19 +4303,18 @@ bool ProcessGDBRemote::GetModuleSpec(con
   }
 
   if (!m_gdb_comm.GetModuleInfo(module_file_spec, arch, module_spec)) {
-    if (log)
-      log->Printf("ProcessGDBRemote::%s - failed to get module info for %s:%s",
-                  __FUNCTION__, module_file_spec.GetPath().c_str(),
-                  arch.GetTriple().getTriple().c_str());
+    LLDB_LOGF(log, "ProcessGDBRemote::%s - failed to get module info for %s:%s",
+              __FUNCTION__, module_file_spec.GetPath().c_str(),
+              arch.GetTriple().getTriple().c_str());
     return false;
   }
 
   if (log) {
     StreamString stream;
     module_spec.Dump(stream);
-    log->Printf("ProcessGDBRemote::%s - got module info for (%s:%s) : %s",
-                __FUNCTION__, module_file_spec.GetPath().c_str(),
-                arch.GetTriple().getTriple().c_str(), stream.GetData());
+    LLDB_LOGF(log, "ProcessGDBRemote::%s - got module info for (%s:%s) : %s",
+              __FUNCTION__, module_file_spec.GetPath().c_str(),
+              arch.GetTriple().getTriple().c_str(), stream.GetData());
   }
 
   m_cached_module_specs[key] = module_spec;
@@ -4711,8 +4688,7 @@ Status ProcessGDBRemote::GetLoadedModule
     return Status(0, ErrorType::eErrorTypeGeneric);
 
   Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS);
-  if (log)
-    log->Printf("ProcessGDBRemote::%s", __FUNCTION__);
+  LLDB_LOGF(log, "ProcessGDBRemote::%s", __FUNCTION__);
 
   GDBRemoteCommunicationClient &comm = m_gdb_comm;
   bool can_use_svr4 = GetGlobalPluginProperties()->GetUseSVR4();
@@ -4730,8 +4706,7 @@ Status ProcessGDBRemote::GetLoadedModule
       return Status(0, ErrorType::eErrorTypeGeneric);
 
     // parse the xml file in memory
-    if (log)
-      log->Printf("parsing: %s", raw.c_str());
+    LLDB_LOGF(log, "parsing: %s", raw.c_str());
     XMLDocument doc;
 
     if (!doc.ParseMemory(raw.c_str(), raw.size(), "noname.xml"))
@@ -4791,10 +4766,11 @@ Status ProcessGDBRemote::GetLoadedModule
             module.get_base_is_offset(base_is_offset);
             module.get_dynamic(ld);
 
-            log->Printf("found (link_map:0x%08" PRIx64 ", base:0x%08" PRIx64
-                        "[%s], ld:0x%08" PRIx64 ", name:'%s')",
-                        lm, base, (base_is_offset ? "offset" : "absolute"), ld,
-                        name.c_str());
+            LLDB_LOGF(log,
+                      "found (link_map:0x%08" PRIx64 ", base:0x%08" PRIx64
+                      "[%s], ld:0x%08" PRIx64 ", name:'%s')",
+                      lm, base, (base_is_offset ? "offset" : "absolute"), ld,
+                      name.c_str());
           }
 
           list.add(module);
@@ -4802,9 +4778,8 @@ Status ProcessGDBRemote::GetLoadedModule
                        // node
         });
 
-    if (log)
-      log->Printf("found %" PRId32 " modules in total",
-                  (int)list.m_list.size());
+    LLDB_LOGF(log, "found %" PRId32 " modules in total",
+              (int)list.m_list.size());
   } else if (comm.GetQXferLibrariesReadSupported()) {
     list.clear();
 
@@ -4816,8 +4791,7 @@ Status ProcessGDBRemote::GetLoadedModule
                              lldberr))
       return Status(0, ErrorType::eErrorTypeGeneric);
 
-    if (log)
-      log->Printf("parsing: %s", raw.c_str());
+    LLDB_LOGF(log, "parsing: %s", raw.c_str());
     XMLDocument doc;
 
     if (!doc.ParseMemory(raw.c_str(), raw.size(), "noname.xml"))
@@ -4853,8 +4827,8 @@ Status ProcessGDBRemote::GetLoadedModule
             module.get_base(base);
             module.get_base_is_offset(base_is_offset);
 
-            log->Printf("found (base:0x%08" PRIx64 "[%s], name:'%s')", base,
-                        (base_is_offset ? "offset" : "absolute"), name.c_str());
+            LLDB_LOGF(log, "found (base:0x%08" PRIx64 "[%s], name:'%s')", base,
+                      (base_is_offset ? "offset" : "absolute"), name.c_str());
           }
 
           list.add(module);
@@ -4862,9 +4836,8 @@ Status ProcessGDBRemote::GetLoadedModule
                        // node
         });
 
-    if (log)
-      log->Printf("found %" PRId32 " modules in total",
-                  (int)list.m_list.size());
+    LLDB_LOGF(log, "found %" PRId32 " modules in total",
+              (int)list.m_list.size());
   } else {
     return Status(0, ErrorType::eErrorTypeGeneric);
   }
@@ -5149,7 +5122,8 @@ ParseStructuredDataPacket(llvm::StringRe
 
   if (!packet.consume_front(s_async_json_packet_prefix)) {
     if (log) {
-      log->Printf(
+      LLDB_LOGF(
+          log,
           "GDBRemoteCommunicationClientBase::%s() received $J packet "
           "but was not a StructuredData packet: packet starts with "
           "%s",
@@ -5166,14 +5140,16 @@ ParseStructuredDataPacket(llvm::StringRe
       StreamString json_str;
       json_sp->Dump(json_str);
       json_str.Flush();
-      log->Printf("ProcessGDBRemote::%s() "
-                  "received Async StructuredData packet: %s",
-                  __FUNCTION__, json_str.GetData());
+      LLDB_LOGF(log,
+                "ProcessGDBRemote::%s() "
+                "received Async StructuredData packet: %s",
+                __FUNCTION__, json_str.GetData());
     } else {
-      log->Printf("ProcessGDBRemote::%s"
-                  "() received StructuredData packet:"
-                  " parse failure",
-                  __FUNCTION__);
+      LLDB_LOGF(log,
+                "ProcessGDBRemote::%s"
+                "() received StructuredData packet:"
+                " parse failure",
+                __FUNCTION__);
     }
   }
   return json_sp;

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Wed Jul 24 10:56:10 2019
@@ -215,8 +215,7 @@ StructuredData::ObjectSP ThreadGDBRemote
   StructuredData::ObjectSP object_sp;
   const lldb::user_id_t tid = GetProtocolID();
   Log *log(GetLogIfAnyCategoriesSet(GDBR_LOG_THREAD));
-  if (log)
-    log->Printf("Fetching extended information for thread %4.4" PRIx64, tid);
+  LLDB_LOGF(log, "Fetching extended information for thread %4.4" PRIx64, tid);
   ProcessSP process_sp(GetProcess());
   if (process_sp) {
     ProcessGDBRemote *gdb_process =
@@ -230,9 +229,8 @@ void ThreadGDBRemote::WillResume(StateTy
   int signo = GetResumeSignal();
   const lldb::user_id_t tid = GetProtocolID();
   Log *log(GetLogIfAnyCategoriesSet(GDBR_LOG_THREAD));
-  if (log)
-    log->Printf("Resuming thread: %4.4" PRIx64 " with state: %s.", tid,
-                StateAsCString(resume_state));
+  LLDB_LOGF(log, "Resuming thread: %4.4" PRIx64 " with state: %s.", tid,
+            StateAsCString(resume_state));
 
   ProcessSP process_sp(GetProcess());
   if (process_sp) {

Modified: lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp Wed Jul 24 10:56:10 2019
@@ -160,10 +160,10 @@ bool ProcessMachCore::GetDynamicLoaderAd
     case llvm::MachO::MH_DYLINKER:
       // printf("0x%16.16" PRIx64 ": file_type = MH_DYLINKER\n", vaddr);
       // Address of dyld "struct mach_header" in the core file
-      if (log)
-        log->Printf("ProcessMachCore::GetDynamicLoaderAddress found a user "
-                    "process dyld binary image at 0x%" PRIx64,
-                    addr);
+      LLDB_LOGF(log,
+                "ProcessMachCore::GetDynamicLoaderAddress found a user "
+                "process dyld binary image at 0x%" PRIx64,
+                addr);
       m_dyld_addr = addr;
       return true;
 
@@ -172,10 +172,10 @@ bool ProcessMachCore::GetDynamicLoaderAd
       // Check MH_EXECUTABLE file types to see if the dynamic link object flag
       // is NOT set. If it isn't, then we have a mach_kernel.
       if ((header.flags & llvm::MachO::MH_DYLDLINK) == 0) {
-        if (log)
-          log->Printf("ProcessMachCore::GetDynamicLoaderAddress found a mach "
-                      "kernel binary image at 0x%" PRIx64,
-                      addr);
+        LLDB_LOGF(log,
+                  "ProcessMachCore::GetDynamicLoaderAddress found a mach "
+                  "kernel binary image at 0x%" PRIx64,
+                  addr);
         // Address of the mach kernel "struct mach_header" in the core file.
         m_mach_kernel_addr = addr;
         return true;
@@ -286,9 +286,10 @@ Status ProcessMachCore::DoLoadCore() {
     {
         m_mach_kernel_addr = objfile_binary_addr;
         found_main_binary_definitively = true;
-        if (log)
-            log->Printf ("ProcessMachCore::DoLoadCore: using kernel address 0x%" PRIx64
-                         " from LC_NOTE 'main bin spec' load command.", m_mach_kernel_addr);
+        LLDB_LOGF(log,
+                  "ProcessMachCore::DoLoadCore: using kernel address 0x%" PRIx64
+                  " from LC_NOTE 'main bin spec' load command.",
+                  m_mach_kernel_addr);
     }
   }
   
@@ -317,11 +318,11 @@ Status ProcessMachCore::DoLoadCore() {
     if (uuid.IsValid() && addr != LLDB_INVALID_ADDRESS) {
       m_mach_kernel_addr = addr;
       found_main_binary_definitively = true;
-      if (log)
-        log->Printf(
-            "ProcessMachCore::DoLoadCore: Using the kernel address 0x%" PRIx64
-            " from LC_IDENT/LC_NOTE 'kern ver str' string: '%s'",
-            addr, corefile_identifier.c_str());
+      LLDB_LOGF(
+          log,
+          "ProcessMachCore::DoLoadCore: Using the kernel address 0x%" PRIx64
+          " from LC_IDENT/LC_NOTE 'kern ver str' string: '%s'",
+          addr, corefile_identifier.c_str());
     }
   }
   if (found_main_binary_definitively == false 
@@ -333,10 +334,10 @@ Status ProcessMachCore::DoLoadCore() {
           uuid.SetFromStringRef(uuid_str);
       }
       if (uuid.IsValid()) {
-        if (log)
-          log->Printf("ProcessMachCore::DoLoadCore: Using the EFI "
-                      "from LC_IDENT/LC_NOTE 'kern ver str' string: '%s'", 
-                      corefile_identifier.c_str());
+        LLDB_LOGF(log,
+                  "ProcessMachCore::DoLoadCore: Using the EFI "
+                  "from LC_IDENT/LC_NOTE 'kern ver str' string: '%s'",
+                  corefile_identifier.c_str());
 
         // We're only given a UUID here, not a load address.
         // But there are python scripts in the EFI binary's dSYM which
@@ -432,9 +433,8 @@ Status ProcessMachCore::DoLoadCore() {
     m_dyld_addr = saved_user_dyld_addr;
 
     if (better_kernel_address != LLDB_INVALID_ADDRESS) {
-      if (log)
-        log->Printf("ProcessMachCore::DoLoadCore: Using the kernel address "
-                    "from DynamicLoaderDarwinKernel");
+      LLDB_LOGF(log, "ProcessMachCore::DoLoadCore: Using the kernel address "
+                     "from DynamicLoaderDarwinKernel");
       m_mach_kernel_addr = better_kernel_address;
     }
   }
@@ -443,30 +443,30 @@ Status ProcessMachCore::DoLoadCore() {
   // decide which to prefer.
   if (GetCorefilePreference() == eKernelCorefile) {
     if (m_mach_kernel_addr != LLDB_INVALID_ADDRESS) {
-      if (log)
-        log->Printf("ProcessMachCore::DoLoadCore: Using kernel corefile image "
-                    "at 0x%" PRIx64,
-                    m_mach_kernel_addr);
+      LLDB_LOGF(log,
+                "ProcessMachCore::DoLoadCore: Using kernel corefile image "
+                "at 0x%" PRIx64,
+                m_mach_kernel_addr);
       m_dyld_plugin_name = DynamicLoaderDarwinKernel::GetPluginNameStatic();
     } else if (m_dyld_addr != LLDB_INVALID_ADDRESS) {
-      if (log)
-        log->Printf("ProcessMachCore::DoLoadCore: Using user process dyld "
-                    "image at 0x%" PRIx64,
-                    m_dyld_addr);
+      LLDB_LOGF(log,
+                "ProcessMachCore::DoLoadCore: Using user process dyld "
+                "image at 0x%" PRIx64,
+                m_dyld_addr);
       m_dyld_plugin_name = DynamicLoaderMacOSXDYLD::GetPluginNameStatic();
     }
   } else {
     if (m_dyld_addr != LLDB_INVALID_ADDRESS) {
-      if (log)
-        log->Printf("ProcessMachCore::DoLoadCore: Using user process dyld "
-                    "image at 0x%" PRIx64,
-                    m_dyld_addr);
+      LLDB_LOGF(log,
+                "ProcessMachCore::DoLoadCore: Using user process dyld "
+                "image at 0x%" PRIx64,
+                m_dyld_addr);
       m_dyld_plugin_name = DynamicLoaderMacOSXDYLD::GetPluginNameStatic();
     } else if (m_mach_kernel_addr != LLDB_INVALID_ADDRESS) {
-      if (log)
-        log->Printf("ProcessMachCore::DoLoadCore: Using kernel corefile image "
-                    "at 0x%" PRIx64,
-                    m_mach_kernel_addr);
+      LLDB_LOGF(log,
+                "ProcessMachCore::DoLoadCore: Using kernel corefile image "
+                "at 0x%" PRIx64,
+                m_mach_kernel_addr);
       m_dyld_plugin_name = DynamicLoaderDarwinKernel::GetPluginNameStatic();
     }
   }

Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp Wed Jul 24 10:56:10 2019
@@ -688,19 +688,18 @@ bool ScriptInterpreterPythonImpl::EnterS
   // it, then there is no need to 'enter' it again.
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT));
   if (m_session_is_active) {
-    if (log)
-      log->Printf(
-          "ScriptInterpreterPythonImpl::EnterSession(on_entry_flags=0x%" PRIx16
-          ") session is already active, returning without doing anything",
-          on_entry_flags);
+    LLDB_LOGF(
+        log,
+        "ScriptInterpreterPythonImpl::EnterSession(on_entry_flags=0x%" PRIx16
+        ") session is already active, returning without doing anything",
+        on_entry_flags);
     return false;
   }
 
-  if (log)
-    log->Printf(
-        "ScriptInterpreterPythonImpl::EnterSession(on_entry_flags=0x%" PRIx16
-        ")",
-        on_entry_flags);
+  LLDB_LOGF(
+      log,
+      "ScriptInterpreterPythonImpl::EnterSession(on_entry_flags=0x%" PRIx16 ")",
+      on_entry_flags);
 
   m_session_is_active = true;
 
@@ -1040,17 +1039,16 @@ bool ScriptInterpreterPythonImpl::Interr
       long tid = state->thread_id;
       PyThreadState_Swap(state);
       int num_threads = PyThreadState_SetAsyncExc(tid, PyExc_KeyboardInterrupt);
-      if (log)
-        log->Printf("ScriptInterpreterPythonImpl::Interrupt() sending "
-                    "PyExc_KeyboardInterrupt (tid = %li, num_threads = %i)...",
-                    tid, num_threads);
+      LLDB_LOGF(log,
+                "ScriptInterpreterPythonImpl::Interrupt() sending "
+                "PyExc_KeyboardInterrupt (tid = %li, num_threads = %i)...",
+                tid, num_threads);
       return true;
     }
   }
-  if (log)
-    log->Printf(
-        "ScriptInterpreterPythonImpl::Interrupt() python code not running, "
-        "can't interrupt");
+  LLDB_LOGF(log,
+            "ScriptInterpreterPythonImpl::Interrupt() python code not running, "
+            "can't interrupt");
   return false;
 }
 bool ScriptInterpreterPythonImpl::ExecuteOneLineWithReturn(

Modified: lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp (original)
+++ lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp Wed Jul 24 10:56:10 2019
@@ -1119,26 +1119,26 @@ void StructuredDataDarwinLog::HandleArri
       object_sp->Dump(json_stream);
     else
       json_stream.PutCString("<null>");
-    log->Printf("StructuredDataDarwinLog::%s() called with json: %s",
-                __FUNCTION__, json_stream.GetData());
+    LLDB_LOGF(log, "StructuredDataDarwinLog::%s() called with json: %s",
+              __FUNCTION__, json_stream.GetData());
   }
 
   // Ignore empty structured data.
   if (!object_sp) {
-    if (log)
-      log->Printf("StructuredDataDarwinLog::%s() StructuredData object "
-                  "is null",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "StructuredDataDarwinLog::%s() StructuredData object "
+              "is null",
+              __FUNCTION__);
     return;
   }
 
   // Ignore any data that isn't for us.
   if (type_name != GetDarwinLogTypeName()) {
-    if (log)
-      log->Printf("StructuredDataDarwinLog::%s() StructuredData type "
-                  "expected to be %s but was %s, ignoring",
-                  __FUNCTION__, GetDarwinLogTypeName().AsCString(),
-                  type_name.AsCString());
+    LLDB_LOGF(log,
+              "StructuredDataDarwinLog::%s() StructuredData type "
+              "expected to be %s but was %s, ignoring",
+              __FUNCTION__, GetDarwinLogTypeName().AsCString(),
+              type_name.AsCString());
     return;
   }
 
@@ -1148,9 +1148,8 @@ void StructuredDataDarwinLog::HandleArri
   DebuggerSP debugger_sp = process.GetTarget().GetDebugger().shared_from_this();
   auto options_sp = GetGlobalEnableOptions(debugger_sp);
   if (options_sp && options_sp->GetBroadcastEvents()) {
-    if (log)
-      log->Printf("StructuredDataDarwinLog::%s() broadcasting event",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "StructuredDataDarwinLog::%s() broadcasting event",
+              __FUNCTION__);
     process.BroadcastStructuredData(object_sp, shared_from_this());
   }
 
@@ -1263,19 +1262,18 @@ void StructuredDataDarwinLog::SetEnabled
 void StructuredDataDarwinLog::ModulesDidLoad(Process &process,
                                              ModuleList &module_list) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("StructuredDataDarwinLog::%s called (process uid %u)",
-                __FUNCTION__, process.GetUniqueID());
+  LLDB_LOGF(log, "StructuredDataDarwinLog::%s called (process uid %u)",
+            __FUNCTION__, process.GetUniqueID());
 
   // Check if we should enable the darwin log support on startup/attach.
   if (!GetGlobalProperties()->GetEnableOnStartup() &&
       !s_is_explicitly_enabled) {
     // We're neither auto-enabled or explicitly enabled, so we shouldn't try to
     // enable here.
-    if (log)
-      log->Printf("StructuredDataDarwinLog::%s not applicable, we're not "
-                  "enabled (process uid %u)",
-                  __FUNCTION__, process.GetUniqueID());
+    LLDB_LOGF(log,
+              "StructuredDataDarwinLog::%s not applicable, we're not "
+              "enabled (process uid %u)",
+              __FUNCTION__, process.GetUniqueID());
     return;
   }
 
@@ -1283,10 +1281,10 @@ void StructuredDataDarwinLog::ModulesDid
   {
     std::lock_guard<std::mutex> locker(m_added_breakpoint_mutex);
     if (m_added_breakpoint) {
-      if (log)
-        log->Printf("StructuredDataDarwinLog::%s process uid %u's "
-                    "post-libtrace-init breakpoint is already set",
-                    __FUNCTION__, process.GetUniqueID());
+      LLDB_LOGF(log,
+                "StructuredDataDarwinLog::%s process uid %u's "
+                "post-libtrace-init breakpoint is already set",
+                __FUNCTION__, process.GetUniqueID());
       return;
     }
   }
@@ -1298,11 +1296,11 @@ void StructuredDataDarwinLog::ModulesDid
       GetGlobalProperties()->GetLoggingModuleName();
   if (!logging_module_cstr || (logging_module_cstr[0] == 0)) {
     // We need this.  Bail.
-    if (log)
-      log->Printf("StructuredDataDarwinLog::%s no logging module name "
-                  "specified, we don't know where to set a breakpoint "
-                  "(process uid %u)",
-                  __FUNCTION__, process.GetUniqueID());
+    LLDB_LOGF(log,
+              "StructuredDataDarwinLog::%s no logging module name "
+              "specified, we don't know where to set a breakpoint "
+              "(process uid %u)",
+              __FUNCTION__, process.GetUniqueID());
     return;
   }
 
@@ -1324,23 +1322,23 @@ void StructuredDataDarwinLog::ModulesDid
   }
 
   if (!found_logging_support_module) {
-    if (log)
-      log->Printf("StructuredDataDarwinLog::%s logging module %s "
-                  "has not yet been loaded, can't set a breakpoint "
-                  "yet (process uid %u)",
-                  __FUNCTION__, logging_module_name.AsCString(),
-                  process.GetUniqueID());
+    LLDB_LOGF(log,
+              "StructuredDataDarwinLog::%s logging module %s "
+              "has not yet been loaded, can't set a breakpoint "
+              "yet (process uid %u)",
+              __FUNCTION__, logging_module_name.AsCString(),
+              process.GetUniqueID());
     return;
   }
 
   // Time to enqueue the breakpoint so we can wait for logging support to be
   // initialized before we try to tap the libtrace stream.
   AddInitCompletionHook(process);
-  if (log)
-    log->Printf("StructuredDataDarwinLog::%s post-init hook breakpoint "
-                "set for logging module %s (process uid %u)",
-                __FUNCTION__, logging_module_name.AsCString(),
-                process.GetUniqueID());
+  LLDB_LOGF(log,
+            "StructuredDataDarwinLog::%s post-init hook breakpoint "
+            "set for logging module %s (process uid %u)",
+            __FUNCTION__, logging_module_name.AsCString(),
+            process.GetUniqueID());
 
   // We need to try the enable here as well, which will succeed in the event
   // that we're attaching to (rather than launching) the process and the
@@ -1519,38 +1517,36 @@ bool StructuredDataDarwinLog::InitComple
   // we can execute our logic to enable the logging support.
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("StructuredDataDarwinLog::%s() called", __FUNCTION__);
+  LLDB_LOGF(log, "StructuredDataDarwinLog::%s() called", __FUNCTION__);
 
   // Get the current thread.
   if (!context) {
-    if (log)
-      log->Printf("StructuredDataDarwinLog::%s() warning: no context, "
-                  "ignoring",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "StructuredDataDarwinLog::%s() warning: no context, "
+              "ignoring",
+              __FUNCTION__);
     return false;
   }
 
   // Get the plugin from the process.
   auto process_sp = context->exe_ctx_ref.GetProcessSP();
   if (!process_sp) {
-    if (log)
-      log->Printf("StructuredDataDarwinLog::%s() warning: invalid "
-                  "process in context, ignoring",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "StructuredDataDarwinLog::%s() warning: invalid "
+              "process in context, ignoring",
+              __FUNCTION__);
     return false;
   }
-  if (log)
-    log->Printf("StructuredDataDarwinLog::%s() call is for process uid %d",
-                __FUNCTION__, process_sp->GetUniqueID());
+  LLDB_LOGF(log, "StructuredDataDarwinLog::%s() call is for process uid %d",
+            __FUNCTION__, process_sp->GetUniqueID());
 
   auto plugin_sp = process_sp->GetStructuredDataPlugin(GetDarwinLogTypeName());
   if (!plugin_sp) {
-    if (log)
-      log->Printf("StructuredDataDarwinLog::%s() warning: no plugin for "
-                  "feature %s in process uid %u",
-                  __FUNCTION__, GetDarwinLogTypeName().AsCString(),
-                  process_sp->GetUniqueID());
+    LLDB_LOGF(log,
+              "StructuredDataDarwinLog::%s() warning: no plugin for "
+              "feature %s in process uid %u",
+              __FUNCTION__, GetDarwinLogTypeName().AsCString(),
+              process_sp->GetUniqueID());
     return false;
   }
 
@@ -1561,51 +1557,51 @@ bool StructuredDataDarwinLog::InitComple
   std::weak_ptr<StructuredDataPlugin> plugin_wp(plugin_sp);
   ThreadPlanCallOnFunctionExit::Callback callback =
       [plugin_wp, &called_enable_method, log, process_uid]() {
-        if (log)
-          log->Printf("StructuredDataDarwinLog::post-init callback: "
-                      "called (process uid %u)",
-                      process_uid);
+        LLDB_LOGF(log,
+                  "StructuredDataDarwinLog::post-init callback: "
+                  "called (process uid %u)",
+                  process_uid);
 
         auto strong_plugin_sp = plugin_wp.lock();
         if (!strong_plugin_sp) {
-          if (log)
-            log->Printf("StructuredDataDarwinLog::post-init callback: "
-                        "plugin no longer exists, ignoring (process "
-                        "uid %u)",
-                        process_uid);
+          LLDB_LOGF(log,
+                    "StructuredDataDarwinLog::post-init callback: "
+                    "plugin no longer exists, ignoring (process "
+                    "uid %u)",
+                    process_uid);
           return;
         }
         // Make sure we only call it once, just in case the thread plan hits
         // the breakpoint twice.
         if (!called_enable_method) {
-          if (log)
-            log->Printf("StructuredDataDarwinLog::post-init callback: "
-                        "calling EnableNow() (process uid %u)",
-                        process_uid);
+          LLDB_LOGF(log,
+                    "StructuredDataDarwinLog::post-init callback: "
+                    "calling EnableNow() (process uid %u)",
+                    process_uid);
           static_cast<StructuredDataDarwinLog *>(strong_plugin_sp.get())
               ->EnableNow();
           called_enable_method = true;
         } else {
           // Our breakpoint was hit more than once.  Unexpected but no harm
           // done.  Log it.
-          if (log)
-            log->Printf("StructuredDataDarwinLog::post-init callback: "
-                        "skipping EnableNow(), already called by "
-                        "callback [we hit this more than once] "
-                        "(process uid %u)",
-                        process_uid);
+          LLDB_LOGF(log,
+                    "StructuredDataDarwinLog::post-init callback: "
+                    "skipping EnableNow(), already called by "
+                    "callback [we hit this more than once] "
+                    "(process uid %u)",
+                    process_uid);
         }
       };
 
   // Grab the current thread.
   auto thread_sp = context->exe_ctx_ref.GetThreadSP();
   if (!thread_sp) {
-    if (log)
-      log->Printf("StructuredDataDarwinLog::%s() warning: failed to "
-                  "retrieve the current thread from the execution "
-                  "context, nowhere to run the thread plan (process uid "
-                  "%u)",
-                  __FUNCTION__, process_sp->GetUniqueID());
+    LLDB_LOGF(log,
+              "StructuredDataDarwinLog::%s() warning: failed to "
+              "retrieve the current thread from the execution "
+              "context, nowhere to run the thread plan (process uid "
+              "%u)",
+              __FUNCTION__, process_sp->GetUniqueID());
     return false;
   }
 
@@ -1614,10 +1610,10 @@ bool StructuredDataDarwinLog::InitComple
       ThreadPlanSP(new ThreadPlanCallOnFunctionExit(*thread_sp, callback));
   const bool abort_other_plans = false;
   thread_sp->QueueThreadPlan(thread_plan_sp, abort_other_plans);
-  if (log)
-    log->Printf("StructuredDataDarwinLog::%s() queuing thread plan on "
-                "trace library init method entry (process uid %u)",
-                __FUNCTION__, process_sp->GetUniqueID());
+  LLDB_LOGF(log,
+            "StructuredDataDarwinLog::%s() queuing thread plan on "
+            "trace library init method entry (process uid %u)",
+            __FUNCTION__, process_sp->GetUniqueID());
 
   // We return false here to indicate that it isn't a public stop.
   return false;
@@ -1625,18 +1621,17 @@ bool StructuredDataDarwinLog::InitComple
 
 void StructuredDataDarwinLog::AddInitCompletionHook(Process &process) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("StructuredDataDarwinLog::%s() called (process uid %u)",
-                __FUNCTION__, process.GetUniqueID());
+  LLDB_LOGF(log, "StructuredDataDarwinLog::%s() called (process uid %u)",
+            __FUNCTION__, process.GetUniqueID());
 
   // Make sure we haven't already done this.
   {
     std::lock_guard<std::mutex> locker(m_added_breakpoint_mutex);
     if (m_added_breakpoint) {
-      if (log)
-        log->Printf("StructuredDataDarwinLog::%s() ignoring request, "
-                    "breakpoint already set (process uid %u)",
-                    __FUNCTION__, process.GetUniqueID());
+      LLDB_LOGF(log,
+                "StructuredDataDarwinLog::%s() ignoring request, "
+                "breakpoint already set (process uid %u)",
+                __FUNCTION__, process.GetUniqueID());
       return;
     }
 
@@ -1669,22 +1664,22 @@ void StructuredDataDarwinLog::AddInitCom
       eLanguageTypeC, offset, skip_prologue, internal, hardware);
   if (!breakpoint_sp) {
     // Huh?  Bail here.
-    if (log)
-      log->Printf("StructuredDataDarwinLog::%s() failed to set "
-                  "breakpoint in module %s, function %s (process uid %u)",
-                  __FUNCTION__, GetGlobalProperties()->GetLoggingModuleName(),
-                  func_name, process.GetUniqueID());
+    LLDB_LOGF(log,
+              "StructuredDataDarwinLog::%s() failed to set "
+              "breakpoint in module %s, function %s (process uid %u)",
+              __FUNCTION__, GetGlobalProperties()->GetLoggingModuleName(),
+              func_name, process.GetUniqueID());
     return;
   }
 
   // Set our callback.
   breakpoint_sp->SetCallback(InitCompletionHookCallback, nullptr);
   m_breakpoint_id = breakpoint_sp->GetID();
-  if (log)
-    log->Printf("StructuredDataDarwinLog::%s() breakpoint set in module %s,"
-                "function %s (process uid %u)",
-                __FUNCTION__, GetGlobalProperties()->GetLoggingModuleName(),
-                func_name, process.GetUniqueID());
+  LLDB_LOGF(log,
+            "StructuredDataDarwinLog::%s() breakpoint set in module %s,"
+            "function %s (process uid %u)",
+            __FUNCTION__, GetGlobalProperties()->GetLoggingModuleName(),
+            func_name, process.GetUniqueID());
 }
 
 void StructuredDataDarwinLog::DumpTimestamp(Stream &stream,
@@ -1825,22 +1820,20 @@ size_t StructuredDataDarwinLog::HandleDi
 
 void StructuredDataDarwinLog::EnableNow() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("StructuredDataDarwinLog::%s() called", __FUNCTION__);
+  LLDB_LOGF(log, "StructuredDataDarwinLog::%s() called", __FUNCTION__);
 
   // Run the enable command.
   auto process_sp = GetProcess();
   if (!process_sp) {
     // Nothing to do.
-    if (log)
-      log->Printf("StructuredDataDarwinLog::%s() warning: failed to get "
-                  "valid process, skipping",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "StructuredDataDarwinLog::%s() warning: failed to get "
+              "valid process, skipping",
+              __FUNCTION__);
     return;
   }
-  if (log)
-    log->Printf("StructuredDataDarwinLog::%s() call is for process uid %u",
-                __FUNCTION__, process_sp->GetUniqueID());
+  LLDB_LOGF(log, "StructuredDataDarwinLog::%s() call is for process uid %u",
+            __FUNCTION__, process_sp->GetUniqueID());
 
   // If we have configuration data, we can directly enable it now. Otherwise,
   // we need to run through the command interpreter to parse the auto-run
@@ -1849,10 +1842,10 @@ void StructuredDataDarwinLog::EnableNow(
   DebuggerSP debugger_sp =
       process_sp->GetTarget().GetDebugger().shared_from_this();
   if (!debugger_sp) {
-    if (log)
-      log->Printf("StructuredDataDarwinLog::%s() warning: failed to get "
-                  "debugger shared pointer, skipping (process uid %u)",
-                  __FUNCTION__, process_sp->GetUniqueID());
+    LLDB_LOGF(log,
+              "StructuredDataDarwinLog::%s() warning: failed to get "
+              "debugger shared pointer, skipping (process uid %u)",
+              __FUNCTION__, process_sp->GetUniqueID());
     return;
   }
 
@@ -1864,13 +1857,15 @@ void StructuredDataDarwinLog::EnableNow(
     const bool success = RunEnableCommand(interpreter);
     if (log) {
       if (success)
-        log->Printf("StructuredDataDarwinLog::%s() ran enable command "
-                    "successfully for (process uid %u)",
-                    __FUNCTION__, process_sp->GetUniqueID());
+        LLDB_LOGF(log,
+                  "StructuredDataDarwinLog::%s() ran enable command "
+                  "successfully for (process uid %u)",
+                  __FUNCTION__, process_sp->GetUniqueID());
       else
-        log->Printf("StructuredDataDarwinLog::%s() error: running "
-                    "enable command failed (process uid %u)",
-                    __FUNCTION__, process_sp->GetUniqueID());
+        LLDB_LOGF(log,
+                  "StructuredDataDarwinLog::%s() error: running "
+                  "enable command failed (process uid %u)",
+                  __FUNCTION__, process_sp->GetUniqueID());
     }
     // Report failures to the debugger error stream.
     auto error_stream_sp = debugger_sp->GetAsyncErrorStream();
@@ -1886,11 +1881,11 @@ void StructuredDataDarwinLog::EnableNow(
   // specified options.
   auto config_sp = options_sp->BuildConfigurationData(true);
   if (!config_sp) {
-    if (log)
-      log->Printf("StructuredDataDarwinLog::%s() warning: failed to "
-                  "build configuration data for enable options, skipping "
-                  "(process uid %u)",
-                  __FUNCTION__, process_sp->GetUniqueID());
+    LLDB_LOGF(log,
+              "StructuredDataDarwinLog::%s() warning: failed to "
+              "build configuration data for enable options, skipping "
+              "(process uid %u)",
+              __FUNCTION__, process_sp->GetUniqueID());
     return;
   }
 
@@ -1901,11 +1896,11 @@ void StructuredDataDarwinLog::EnableNow(
 
   // Report results.
   if (!error.Success()) {
-    if (log)
-      log->Printf("StructuredDataDarwinLog::%s() "
-                  "ConfigureStructuredData() call failed "
-                  "(process uid %u): %s",
-                  __FUNCTION__, process_sp->GetUniqueID(), error.AsCString());
+    LLDB_LOGF(log,
+              "StructuredDataDarwinLog::%s() "
+              "ConfigureStructuredData() call failed "
+              "(process uid %u): %s",
+              __FUNCTION__, process_sp->GetUniqueID(), error.AsCString());
     auto error_stream_sp = debugger_sp->GetAsyncErrorStream();
     if (error_stream_sp) {
       error_stream_sp->Printf("failed to configure DarwinLog "
@@ -1916,9 +1911,9 @@ void StructuredDataDarwinLog::EnableNow(
     m_is_enabled = false;
   } else {
     m_is_enabled = true;
-    if (log)
-      log->Printf("StructuredDataDarwinLog::%s() success via direct "
-                  "configuration (process uid %u)",
-                  __FUNCTION__, process_sp->GetUniqueID());
+    LLDB_LOGF(log,
+              "StructuredDataDarwinLog::%s() success via direct "
+              "configuration (process uid %u)",
+              __FUNCTION__, process_sp->GetUniqueID());
   }
 }

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Wed Jul 24 10:56:10 2019
@@ -1407,12 +1407,11 @@ TypeSP DWARFASTParserClang::ParseTypeFro
                         if (!object_pointer_name.empty()) {
                           metadata.SetObjectPtrName(
                               object_pointer_name.c_str());
-                          if (log)
-                            log->Printf(
-                                "Setting object pointer name: %s on method "
-                                "object %p.\n",
-                                object_pointer_name.c_str(),
-                                static_cast<void *>(cxx_method_decl));
+                          LLDB_LOGF(log,
+                                    "Setting object pointer name: %s on method "
+                                    "object %p.\n",
+                                    object_pointer_name.c_str(),
+                                    static_cast<void *>(cxx_method_decl));
                         }
                         m_ast.SetMetadata(cxx_method_decl, metadata);
                       } else {
@@ -1520,11 +1519,11 @@ TypeSP DWARFASTParserClang::ParseTypeFro
 
             if (!object_pointer_name.empty()) {
               metadata.SetObjectPtrName(object_pointer_name.c_str());
-              if (log)
-                log->Printf("Setting object pointer name: %s on function "
-                            "object %p.",
-                            object_pointer_name.c_str(),
-                            static_cast<void *>(function_decl));
+              LLDB_LOGF(log,
+                        "Setting object pointer name: %s on function "
+                        "object %p.",
+                        object_pointer_name.c_str(),
+                        static_cast<void *>(function_decl));
             }
             m_ast.SetMetadata(function_decl, metadata);
           }
@@ -3672,11 +3671,11 @@ bool DWARFASTParserClang::CopyUniqueClas
 
   if (src_size != dst_size) {
     if (src_size != 0 && dst_size != 0) {
-      if (log)
-        log->Printf("warning: trying to unique class DIE 0x%8.8x to 0x%8.8x, "
-                    "but they didn't have the same size (src=%d, dst=%d)",
-                    src_class_die.GetOffset(), dst_class_die.GetOffset(),
-                    src_size, dst_size);
+      LLDB_LOGF(log,
+                "warning: trying to unique class DIE 0x%8.8x to 0x%8.8x, "
+                "but they didn't have the same size (src=%d, dst=%d)",
+                src_class_die.GetOffset(), dst_class_die.GetOffset(), src_size,
+                dst_size);
     }
 
     fast_path = false;
@@ -3690,12 +3689,12 @@ bool DWARFASTParserClang::CopyUniqueClas
       dst_die = dst_name_to_die.GetValueAtIndexUnchecked(idx);
 
       if (src_die.Tag() != dst_die.Tag()) {
-        if (log)
-          log->Printf("warning: tried to unique class DIE 0x%8.8x to 0x%8.8x, "
-                      "but 0x%8.8x (%s) tags didn't match 0x%8.8x (%s)",
-                      src_class_die.GetOffset(), dst_class_die.GetOffset(),
-                      src_die.GetOffset(), src_die.GetTagAsCString(),
-                      dst_die.GetOffset(), dst_die.GetTagAsCString());
+        LLDB_LOGF(log,
+                  "warning: tried to unique class DIE 0x%8.8x to 0x%8.8x, "
+                  "but 0x%8.8x (%s) tags didn't match 0x%8.8x (%s)",
+                  src_class_die.GetOffset(), dst_class_die.GetOffset(),
+                  src_die.GetOffset(), src_die.GetTagAsCString(),
+                  dst_die.GetOffset(), dst_die.GetTagAsCString());
         fast_path = false;
       }
 
@@ -3706,12 +3705,11 @@ bool DWARFASTParserClang::CopyUniqueClas
       if (src_name == dst_name || (strcmp(src_name, dst_name) == 0))
         continue;
 
-      if (log)
-        log->Printf("warning: tried to unique class DIE 0x%8.8x to 0x%8.8x, "
-                    "but 0x%8.8x (%s) names didn't match 0x%8.8x (%s)",
-                    src_class_die.GetOffset(), dst_class_die.GetOffset(),
-                    src_die.GetOffset(), src_name, dst_die.GetOffset(),
-                    dst_name);
+      LLDB_LOGF(log,
+                "warning: tried to unique class DIE 0x%8.8x to 0x%8.8x, "
+                "but 0x%8.8x (%s) names didn't match 0x%8.8x (%s)",
+                src_class_die.GetOffset(), dst_class_die.GetOffset(),
+                src_die.GetOffset(), src_name, dst_die.GetOffset(), dst_name);
 
       fast_path = false;
     }
@@ -3733,32 +3731,31 @@ bool DWARFASTParserClang::CopyUniqueClas
       clang::DeclContext *src_decl_ctx =
           src_dwarf_ast_parser->m_die_to_decl_ctx[src_die.GetDIE()];
       if (src_decl_ctx) {
-        if (log)
-          log->Printf("uniquing decl context %p from 0x%8.8x for 0x%8.8x",
-                      static_cast<void *>(src_decl_ctx), src_die.GetOffset(),
-                      dst_die.GetOffset());
+        LLDB_LOGF(log, "uniquing decl context %p from 0x%8.8x for 0x%8.8x",
+                  static_cast<void *>(src_decl_ctx), src_die.GetOffset(),
+                  dst_die.GetOffset());
         dst_dwarf_ast_parser->LinkDeclContextToDIE(src_decl_ctx, dst_die);
       } else {
-        if (log)
-          log->Printf("warning: tried to unique decl context from 0x%8.8x for "
-                      "0x%8.8x, but none was found",
-                      src_die.GetOffset(), dst_die.GetOffset());
+        LLDB_LOGF(log,
+                  "warning: tried to unique decl context from 0x%8.8x for "
+                  "0x%8.8x, but none was found",
+                  src_die.GetOffset(), dst_die.GetOffset());
       }
 
       Type *src_child_type =
           dst_die.GetDWARF()->GetDIEToType()[src_die.GetDIE()];
       if (src_child_type) {
-        if (log)
-          log->Printf(
-              "uniquing type %p (uid=0x%" PRIx64 ") from 0x%8.8x for 0x%8.8x",
-              static_cast<void *>(src_child_type), src_child_type->GetID(),
-              src_die.GetOffset(), dst_die.GetOffset());
+        LLDB_LOGF(log,
+                  "uniquing type %p (uid=0x%" PRIx64
+                  ") from 0x%8.8x for 0x%8.8x",
+                  static_cast<void *>(src_child_type), src_child_type->GetID(),
+                  src_die.GetOffset(), dst_die.GetOffset());
         dst_die.GetDWARF()->GetDIEToType()[dst_die.GetDIE()] = src_child_type;
       } else {
-        if (log)
-          log->Printf("warning: tried to unique lldb_private::Type from "
-                      "0x%8.8x for 0x%8.8x, but none was found",
-                      src_die.GetOffset(), dst_die.GetOffset());
+        LLDB_LOGF(log,
+                  "warning: tried to unique lldb_private::Type from "
+                  "0x%8.8x for 0x%8.8x, but none was found",
+                  src_die.GetOffset(), dst_die.GetOffset());
       }
     }
   } else {
@@ -3778,39 +3775,36 @@ bool DWARFASTParserClang::CopyUniqueClas
           clang::DeclContext *src_decl_ctx =
               src_dwarf_ast_parser->m_die_to_decl_ctx[src_die.GetDIE()];
           if (src_decl_ctx) {
-            if (log)
-              log->Printf("uniquing decl context %p from 0x%8.8x for 0x%8.8x",
-                          static_cast<void *>(src_decl_ctx),
-                          src_die.GetOffset(), dst_die.GetOffset());
+            LLDB_LOGF(log, "uniquing decl context %p from 0x%8.8x for 0x%8.8x",
+                      static_cast<void *>(src_decl_ctx), src_die.GetOffset(),
+                      dst_die.GetOffset());
             dst_dwarf_ast_parser->LinkDeclContextToDIE(src_decl_ctx, dst_die);
           } else {
-            if (log)
-              log->Printf("warning: tried to unique decl context from 0x%8.8x "
-                          "for 0x%8.8x, but none was found",
-                          src_die.GetOffset(), dst_die.GetOffset());
+            LLDB_LOGF(log,
+                      "warning: tried to unique decl context from 0x%8.8x "
+                      "for 0x%8.8x, but none was found",
+                      src_die.GetOffset(), dst_die.GetOffset());
           }
 
           Type *src_child_type =
               dst_die.GetDWARF()->GetDIEToType()[src_die.GetDIE()];
           if (src_child_type) {
-            if (log)
-              log->Printf("uniquing type %p (uid=0x%" PRIx64
-                          ") from 0x%8.8x for 0x%8.8x",
-                          static_cast<void *>(src_child_type),
-                          src_child_type->GetID(), src_die.GetOffset(),
-                          dst_die.GetOffset());
+            LLDB_LOGF(
+                log,
+                "uniquing type %p (uid=0x%" PRIx64 ") from 0x%8.8x for 0x%8.8x",
+                static_cast<void *>(src_child_type), src_child_type->GetID(),
+                src_die.GetOffset(), dst_die.GetOffset());
             dst_die.GetDWARF()->GetDIEToType()[dst_die.GetDIE()] =
                 src_child_type;
           } else {
-            if (log)
-              log->Printf("warning: tried to unique lldb_private::Type from "
-                          "0x%8.8x for 0x%8.8x, but none was found",
-                          src_die.GetOffset(), dst_die.GetOffset());
+            LLDB_LOGF(log,
+                      "warning: tried to unique lldb_private::Type from "
+                      "0x%8.8x for 0x%8.8x, but none was found",
+                      src_die.GetOffset(), dst_die.GetOffset());
           }
         } else {
-          if (log)
-            log->Printf("warning: couldn't find a match for 0x%8.8x",
-                        dst_die.GetOffset());
+          LLDB_LOGF(log, "warning: couldn't find a match for 0x%8.8x",
+                    dst_die.GetOffset());
 
           failures.push_back(dst_die);
         }
@@ -3836,32 +3830,31 @@ bool DWARFASTParserClang::CopyUniqueClas
         clang::DeclContext *src_decl_ctx =
             src_dwarf_ast_parser->m_die_to_decl_ctx[src_die.GetDIE()];
         if (src_decl_ctx) {
-          if (log)
-            log->Printf("uniquing decl context %p from 0x%8.8x for 0x%8.8x",
-                        static_cast<void *>(src_decl_ctx), src_die.GetOffset(),
-                        dst_die.GetOffset());
+          LLDB_LOGF(log, "uniquing decl context %p from 0x%8.8x for 0x%8.8x",
+                    static_cast<void *>(src_decl_ctx), src_die.GetOffset(),
+                    dst_die.GetOffset());
           dst_dwarf_ast_parser->LinkDeclContextToDIE(src_decl_ctx, dst_die);
         } else {
-          if (log)
-            log->Printf("warning: tried to unique decl context from 0x%8.8x "
-                        "for 0x%8.8x, but none was found",
-                        src_die.GetOffset(), dst_die.GetOffset());
+          LLDB_LOGF(log,
+                    "warning: tried to unique decl context from 0x%8.8x "
+                    "for 0x%8.8x, but none was found",
+                    src_die.GetOffset(), dst_die.GetOffset());
         }
 
         Type *src_child_type =
             dst_die.GetDWARF()->GetDIEToType()[src_die.GetDIE()];
         if (src_child_type) {
-          if (log)
-            log->Printf(
-                "uniquing type %p (uid=0x%" PRIx64 ") from 0x%8.8x for 0x%8.8x",
-                static_cast<void *>(src_child_type), src_child_type->GetID(),
-                src_die.GetOffset(), dst_die.GetOffset());
+          LLDB_LOGF(
+              log,
+              "uniquing type %p (uid=0x%" PRIx64 ") from 0x%8.8x for 0x%8.8x",
+              static_cast<void *>(src_child_type), src_child_type->GetID(),
+              src_die.GetOffset(), dst_die.GetOffset());
           dst_die.GetDWARF()->GetDIEToType()[dst_die.GetDIE()] = src_child_type;
         } else {
-          if (log)
-            log->Printf("warning: tried to unique lldb_private::Type from "
-                        "0x%8.8x for 0x%8.8x, but none was found",
-                        src_die.GetOffset(), dst_die.GetOffset());
+          LLDB_LOGF(log,
+                    "warning: tried to unique lldb_private::Type from "
+                    "0x%8.8x for 0x%8.8x, but none was found",
+                    src_die.GetOffset(), dst_die.GetOffset());
         }
       }
     }
@@ -3872,10 +3865,10 @@ bool DWARFASTParserClang::CopyUniqueClas
       ConstString dst_name_artificial =
           dst_name_to_die_artificial.GetCStringAtIndex(idx);
       dst_die = dst_name_to_die_artificial.GetValueAtIndexUnchecked(idx);
-      if (log)
-        log->Printf("warning: need to create artificial method for 0x%8.8x for "
-                    "method '%s'",
-                    dst_die.GetOffset(), dst_name_artificial.GetCString());
+      LLDB_LOGF(log,
+                "warning: need to create artificial method for 0x%8.8x for "
+                "method '%s'",
+                dst_die.GetOffset(), dst_name_artificial.GetCString());
 
       failures.push_back(dst_die);
     }

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp Wed Jul 24 10:56:10 2019
@@ -66,8 +66,8 @@ void DWARFDebugAranges::Dump(Log *log) c
   for (size_t i = 0; i < num_entries; ++i) {
     const RangeToDIE::Entry *entry = m_aranges.GetEntryAtIndex(i);
     if (entry)
-      log->Printf("0x%8.8x: [0x%" PRIx64 " - 0x%" PRIx64 ")", entry->data,
-                  entry->GetRangeBase(), entry->GetRangeEnd());
+      LLDB_LOGF(log, "0x%8.8x: [0x%" PRIx64 " - 0x%" PRIx64 ")", entry->data,
+                entry->GetRangeBase(), entry->GetRangeEnd());
   }
 }
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp Wed Jul 24 10:56:10 2019
@@ -578,25 +578,25 @@ inline bool DWARFDebugLine::Prologue::Is
 void DWARFDebugLine::Prologue::Dump(Log *log) {
   uint32_t i;
 
-  log->Printf("Line table prologue:");
-  log->Printf("   total_length: 0x%8.8x", total_length);
-  log->Printf("        version: %u", version);
-  log->Printf("prologue_length: 0x%8.8x", prologue_length);
-  log->Printf("min_inst_length: %u", min_inst_length);
-  log->Printf("default_is_stmt: %u", default_is_stmt);
-  log->Printf("      line_base: %i", line_base);
-  log->Printf("     line_range: %u", line_range);
-  log->Printf("    opcode_base: %u", opcode_base);
+  LLDB_LOGF(log, "Line table prologue:");
+  LLDB_LOGF(log, "   total_length: 0x%8.8x", total_length);
+  LLDB_LOGF(log, "        version: %u", version);
+  LLDB_LOGF(log, "prologue_length: 0x%8.8x", prologue_length);
+  LLDB_LOGF(log, "min_inst_length: %u", min_inst_length);
+  LLDB_LOGF(log, "default_is_stmt: %u", default_is_stmt);
+  LLDB_LOGF(log, "      line_base: %i", line_base);
+  LLDB_LOGF(log, "     line_range: %u", line_range);
+  LLDB_LOGF(log, "    opcode_base: %u", opcode_base);
 
   for (i = 0; i < standard_opcode_lengths.size(); ++i) {
-    log->Printf("standard_opcode_lengths[%s] = %u", DW_LNS_value_to_name(i + 1),
-                standard_opcode_lengths[i]);
+    LLDB_LOGF(log, "standard_opcode_lengths[%s] = %u",
+              DW_LNS_value_to_name(i + 1), standard_opcode_lengths[i]);
   }
 
   if (!include_directories.empty()) {
     for (i = 0; i < include_directories.size(); ++i) {
-      log->Printf("include_directories[%3u] = '%s'", i + 1,
-                  include_directories[i]);
+      LLDB_LOGF(log, "include_directories[%3u] = '%s'", i + 1,
+                include_directories[i]);
     }
   }
 
@@ -606,9 +606,9 @@ void DWARFDebugLine::Prologue::Dump(Log
                     "---------------------------");
     for (i = 0; i < file_names.size(); ++i) {
       const FileNameEntry &fileEntry = file_names[i];
-      log->Printf("file_names[%3u] %4u 0x%8.8x 0x%8.8x %s", i + 1,
-                  fileEntry.dir_idx, fileEntry.mod_time, fileEntry.length,
-                  fileEntry.name);
+      LLDB_LOGF(log, "file_names[%3u] %4u 0x%8.8x 0x%8.8x %s", i + 1,
+                fileEntry.dir_idx, fileEntry.mod_time, fileEntry.length,
+                fileEntry.name);
     }
   }
 }
@@ -745,12 +745,12 @@ void DWARFDebugLine::Row::Reset(bool def
 }
 // DWARFDebugLine::Row::Dump
 void DWARFDebugLine::Row::Dump(Log *log) const {
-  log->Printf("0x%16.16" PRIx64 " %6u %6u %6u %3u %s%s%s%s%s", address, line,
-              column, file, isa, is_stmt ? " is_stmt" : "",
-              basic_block ? " basic_block" : "",
-              prologue_end ? " prologue_end" : "",
-              epilogue_begin ? " epilogue_begin" : "",
-              end_sequence ? " end_sequence" : "");
+  LLDB_LOGF(log, "0x%16.16" PRIx64 " %6u %6u %6u %3u %s%s%s%s%s", address, line,
+            column, file, isa, is_stmt ? " is_stmt" : "",
+            basic_block ? " basic_block" : "",
+            prologue_end ? " prologue_end" : "",
+            epilogue_begin ? " epilogue_begin" : "",
+            end_sequence ? " end_sequence" : "");
 }
 
 // Compare function LineTable structures

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Wed Jul 24 10:56:10 2019
@@ -60,11 +60,11 @@ SymbolFileDWARFDebugMap::CompileUnitInfo
     return file_range_map;
 
   Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_MAP));
-  if (log)
-    log->Printf(
-        "%p: SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap ('%s')",
-        static_cast<void *>(this),
-        oso_module->GetSpecificationDescription().c_str());
+  LLDB_LOGF(
+      log,
+      "%p: SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap ('%s')",
+      static_cast<void *>(this),
+      oso_module->GetSpecificationDescription().c_str());
 
   std::vector<SymbolFileDWARFDebugMap::CompileUnitInfo *> cu_infos;
   if (exe_symfile->GetCompUnitInfosForModule(oso_module, cu_infos)) {
@@ -363,9 +363,8 @@ void SymbolFileDWARFDebugMap::InitOSO()
             m_compile_unit_infos[i].first_symbol_id = so_symbol->GetID();
             m_compile_unit_infos[i].last_symbol_id = last_symbol->GetID();
 
-            if (log)
-              log->Printf("Initialized OSO 0x%8.8x: file=%s", i,
-                          oso_symbol->GetName().GetCString());
+            LLDB_LOGF(log, "Initialized OSO 0x%8.8x: file=%s", i,
+                      oso_symbol->GetName().GetCString());
           }
         } else {
           if (oso_symbol == nullptr)

Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp Wed Jul 24 10:56:10 2019
@@ -150,23 +150,21 @@ lldb::addr_t AppleGetItemInfoHandler::Se
                 g_get_item_info_function_code, eLanguageTypeObjC,
                 g_get_item_info_function_name, error));
         if (error.Fail()) {
-          if (log)
-            log->Printf("Failed to get utility function: %s.",
-                        error.AsCString());
+          LLDB_LOGF(log, "Failed to get utility function: %s.",
+                    error.AsCString());
           return args_addr;
         }
 
         if (!m_get_item_info_impl_code->Install(diagnostics, exe_ctx)) {
           if (log) {
-            log->Printf("Failed to install get-item-info introspection.");
+            LLDB_LOGF(log, "Failed to install get-item-info introspection.");
             diagnostics.Dump(log);
           }
           m_get_item_info_impl_code.reset();
           return args_addr;
         }
       } else {
-        if (log)
-          log->Printf("No get-item-info introspection code found.");
+        LLDB_LOGF(log, "No get-item-info introspection code found.");
         return LLDB_INVALID_ADDRESS;
       }
 
@@ -183,17 +181,15 @@ lldb::addr_t AppleGetItemInfoHandler::Se
           get_item_info_return_type, get_item_info_arglist,
           thread.shared_from_this(), error);
       if (error.Fail() || get_item_info_caller == nullptr) {
-        if (log)
-          log->Printf("Error Inserting get-item-info function: \"%s\".",
-                      error.AsCString());
+        LLDB_LOGF(log, "Error Inserting get-item-info function: \"%s\".",
+                  error.AsCString());
         return args_addr;
       }
     } else {
       // If it's already made, then we can just retrieve the caller:
       get_item_info_caller = m_get_item_info_impl_code->GetFunctionCaller();
       if (!get_item_info_caller) {
-        if (log)
-          log->Printf("Failed to get get-item-info introspection caller.");
+        LLDB_LOGF(log, "Failed to get get-item-info introspection caller.");
         m_get_item_info_impl_code.reset();
         return args_addr;
       }
@@ -210,7 +206,7 @@ lldb::addr_t AppleGetItemInfoHandler::Se
   if (!get_item_info_caller->WriteFunctionArguments(
           exe_ctx, args_addr, get_item_info_arglist, diagnostics)) {
     if (log) {
-      log->Printf("Error writing get-item-info function arguments.");
+      LLDB_LOGF(log, "Error writing get-item-info function arguments.");
       diagnostics.Dump(log);
     }
 
@@ -238,9 +234,8 @@ AppleGetItemInfoHandler::GetItemInfo(Thr
   error.Clear();
 
   if (!thread.SafeToCallFunctions()) {
-    if (log)
-      log->Printf("Not safe to call functions on thread 0x%" PRIx64,
-                  thread.GetID());
+    LLDB_LOGF(log, "Not safe to call functions on thread 0x%" PRIx64,
+              thread.GetID());
     error.SetErrorString("Not safe to call functions on this thread.");
     return return_value;
   }
@@ -297,9 +292,8 @@ AppleGetItemInfoHandler::GetItemInfo(Thr
     addr_t bufaddr = process_sp->AllocateMemory(
         32, ePermissionsReadable | ePermissionsWritable, error);
     if (!error.Success() || bufaddr == LLDB_INVALID_ADDRESS) {
-      if (log)
-        log->Printf("Failed to allocate memory for return buffer for get "
-                    "current queues func call");
+      LLDB_LOGF(log, "Failed to allocate memory for return buffer for get "
+                     "current queues func call");
       return return_value;
     }
     m_get_item_info_return_buffer_addr = bufaddr;
@@ -348,9 +342,8 @@ AppleGetItemInfoHandler::GetItemInfo(Thr
   Value results;
   FunctionCaller *func_caller = m_get_item_info_impl_code->GetFunctionCaller();
   if (!func_caller) {
-    if (log)
-      log->Printf("Could not retrieve function caller for "
-                  "__introspection_dispatch_queue_item_get_info.");
+    LLDB_LOGF(log, "Could not retrieve function caller for "
+                   "__introspection_dispatch_queue_item_get_info.");
     error.SetErrorString("Could not retrieve function caller for "
                          "__introspection_dispatch_queue_item_get_info.");
     return return_value;
@@ -359,11 +352,11 @@ AppleGetItemInfoHandler::GetItemInfo(Thr
   func_call_ret = func_caller->ExecuteFunction(exe_ctx, &args_addr, options,
                                                diagnostics, results);
   if (func_call_ret != eExpressionCompleted || !error.Success()) {
-    if (log)
-      log->Printf("Unable to call "
-                  "__introspection_dispatch_queue_item_get_info(), got "
-                  "ExpressionResults %d, error contains %s",
-                  func_call_ret, error.AsCString(""));
+    LLDB_LOGF(log,
+              "Unable to call "
+              "__introspection_dispatch_queue_item_get_info(), got "
+              "ExpressionResults %d, error contains %s",
+              func_call_ret, error.AsCString(""));
     error.SetErrorString("Unable to call "
                          "__introspection_dispatch_queue_get_item_info() for "
                          "list of queues");
@@ -385,13 +378,13 @@ AppleGetItemInfoHandler::GetItemInfo(Thr
     return_value.item_buffer_ptr = LLDB_INVALID_ADDRESS;
     return return_value;
   }
-  if (log)
-    log->Printf("AppleGetItemInfoHandler called "
-                "__introspection_dispatch_queue_item_get_info (page_to_free == "
-                "0x%" PRIx64 ", size = %" PRId64
-                "), returned page is at 0x%" PRIx64 ", size %" PRId64,
-                page_to_free, page_to_free_size, return_value.item_buffer_ptr,
-                return_value.item_buffer_size);
+  LLDB_LOGF(log,
+            "AppleGetItemInfoHandler called "
+            "__introspection_dispatch_queue_item_get_info (page_to_free == "
+            "0x%" PRIx64 ", size = %" PRId64 "), returned page is at 0x%" PRIx64
+            ", size %" PRId64,
+            page_to_free, page_to_free_size, return_value.item_buffer_ptr,
+            return_value.item_buffer_size);
 
   return return_value;
 }

Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp Wed Jul 24 10:56:10 2019
@@ -154,24 +154,23 @@ lldb::addr_t AppleGetPendingItemsHandler
                 g_get_pending_items_function_code, eLanguageTypeObjC,
                 g_get_pending_items_function_name, error));
         if (error.Fail()) {
-          if (log)
-            log->Printf("Failed to get UtilityFunction for pending-items "
-                        "introspection: %s.",
-                        error.AsCString());
+          LLDB_LOGF(log,
+                    "Failed to get UtilityFunction for pending-items "
+                    "introspection: %s.",
+                    error.AsCString());
           return args_addr;
         }
 
         if (!m_get_pending_items_impl_code->Install(diagnostics, exe_ctx)) {
           if (log) {
-            log->Printf("Failed to install pending-items introspection.");
+            LLDB_LOGF(log, "Failed to install pending-items introspection.");
             diagnostics.Dump(log);
           }
           m_get_pending_items_impl_code.reset();
           return args_addr;
         }
       } else {
-        if (log)
-          log->Printf("No pending-items introspection code found.");
+        LLDB_LOGF(log, "No pending-items introspection code found.");
         return LLDB_INVALID_ADDRESS;
       }
 
@@ -186,10 +185,10 @@ lldb::addr_t AppleGetPendingItemsHandler
               get_pending_items_return_type, get_pending_items_arglist,
               thread_sp, error);
       if (error.Fail() || get_pending_items_caller == nullptr) {
-        if (log)
-          log->Printf("Failed to install pending-items introspection function "
-                      "caller: %s.",
-                      error.AsCString());
+        LLDB_LOGF(log,
+                  "Failed to install pending-items introspection function "
+                  "caller: %s.",
+                  error.AsCString());
         m_get_pending_items_impl_code.reset();
         return args_addr;
       }
@@ -199,8 +198,7 @@ lldb::addr_t AppleGetPendingItemsHandler
   diagnostics.Clear();
 
   if (get_pending_items_caller == nullptr) {
-    if (log)
-      log->Printf("Failed to get get_pending_items_caller.");
+    LLDB_LOGF(log, "Failed to get get_pending_items_caller.");
     return LLDB_INVALID_ADDRESS;
   }
 
@@ -212,7 +210,7 @@ lldb::addr_t AppleGetPendingItemsHandler
   if (!get_pending_items_caller->WriteFunctionArguments(
           exe_ctx, args_addr, get_pending_items_arglist, diagnostics)) {
     if (log) {
-      log->Printf("Error writing pending-items function arguments.");
+      LLDB_LOGF(log, "Error writing pending-items function arguments.");
       diagnostics.Dump(log);
     }
 
@@ -241,9 +239,8 @@ AppleGetPendingItemsHandler::GetPendingI
   error.Clear();
 
   if (!thread.SafeToCallFunctions()) {
-    if (log)
-      log->Printf("Not safe to call functions on thread 0x%" PRIx64,
-                  thread.GetID());
+    LLDB_LOGF(log, "Not safe to call functions on thread 0x%" PRIx64,
+              thread.GetID());
     error.SetErrorString("Not safe to call functions on this thread.");
     return return_value;
   }
@@ -303,9 +300,8 @@ AppleGetPendingItemsHandler::GetPendingI
     addr_t bufaddr = process_sp->AllocateMemory(
         32, ePermissionsReadable | ePermissionsWritable, error);
     if (!error.Success() || bufaddr == LLDB_INVALID_ADDRESS) {
-      if (log)
-        log->Printf("Failed to allocate memory for return buffer for get "
-                    "current queues func call");
+      LLDB_LOGF(log, "Failed to allocate memory for return buffer for get "
+                     "current queues func call");
       return return_value;
     }
     m_get_pending_items_return_buffer_addr = bufaddr;
@@ -358,11 +354,11 @@ AppleGetPendingItemsHandler::GetPendingI
   func_call_ret = get_pending_items_caller->ExecuteFunction(
       exe_ctx, &args_addr, options, diagnostics, results);
   if (func_call_ret != eExpressionCompleted || !error.Success()) {
-    if (log)
-      log->Printf("Unable to call "
-                  "__introspection_dispatch_queue_get_pending_items(), got "
-                  "ExpressionResults %d, error contains %s",
-                  func_call_ret, error.AsCString(""));
+    LLDB_LOGF(log,
+              "Unable to call "
+              "__introspection_dispatch_queue_get_pending_items(), got "
+              "ExpressionResults %d, error contains %s",
+              func_call_ret, error.AsCString(""));
     error.SetErrorString("Unable to call "
                          "__introspection_dispatch_queue_get_pending_items() "
                          "for list of queues");
@@ -392,14 +388,14 @@ AppleGetPendingItemsHandler::GetPendingI
     return return_value;
   }
 
-  if (log)
-    log->Printf("AppleGetPendingItemsHandler called "
-                "__introspection_dispatch_queue_get_pending_items "
-                "(page_to_free == 0x%" PRIx64 ", size = %" PRId64
-                "), returned page is at 0x%" PRIx64 ", size %" PRId64
-                ", count = %" PRId64,
-                page_to_free, page_to_free_size, return_value.items_buffer_ptr,
-                return_value.items_buffer_size, return_value.count);
+  LLDB_LOGF(log,
+            "AppleGetPendingItemsHandler called "
+            "__introspection_dispatch_queue_get_pending_items "
+            "(page_to_free == 0x%" PRIx64 ", size = %" PRId64
+            "), returned page is at 0x%" PRIx64 ", size %" PRId64
+            ", count = %" PRId64,
+            page_to_free, page_to_free_size, return_value.items_buffer_ptr,
+            return_value.items_buffer_size, return_value.count);
 
   return return_value;
 }

Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp Wed Jul 24 10:56:10 2019
@@ -165,16 +165,16 @@ AppleGetQueuesHandler::SetupGetQueuesFun
                 g_get_current_queues_function_code, eLanguageTypeC,
                 g_get_current_queues_function_name, error));
         if (error.Fail()) {
-          if (log)
-            log->Printf(
-                "Failed to get UtilityFunction for queues introspection: %s.",
-                error.AsCString());
+          LLDB_LOGF(
+              log,
+              "Failed to get UtilityFunction for queues introspection: %s.",
+              error.AsCString());
           return args_addr;
         }
 
         if (!m_get_queues_impl_code_up->Install(diagnostics, exe_ctx)) {
           if (log) {
-            log->Printf("Failed to install queues introspection");
+            LLDB_LOGF(log, "Failed to install queues introspection");
             diagnostics.Dump(log);
           }
           m_get_queues_impl_code_up.reset();
@@ -182,7 +182,7 @@ AppleGetQueuesHandler::SetupGetQueuesFun
         }
       } else {
         if (log) {
-          log->Printf("No queues introspection code found.");
+          LLDB_LOGF(log, "No queues introspection code found.");
           diagnostics.Dump(log);
         }
         return LLDB_INVALID_ADDRESS;
@@ -198,10 +198,9 @@ AppleGetQueuesHandler::SetupGetQueuesFun
     get_queues_caller = m_get_queues_impl_code_up->MakeFunctionCaller(
         get_queues_return_type, get_queues_arglist, thread_sp, error);
     if (error.Fail() || get_queues_caller == nullptr) {
-      if (log)
-        log->Printf(
-            "Could not get function caller for get-queues function: %s.",
-            error.AsCString());
+      LLDB_LOGF(log,
+                "Could not get function caller for get-queues function: %s.",
+                error.AsCString());
       return args_addr;
     }
   }
@@ -216,7 +215,7 @@ AppleGetQueuesHandler::SetupGetQueuesFun
   if (!get_queues_caller->WriteFunctionArguments(
           exe_ctx, args_addr, get_queues_arglist, diagnostics)) {
     if (log) {
-      log->Printf("Error writing get-queues function arguments.");
+      LLDB_LOGF(log, "Error writing get-queues function arguments.");
       diagnostics.Dump(log);
     }
     return args_addr;
@@ -243,9 +242,8 @@ AppleGetQueuesHandler::GetCurrentQueues(
   error.Clear();
 
   if (!thread.SafeToCallFunctions()) {
-    if (log)
-      log->Printf("Not safe to call functions on thread 0x%" PRIx64,
-                  thread.GetID());
+    LLDB_LOGF(log, "Not safe to call functions on thread 0x%" PRIx64,
+              thread.GetID());
     error.SetErrorString("Not safe to call functions on this thread.");
     return return_value;
   }
@@ -299,9 +297,8 @@ AppleGetQueuesHandler::GetCurrentQueues(
     addr_t bufaddr = process_sp->AllocateMemory(
         32, ePermissionsReadable | ePermissionsWritable, error);
     if (!error.Success() || bufaddr == LLDB_INVALID_ADDRESS) {
-      if (log)
-        log->Printf("Failed to allocate memory for return buffer for get "
-                    "current queues func call");
+      LLDB_LOGF(log, "Failed to allocate memory for return buffer for get "
+                     "current queues func call");
       return return_value;
     }
     m_get_queues_return_buffer_addr = bufaddr;
@@ -357,10 +354,10 @@ AppleGetQueuesHandler::GetCurrentQueues(
   func_call_ret = get_queues_caller->ExecuteFunction(
       exe_ctx, &args_addr, options, diagnostics, results);
   if (func_call_ret != eExpressionCompleted || !error.Success()) {
-    if (log)
-      log->Printf("Unable to call introspection_get_dispatch_queues(), got "
-                  "ExpressionResults %d, error contains %s",
-                  func_call_ret, error.AsCString(""));
+    LLDB_LOGF(log,
+              "Unable to call introspection_get_dispatch_queues(), got "
+              "ExpressionResults %d, error contains %s",
+              func_call_ret, error.AsCString(""));
     error.SetErrorString("Unable to call introspection_get_dispatch_queues() "
                          "for list of queues");
     return return_value;
@@ -389,14 +386,13 @@ AppleGetQueuesHandler::GetCurrentQueues(
     return return_value;
   }
 
-  if (log)
-    log->Printf("AppleGetQueuesHandler called "
-                "__introspection_dispatch_get_queues (page_to_free == "
-                "0x%" PRIx64 ", size = %" PRId64
-                "), returned page is at 0x%" PRIx64 ", size %" PRId64
-                ", count = %" PRId64,
-                page_to_free, page_to_free_size, return_value.queues_buffer_ptr,
-                return_value.queues_buffer_size, return_value.count);
+  LLDB_LOGF(log,
+            "AppleGetQueuesHandler called "
+            "__introspection_dispatch_get_queues (page_to_free == "
+            "0x%" PRIx64 ", size = %" PRId64 "), returned page is at 0x%" PRIx64
+            ", size %" PRId64 ", count = %" PRId64,
+            page_to_free, page_to_free_size, return_value.queues_buffer_ptr,
+            return_value.queues_buffer_size, return_value.count);
 
   return return_value;
 }

Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp Wed Jul 24 10:56:10 2019
@@ -160,18 +160,18 @@ lldb::addr_t AppleGetThreadItemInfoHandl
                 g_get_thread_item_info_function_code, eLanguageTypeC,
                 g_get_thread_item_info_function_name, error));
         if (error.Fail()) {
-          if (log)
-            log->Printf("Failed to get UtilityFunction for "
-                        "get-thread-item-info introspection: %s.",
-                        error.AsCString());
+          LLDB_LOGF(log,
+                    "Failed to get UtilityFunction for "
+                    "get-thread-item-info introspection: %s.",
+                    error.AsCString());
           m_get_thread_item_info_impl_code.reset();
           return args_addr;
         }
 
         if (!m_get_thread_item_info_impl_code->Install(diagnostics, exe_ctx)) {
           if (log) {
-            log->Printf(
-                "Failed to install get-thread-item-info introspection.");
+            LLDB_LOGF(log,
+                      "Failed to install get-thread-item-info introspection.");
             diagnostics.Dump(log);
           }
 
@@ -179,8 +179,7 @@ lldb::addr_t AppleGetThreadItemInfoHandl
           return args_addr;
         }
       } else {
-        if (log)
-          log->Printf("No get-thread-item-info introspection code found.");
+        LLDB_LOGF(log, "No get-thread-item-info introspection code found.");
         return LLDB_INVALID_ADDRESS;
       }
 
@@ -196,10 +195,10 @@ lldb::addr_t AppleGetThreadItemInfoHandl
               get_thread_item_info_return_type, get_thread_item_info_arglist,
               thread_sp, error);
       if (error.Fail() || get_thread_item_info_caller == nullptr) {
-        if (log)
-          log->Printf("Failed to install get-thread-item-info introspection "
-                      "caller: %s.",
-                      error.AsCString());
+        LLDB_LOGF(log,
+                  "Failed to install get-thread-item-info introspection "
+                  "caller: %s.",
+                  error.AsCString());
         m_get_thread_item_info_impl_code.reset();
         return args_addr;
       }
@@ -220,7 +219,7 @@ lldb::addr_t AppleGetThreadItemInfoHandl
   if (!get_thread_item_info_caller->WriteFunctionArguments(
           exe_ctx, args_addr, get_thread_item_info_arglist, diagnostics)) {
     if (log) {
-      log->Printf("Error writing get-thread-item-info function arguments");
+      LLDB_LOGF(log, "Error writing get-thread-item-info function arguments");
       diagnostics.Dump(log);
     }
     return args_addr;
@@ -248,9 +247,8 @@ AppleGetThreadItemInfoHandler::GetThread
   error.Clear();
 
   if (!thread.SafeToCallFunctions()) {
-    if (log)
-      log->Printf("Not safe to call functions on thread 0x%" PRIx64,
-                  thread.GetID());
+    LLDB_LOGF(log, "Not safe to call functions on thread 0x%" PRIx64,
+              thread.GetID());
     error.SetErrorString("Not safe to call functions on this thread.");
     return return_value;
   }
@@ -305,9 +303,8 @@ AppleGetThreadItemInfoHandler::GetThread
     addr_t bufaddr = process_sp->AllocateMemory(
         32, ePermissionsReadable | ePermissionsWritable, error);
     if (!error.Success() || bufaddr == LLDB_INVALID_ADDRESS) {
-      if (log)
-        log->Printf("Failed to allocate memory for return buffer for get "
-                    "current queues func call");
+      LLDB_LOGF(log, "Failed to allocate memory for return buffer for get "
+                     "current queues func call");
       return return_value;
     }
     m_get_thread_item_info_return_buffer_addr = bufaddr;
@@ -369,11 +366,11 @@ AppleGetThreadItemInfoHandler::GetThread
   func_call_ret = get_thread_item_info_caller->ExecuteFunction(
       exe_ctx, &args_addr, options, diagnostics, results);
   if (func_call_ret != eExpressionCompleted || !error.Success()) {
-    if (log)
-      log->Printf("Unable to call "
-                  "__introspection_dispatch_thread_get_item_info(), got "
-                  "ExpressionResults %d, error contains %s",
-                  func_call_ret, error.AsCString(""));
+    LLDB_LOGF(log,
+              "Unable to call "
+              "__introspection_dispatch_thread_get_item_info(), got "
+              "ExpressionResults %d, error contains %s",
+              func_call_ret, error.AsCString(""));
     error.SetErrorString("Unable to call "
                          "__introspection_dispatch_thread_get_item_info() for "
                          "list of queues");
@@ -397,13 +394,13 @@ AppleGetThreadItemInfoHandler::GetThread
     return return_value;
   }
 
-  if (log)
-    log->Printf("AppleGetThreadItemInfoHandler called "
-                "__introspection_dispatch_thread_get_item_info (page_to_free "
-                "== 0x%" PRIx64 ", size = %" PRId64
-                "), returned page is at 0x%" PRIx64 ", size %" PRId64,
-                page_to_free, page_to_free_size, return_value.item_buffer_ptr,
-                return_value.item_buffer_size);
+  LLDB_LOGF(log,
+            "AppleGetThreadItemInfoHandler called "
+            "__introspection_dispatch_thread_get_item_info (page_to_free "
+            "== 0x%" PRIx64 ", size = %" PRId64
+            "), returned page is at 0x%" PRIx64 ", size %" PRId64,
+            page_to_free, page_to_free_size, return_value.item_buffer_ptr,
+            return_value.item_buffer_size);
 
   return return_value;
 }

Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp Wed Jul 24 10:56:10 2019
@@ -927,13 +927,13 @@ void SystemRuntimeMacOSX::PopulateQueues
       offset_t start_of_next_item = start_of_this_item + offset_to_next;
       offset = start_of_next_item;
 
-      if (log)
-        log->Printf("SystemRuntimeMacOSX::PopulateQueuesUsingLibBTR added "
-                    "queue with dispatch_queue_t 0x%" PRIx64
-                    ", serial number 0x%" PRIx64
-                    ", running items %d, pending items %d, name '%s'",
-                    queue, serialnum, running_work_items_count,
-                    pending_work_items_count, queue_label);
+      LLDB_LOGF(log,
+                "SystemRuntimeMacOSX::PopulateQueuesUsingLibBTR added "
+                "queue with dispatch_queue_t 0x%" PRIx64
+                ", serial number 0x%" PRIx64
+                ", running items %d, pending items %d, name '%s'",
+                queue, serialnum, running_work_items_count,
+                pending_work_items_count, queue_label);
 
       QueueSP queue_sp(
           new Queue(m_process->shared_from_this(), serialnum, queue_label));

Modified: lldb/trunk/source/Symbol/Block.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Block.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Block.cpp (original)
+++ lldb/trunk/source/Symbol/Block.cpp Wed Jul 24 10:56:10 2019
@@ -337,22 +337,24 @@ void Block::AddRange(const Range &range)
 
       const Declaration &func_decl = func_type->GetDeclaration();
       if (func_decl.GetLine()) {
-        log->Printf("warning: %s:%u block {0x%8.8" PRIx64
-                    "} has range[%u] [0x%" PRIx64 " - 0x%" PRIx64
-                    ") which is not contained in parent block {0x%8.8" PRIx64
-                    "} in function {0x%8.8" PRIx64 "} from %s",
-                    func_decl.GetFile().GetPath().c_str(), func_decl.GetLine(),
-                    GetID(), (uint32_t)m_ranges.GetSize(), block_start_addr,
-                    block_end_addr, parent_block->GetID(), function->GetID(),
-                    module_sp->GetFileSpec().GetPath().c_str());
+        LLDB_LOGF(log,
+                  "warning: %s:%u block {0x%8.8" PRIx64
+                  "} has range[%u] [0x%" PRIx64 " - 0x%" PRIx64
+                  ") which is not contained in parent block {0x%8.8" PRIx64
+                  "} in function {0x%8.8" PRIx64 "} from %s",
+                  func_decl.GetFile().GetPath().c_str(), func_decl.GetLine(),
+                  GetID(), (uint32_t)m_ranges.GetSize(), block_start_addr,
+                  block_end_addr, parent_block->GetID(), function->GetID(),
+                  module_sp->GetFileSpec().GetPath().c_str());
       } else {
-        log->Printf("warning: block {0x%8.8" PRIx64
-                    "} has range[%u] [0x%" PRIx64 " - 0x%" PRIx64
-                    ") which is not contained in parent block {0x%8.8" PRIx64
-                    "} in function {0x%8.8" PRIx64 "} from %s",
-                    GetID(), (uint32_t)m_ranges.GetSize(), block_start_addr,
-                    block_end_addr, parent_block->GetID(), function->GetID(),
-                    module_sp->GetFileSpec().GetPath().c_str());
+        LLDB_LOGF(log,
+                  "warning: block {0x%8.8" PRIx64 "} has range[%u] [0x%" PRIx64
+                  " - 0x%" PRIx64
+                  ") which is not contained in parent block {0x%8.8" PRIx64
+                  "} in function {0x%8.8" PRIx64 "} from %s",
+                  GetID(), (uint32_t)m_ranges.GetSize(), block_start_addr,
+                  block_end_addr, parent_block->GetID(), function->GetID(),
+                  module_sp->GetFileSpec().GetPath().c_str());
       }
     }
     parent_block->AddRange(range);

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Wed Jul 24 10:56:10 2019
@@ -956,7 +956,7 @@ public:
       llvm::SmallVector<char, 32> diag_str(10);
       info.FormatDiagnostic(diag_str);
       diag_str.push_back('\0');
-      m_log->Printf("Compiler diagnostic: %s\n", diag_str.data());
+      LLDB_LOGF(m_log, "Compiler diagnostic: %s\n", diag_str.data());
     }
   }
 

Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTImporter.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTImporter.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTImporter.cpp Wed Jul 24 10:56:10 2019
@@ -30,28 +30,28 @@ ClangASTMetrics::Counters ClangASTMetric
 
 void ClangASTMetrics::DumpCounters(Log *log,
                                    ClangASTMetrics::Counters &counters) {
-  log->Printf("  Number of visible Decl queries by name     : %" PRIu64,
-              counters.m_visible_query_count);
-  log->Printf("  Number of lexical Decl queries             : %" PRIu64,
-              counters.m_lexical_query_count);
-  log->Printf("  Number of imports initiated by LLDB        : %" PRIu64,
-              counters.m_lldb_import_count);
-  log->Printf("  Number of imports conducted by Clang       : %" PRIu64,
-              counters.m_clang_import_count);
-  log->Printf("  Number of Decls completed                  : %" PRIu64,
-              counters.m_decls_completed_count);
-  log->Printf("  Number of records laid out                 : %" PRIu64,
-              counters.m_record_layout_count);
+  LLDB_LOGF(log, "  Number of visible Decl queries by name     : %" PRIu64,
+            counters.m_visible_query_count);
+  LLDB_LOGF(log, "  Number of lexical Decl queries             : %" PRIu64,
+            counters.m_lexical_query_count);
+  LLDB_LOGF(log, "  Number of imports initiated by LLDB        : %" PRIu64,
+            counters.m_lldb_import_count);
+  LLDB_LOGF(log, "  Number of imports conducted by Clang       : %" PRIu64,
+            counters.m_clang_import_count);
+  LLDB_LOGF(log, "  Number of Decls completed                  : %" PRIu64,
+            counters.m_decls_completed_count);
+  LLDB_LOGF(log, "  Number of records laid out                 : %" PRIu64,
+            counters.m_record_layout_count);
 }
 
 void ClangASTMetrics::DumpCounters(Log *log) {
   if (!log)
     return;
 
-  log->Printf("== ClangASTMetrics output ==");
-  log->Printf("-- Global metrics --");
+  LLDB_LOGF(log, "== ClangASTMetrics output ==");
+  LLDB_LOGF(log, "-- Global metrics --");
   DumpCounters(log, global_counters);
-  log->Printf("-- Local metrics --");
+  LLDB_LOGF(log, "-- Local metrics --");
   DumpCounters(log, local_counters);
 }
 
@@ -127,14 +127,16 @@ clang::Decl *ClangASTImporter::CopyDecl(
         user_id = metadata->GetUserID();
 
       if (NamedDecl *named_decl = dyn_cast<NamedDecl>(decl))
-        log->Printf("  [ClangASTImporter] WARNING: Failed to import a %s "
-                    "'%s', metadata 0x%" PRIx64,
-                    decl->getDeclKindName(),
-                    named_decl->getNameAsString().c_str(), user_id);
+        LLDB_LOGF(log,
+                  "  [ClangASTImporter] WARNING: Failed to import a %s "
+                  "'%s', metadata 0x%" PRIx64,
+                  decl->getDeclKindName(),
+                  named_decl->getNameAsString().c_str(), user_id);
       else
-        log->Printf("  [ClangASTImporter] WARNING: Failed to import a %s, "
-                    "metadata 0x%" PRIx64,
-                    decl->getDeclKindName(), user_id);
+        LLDB_LOGF(log,
+                  "  [ClangASTImporter] WARNING: Failed to import a %s, "
+                  "metadata 0x%" PRIx64,
+                  decl->getDeclKindName(), user_id);
     }
     return nullptr;
   }
@@ -211,12 +213,12 @@ private:
     if (clang::Decl *escaped_child = GetEscapedChild(decl)) {
       Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
-      if (log)
-        log->Printf("    [ClangASTImporter] DeclContextOverride couldn't "
-                    "override (%sDecl*)%p - its child (%sDecl*)%p escapes",
-                    decl->getDeclKindName(), static_cast<void *>(decl),
-                    escaped_child->getDeclKindName(),
-                    static_cast<void *>(escaped_child));
+      LLDB_LOGF(log,
+                "    [ClangASTImporter] DeclContextOverride couldn't "
+                "override (%sDecl*)%p - its child (%sDecl*)%p escapes",
+                decl->getDeclKindName(), static_cast<void *>(decl),
+                escaped_child->getDeclKindName(),
+                static_cast<void *>(escaped_child));
       lldbassert(0 && "Couldn't override!");
     }
 
@@ -254,12 +256,12 @@ ClangASTImporter::DeportType(clang::ASTC
                              lldb::opaque_compiler_type_t type) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
-  if (log)
-    log->Printf("    [ClangASTImporter] DeportType called on (%sType*)0x%llx "
-                "from (ASTContext*)%p to (ASTContext*)%p",
-                QualType::getFromOpaquePtr(type)->getTypeClassName(),
-                (unsigned long long)type, static_cast<void *>(src_ctx),
-                static_cast<void *>(dst_ctx));
+  LLDB_LOGF(log,
+            "    [ClangASTImporter] DeportType called on (%sType*)0x%llx "
+            "from (ASTContext*)%p to (ASTContext*)%p",
+            QualType::getFromOpaquePtr(type)->getTypeClassName(),
+            (unsigned long long)type, static_cast<void *>(src_ctx),
+            static_cast<void *>(dst_ctx));
 
   ImporterDelegateSP delegate_sp(GetDelegate(dst_ctx, src_ctx));
 
@@ -294,11 +296,11 @@ clang::Decl *ClangASTImporter::DeportDec
                                           clang::Decl *decl) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
-  if (log)
-    log->Printf("    [ClangASTImporter] DeportDecl called on (%sDecl*)%p from "
-                "(ASTContext*)%p to (ASTContext*)%p",
-                decl->getDeclKindName(), static_cast<void *>(decl),
-                static_cast<void *>(src_ctx), static_cast<void *>(dst_ctx));
+  LLDB_LOGF(log,
+            "    [ClangASTImporter] DeportDecl called on (%sDecl*)%p from "
+            "(ASTContext*)%p to (ASTContext*)%p",
+            decl->getDeclKindName(), static_cast<void *>(decl),
+            static_cast<void *>(src_ctx), static_cast<void *>(dst_ctx));
 
   ImporterDelegateSP delegate_sp(GetDelegate(dst_ctx, src_ctx));
 
@@ -321,11 +323,11 @@ clang::Decl *ClangASTImporter::DeportDec
   if (!result)
     return nullptr;
 
-  if (log)
-    log->Printf(
-        "    [ClangASTImporter] DeportDecl deported (%sDecl*)%p to (%sDecl*)%p",
-        decl->getDeclKindName(), static_cast<void *>(decl),
-        result->getDeclKindName(), static_cast<void *>(result));
+  LLDB_LOGF(
+      log,
+      "    [ClangASTImporter] DeportDecl deported (%sDecl*)%p to (%sDecl*)%p",
+      decl->getDeclKindName(), static_cast<void *>(decl),
+      result->getDeclKindName(), static_cast<void *>(result));
 
   return result;
 }
@@ -533,9 +535,8 @@ void ClangASTImporter::InsertRecordDecl(
 void ClangASTImporter::CompleteDecl(clang::Decl *decl) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
-  if (log)
-    log->Printf("    [ClangASTImporter] CompleteDecl called on (%sDecl*)%p",
-                decl->getDeclKindName(), static_cast<void *>(decl));
+  LLDB_LOGF(log, "    [ClangASTImporter] CompleteDecl called on (%sDecl*)%p",
+            decl->getDeclKindName(), static_cast<void *>(decl));
 
   if (ObjCInterfaceDecl *interface_decl = dyn_cast<ObjCInterfaceDecl>(decl)) {
     if (!interface_decl->getDefinition()) {
@@ -817,9 +818,9 @@ void ClangASTImporter::BuildNamespaceMap
 void ClangASTImporter::ForgetDestination(clang::ASTContext *dst_ast) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
-  if (log)
-    log->Printf("    [ClangASTImporter] Forgetting destination (ASTContext*)%p",
-                static_cast<void *>(dst_ast));
+  LLDB_LOGF(log,
+            "    [ClangASTImporter] Forgetting destination (ASTContext*)%p",
+            static_cast<void *>(dst_ast));
 
   m_metadata_map.erase(dst_ast);
 }
@@ -830,10 +831,10 @@ void ClangASTImporter::ForgetSource(clan
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
-  if (log)
-    log->Printf("    [ClangASTImporter] Forgetting source->dest "
-                "(ASTContext*)%p->(ASTContext*)%p",
-                static_cast<void *>(src_ast), static_cast<void *>(dst_ast));
+  LLDB_LOGF(log,
+            "    [ClangASTImporter] Forgetting source->dest "
+            "(ASTContext*)%p->(ASTContext*)%p",
+            static_cast<void *>(src_ast), static_cast<void *>(dst_ast));
 
   if (!md)
     return;
@@ -1045,15 +1046,17 @@ void ClangASTImporter::ASTImporterDelega
       from_named_decl->printName(name_stream);
       name_stream.flush();
 
-      log->Printf("    [ClangASTImporter] Imported (%sDecl*)%p, named %s (from "
-                  "(Decl*)%p), metadata 0x%" PRIx64,
-                  from->getDeclKindName(), static_cast<void *>(to),
-                  name_string.c_str(), static_cast<void *>(from), user_id);
+      LLDB_LOGF(log,
+                "    [ClangASTImporter] Imported (%sDecl*)%p, named %s (from "
+                "(Decl*)%p), metadata 0x%" PRIx64,
+                from->getDeclKindName(), static_cast<void *>(to),
+                name_string.c_str(), static_cast<void *>(from), user_id);
     } else {
-      log->Printf("    [ClangASTImporter] Imported (%sDecl*)%p (from "
-                  "(Decl*)%p), metadata 0x%" PRIx64,
-                  from->getDeclKindName(), static_cast<void *>(to),
-                  static_cast<void *>(from), user_id);
+      LLDB_LOGF(log,
+                "    [ClangASTImporter] Imported (%sDecl*)%p (from "
+                "(Decl*)%p), metadata 0x%" PRIx64,
+                from->getDeclKindName(), static_cast<void *>(to),
+                static_cast<void *>(from), user_id);
     }
   }
 
@@ -1080,14 +1083,14 @@ void ClangASTImporter::ASTImporterDelega
       if (direct_completer.get() != this)
         direct_completer->ASTImporter::Imported(origin_iter->second.decl, to);
 
-      if (log)
-        log->Printf("    [ClangASTImporter] Propagated origin "
-                    "(Decl*)%p/(ASTContext*)%p from (ASTContext*)%p to "
-                    "(ASTContext*)%p",
-                    static_cast<void *>(origin_iter->second.decl),
-                    static_cast<void *>(origin_iter->second.ctx),
-                    static_cast<void *>(&from->getASTContext()),
-                    static_cast<void *>(&to->getASTContext()));
+      LLDB_LOGF(log,
+                "    [ClangASTImporter] Propagated origin "
+                "(Decl*)%p/(ASTContext*)%p from (ASTContext*)%p to "
+                "(ASTContext*)%p",
+                static_cast<void *>(origin_iter->second.decl),
+                static_cast<void *>(origin_iter->second.ctx),
+                static_cast<void *>(&from->getASTContext()),
+                static_cast<void *>(&to->getASTContext()));
     } else {
       if (m_decls_to_deport && m_decls_already_deported) {
         if (isa<TagDecl>(to) || isa<ObjCInterfaceDecl>(to)) {
@@ -1107,10 +1110,10 @@ void ClangASTImporter::ASTImporterDelega
         to_context_md->m_origins[to] = DeclOrigin(m_source_ctx, from);
       }
 
-      if (log)
-        log->Printf("    [ClangASTImporter] Decl has no origin information in "
-                    "(ASTContext*)%p",
-                    static_cast<void *>(&from->getASTContext()));
+      LLDB_LOGF(log,
+                "    [ClangASTImporter] Decl has no origin information in "
+                "(ASTContext*)%p",
+                static_cast<void *>(&from->getASTContext()));
     }
 
     if (clang::NamespaceDecl *to_namespace =
@@ -1130,11 +1133,11 @@ void ClangASTImporter::ASTImporterDelega
   } else {
     to_context_md->m_origins[to] = DeclOrigin(m_source_ctx, from);
 
-    if (log)
-      log->Printf("    [ClangASTImporter] Sourced origin "
-                  "(Decl*)%p/(ASTContext*)%p into (ASTContext*)%p",
-                  static_cast<void *>(from), static_cast<void *>(m_source_ctx),
-                  static_cast<void *>(&to->getASTContext()));
+    LLDB_LOGF(log,
+              "    [ClangASTImporter] Sourced origin "
+              "(Decl*)%p/(ASTContext*)%p into (ASTContext*)%p",
+              static_cast<void *>(from), static_cast<void *>(m_source_ctx),
+              static_cast<void *>(&to->getASTContext()));
   }
 
   if (TagDecl *from_tag_decl = dyn_cast<TagDecl>(from)) {
@@ -1143,13 +1146,13 @@ void ClangASTImporter::ASTImporterDelega
     to_tag_decl->setHasExternalLexicalStorage();
     to_tag_decl->getPrimaryContext()->setMustBuildLookupTable();
 
-    if (log)
-      log->Printf(
-          "    [ClangASTImporter] To is a TagDecl - attributes %s%s [%s->%s]",
-          (to_tag_decl->hasExternalLexicalStorage() ? " Lexical" : ""),
-          (to_tag_decl->hasExternalVisibleStorage() ? " Visible" : ""),
-          (from_tag_decl->isCompleteDefinition() ? "complete" : "incomplete"),
-          (to_tag_decl->isCompleteDefinition() ? "complete" : "incomplete"));
+    LLDB_LOGF(
+        log,
+        "    [ClangASTImporter] To is a TagDecl - attributes %s%s [%s->%s]",
+        (to_tag_decl->hasExternalLexicalStorage() ? " Lexical" : ""),
+        (to_tag_decl->hasExternalVisibleStorage() ? " Visible" : ""),
+        (from_tag_decl->isCompleteDefinition() ? "complete" : "incomplete"),
+        (to_tag_decl->isCompleteDefinition() ? "complete" : "incomplete"));
   }
 
   if (isa<NamespaceDecl>(from)) {
@@ -1171,15 +1174,16 @@ void ClangASTImporter::ASTImporterDelega
     if (log) {
       if (ObjCInterfaceDecl *to_interface_decl =
               llvm::dyn_cast<ObjCInterfaceDecl>(to_container_decl)) {
-        log->Printf(
+        LLDB_LOGF(
+            log,
             "    [ClangASTImporter] To is an ObjCInterfaceDecl - attributes "
             "%s%s%s",
             (to_interface_decl->hasExternalLexicalStorage() ? " Lexical" : ""),
             (to_interface_decl->hasExternalVisibleStorage() ? " Visible" : ""),
             (to_interface_decl->hasDefinition() ? " HasDefinition" : ""));
       } else {
-        log->Printf(
-            "    [ClangASTImporter] To is an %sDecl - attributes %s%s",
+        LLDB_LOGF(
+            log, "    [ClangASTImporter] To is an %sDecl - attributes %s%s",
             ((Decl *)to_container_decl)->getDeclKindName(),
             (to_container_decl->hasExternalLexicalStorage() ? " Lexical" : ""),
             (to_container_decl->hasExternalVisibleStorage() ? " Visible" : ""));

Modified: lldb/trunk/source/Symbol/CompactUnwindInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompactUnwindInfo.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CompactUnwindInfo.cpp (original)
+++ lldb/trunk/source/Symbol/CompactUnwindInfo.cpp Wed Jul 24 10:56:10 2019
@@ -190,8 +190,8 @@ bool CompactUnwindInfo::GetUnwindPlan(Ta
             Address::DumpStyle::DumpStyleResolvedDescriptionNoFunctionArguments,
             Address::DumpStyle::DumpStyleFileAddress,
             arch.GetAddressByteSize());
-        log->Printf("Got compact unwind encoding 0x%x for function %s",
-                    function_info.encoding, strm.GetData());
+        LLDB_LOGF(log, "Got compact unwind encoding 0x%x for function %s",
+                  function_info.encoding, strm.GetData());
       }
 
       if (function_info.valid_range_offset_start != 0 &&

Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp (original)
+++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Wed Jul 24 10:56:10 2019
@@ -773,13 +773,12 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan
           // useful for compilers that move epilogue code into the body of a
           // function.)
           if (stack.empty()) {
-            if (log)
-              log->Printf("DWARFCallFrameInfo::%s(dwarf_offset: %" PRIx32
-                          ", startaddr: %" PRIx64
-                          " encountered DW_CFA_restore_state but state stack "
-                          "is empty. Corrupt unwind info?",
-                          __FUNCTION__, dwarf_offset,
-                          startaddr.GetFileAddress());
+            LLDB_LOGF(log,
+                      "DWARFCallFrameInfo::%s(dwarf_offset: %" PRIx32
+                      ", startaddr: %" PRIx64
+                      " encountered DW_CFA_restore_state but state stack "
+                      "is empty. Corrupt unwind info?",
+                      __FUNCTION__, dwarf_offset, startaddr.GetFileAddress());
             break;
           }
           lldb::addr_t offset = row->GetOffset();

Modified: lldb/trunk/source/Symbol/LocateSymbolFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/LocateSymbolFile.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/LocateSymbolFile.cpp (original)
+++ lldb/trunk/source/Symbol/LocateSymbolFile.cpp Wed Jul 24 10:56:10 2019
@@ -157,8 +157,8 @@ static bool LocateDSYMInVincinityOfExecu
     if (::LookForDsymNextToExecutablePath(module_spec, exec_fspec,
                                           dsym_fspec)) {
       if (log) {
-        log->Printf("dSYM with matching UUID & arch found at %s",
-                    dsym_fspec.GetPath().c_str());
+        LLDB_LOGF(log, "dSYM with matching UUID & arch found at %s",
+                  dsym_fspec.GetPath().c_str());
       }
       return true;
     } else {
@@ -189,8 +189,8 @@ static bool LocateDSYMInVincinityOfExecu
           if (::LookForDsymNextToExecutablePath(module_spec, parent_dirs,
                                                 dsym_fspec)) {
             if (log) {
-              log->Printf("dSYM with matching UUID & arch found at %s",
-                          dsym_fspec.GetPath().c_str());
+              LLDB_LOGF(log, "dSYM with matching UUID & arch found at %s",
+                        dsym_fspec.GetPath().c_str());
             }
             return true;
           }

Modified: lldb/trunk/source/Symbol/LocateSymbolFileMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/LocateSymbolFileMacOSX.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/LocateSymbolFileMacOSX.cpp (original)
+++ lldb/trunk/source/Symbol/LocateSymbolFileMacOSX.cpp Wed Jul 24 10:56:10 2019
@@ -45,8 +45,7 @@ int LocateMacOSXFilesUsingDebugSymbols(c
                                        ModuleSpec &return_module_spec) {
   Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
   if (!ModuleList::GetGlobalModuleListProperties().GetEnableExternalLookup()) {
-    if (log)
-      log->Printf("Spotlight lookup for .dSYM bundles is disabled.");
+    LLDB_LOGF(log, "Spotlight lookup for .dSYM bundles is disabled.");
     return 0;
   }
 
@@ -102,9 +101,10 @@ int LocateMacOSXFilesUsingDebugSymbols(c
           if (::CFURLGetFileSystemRepresentation(
                   dsym_url.get(), true, (UInt8 *)path, sizeof(path) - 1)) {
             if (log) {
-              log->Printf("DebugSymbols framework returned dSYM path of %s for "
-                          "UUID %s -- looking for the dSYM",
-                          path, uuid->GetAsString().c_str());
+              LLDB_LOGF(log,
+                        "DebugSymbols framework returned dSYM path of %s for "
+                        "UUID %s -- looking for the dSYM",
+                        path, uuid->GetAsString().c_str());
             }
             FileSpec dsym_filespec(path);
             if (path[0] == '~')
@@ -124,9 +124,10 @@ int LocateMacOSXFilesUsingDebugSymbols(c
           if (log) {
             if (::CFURLGetFileSystemRepresentation(
                     dsym_url.get(), true, (UInt8 *)path, sizeof(path) - 1)) {
-              log->Printf("DebugSymbols framework returned dSYM path of %s for "
-                          "UUID %s -- looking for an exec file",
-                          path, uuid->GetAsString().c_str());
+              LLDB_LOGF(log,
+                        "DebugSymbols framework returned dSYM path of %s for "
+                        "UUID %s -- looking for an exec file",
+                        path, uuid->GetAsString().c_str());
             }
           }
 
@@ -145,8 +146,8 @@ int LocateMacOSXFilesUsingDebugSymbols(c
             if (exec_cf_path && ::CFStringGetFileSystemRepresentation(
                                     exec_cf_path, path, sizeof(path))) {
               if (log) {
-                log->Printf("plist bundle has exec path of %s for UUID %s",
-                            path, uuid->GetAsString().c_str());
+                LLDB_LOGF(log, "plist bundle has exec path of %s for UUID %s",
+                          path, uuid->GetAsString().c_str());
               }
               ++items_found;
               FileSpec exec_filespec(path);
@@ -168,9 +169,10 @@ int LocateMacOSXFilesUsingDebugSymbols(c
               if (dsym_extension_pos) {
                 *dsym_extension_pos = '\0';
                 if (log) {
-                  log->Printf("Looking for executable binary next to dSYM "
-                              "bundle with name with name %s",
-                              path);
+                  LLDB_LOGF(log,
+                            "Looking for executable binary next to dSYM "
+                            "bundle with name with name %s",
+                            path);
                 }
                 FileSpec file_spec(path);
                 FileSystem::Instance().Resolve(file_spec);
@@ -199,9 +201,10 @@ int LocateMacOSXFilesUsingDebugSymbols(c
                         ++items_found;
                         return_module_spec.GetFileSpec() = bundle_exe_file_spec;
                         if (log) {
-                          log->Printf("Executable binary %s next to dSYM is "
-                                      "compatible; using",
-                                      path);
+                          LLDB_LOGF(log,
+                                    "Executable binary %s next to dSYM is "
+                                    "compatible; using",
+                                    path);
                         }
                       }
                     }
@@ -228,9 +231,10 @@ int LocateMacOSXFilesUsingDebugSymbols(c
                     ++items_found;
                     return_module_spec.GetFileSpec() = file_spec;
                     if (log) {
-                      log->Printf("Executable binary %s next to dSYM is "
-                                  "compatible; using",
-                                  path);
+                      LLDB_LOGF(log,
+                                "Executable binary %s next to dSYM is "
+                                "compatible; using",
+                                path);
                     }
                   }
                   break;
@@ -315,9 +319,9 @@ static bool GetModuleSpecInfoFromUUIDDic
         module_spec.GetFileSpec().SetFile(str.c_str(), FileSpec::Style::native);
         FileSystem::Instance().Resolve(module_spec.GetFileSpec());
         if (log) {
-          log->Printf(
-              "From dsymForUUID plist: Symbol rich executable is at '%s'",
-              str.c_str());
+          LLDB_LOGF(log,
+                    "From dsymForUUID plist: Symbol rich executable is at '%s'",
+                    str.c_str());
         }
       }
     }
@@ -331,7 +335,8 @@ static bool GetModuleSpecInfoFromUUIDDic
         FileSystem::Instance().Resolve(module_spec.GetFileSpec());
         success = true;
         if (log) {
-          log->Printf("From dsymForUUID plist: dSYM is at '%s'", str.c_str());
+          LLDB_LOGF(log, "From dsymForUUID plist: dSYM is at '%s'",
+                    str.c_str());
         }
       }
     }
@@ -582,11 +587,11 @@ bool Symbols::DownloadObjectAndSymbolFil
         std::string command_output;
         if (log) {
           if (!uuid_str.empty())
-            log->Printf("Calling %s with UUID %s to find dSYM",
-                        g_dsym_for_uuid_exe_path, uuid_str.c_str());
+            LLDB_LOGF(log, "Calling %s with UUID %s to find dSYM",
+                      g_dsym_for_uuid_exe_path, uuid_str.c_str());
           else if (file_path[0] != '\0')
-            log->Printf("Calling %s with file %s to find dSYM",
-                        g_dsym_for_uuid_exe_path, file_path);
+            LLDB_LOGF(log, "Calling %s with file %s to find dSYM",
+                      g_dsym_for_uuid_exe_path, file_path);
         }
         Status error = Host::RunShellCommand(
             command.GetData(),
@@ -643,11 +648,11 @@ bool Symbols::DownloadObjectAndSymbolFil
         } else {
           if (log) {
             if (!uuid_str.empty())
-              log->Printf("Called %s on %s, no matches",
-                          g_dsym_for_uuid_exe_path, uuid_str.c_str());
+              LLDB_LOGF(log, "Called %s on %s, no matches",
+                        g_dsym_for_uuid_exe_path, uuid_str.c_str());
             else if (file_path[0] != '\0')
-              log->Printf("Called %s on %s, no matches",
-                          g_dsym_for_uuid_exe_path, file_path);
+              LLDB_LOGF(log, "Called %s on %s, no matches",
+                        g_dsym_for_uuid_exe_path, file_path);
           }
         }
       }

Modified: lldb/trunk/source/Symbol/ObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ObjectFile.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ObjectFile.cpp (original)
+++ lldb/trunk/source/Symbol/ObjectFile.cpp Wed Jul 24 10:56:10 2019
@@ -271,13 +271,13 @@ ObjectFile::ObjectFile(const lldb::Modul
   if (data_sp)
     m_data.SetData(data_sp, data_offset, length);
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
-  if (log)
-    log->Printf("%p ObjectFile::ObjectFile() module = %p (%s), file = %s, "
-                "file_offset = 0x%8.8" PRIx64 ", size = %" PRIu64,
-                static_cast<void *>(this), static_cast<void *>(module_sp.get()),
-                module_sp->GetSpecificationDescription().c_str(),
-                m_file ? m_file.GetPath().c_str() : "<NULL>", m_file_offset,
-                m_length);
+  LLDB_LOGF(log,
+            "%p ObjectFile::ObjectFile() module = %p (%s), file = %s, "
+            "file_offset = 0x%8.8" PRIx64 ", size = %" PRIu64,
+            static_cast<void *>(this), static_cast<void *>(module_sp.get()),
+            module_sp->GetSpecificationDescription().c_str(),
+            m_file ? m_file.GetPath().c_str() : "<NULL>", m_file_offset,
+            m_length);
 }
 
 ObjectFile::ObjectFile(const lldb::ModuleSP &module_sp,
@@ -290,18 +290,17 @@ ObjectFile::ObjectFile(const lldb::Modul
   if (header_data_sp)
     m_data.SetData(header_data_sp, 0, header_data_sp->GetByteSize());
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
-  if (log)
-    log->Printf("%p ObjectFile::ObjectFile() module = %p (%s), process = %p, "
-                "header_addr = 0x%" PRIx64,
-                static_cast<void *>(this), static_cast<void *>(module_sp.get()),
-                module_sp->GetSpecificationDescription().c_str(),
-                static_cast<void *>(process_sp.get()), m_memory_addr);
+  LLDB_LOGF(log,
+            "%p ObjectFile::ObjectFile() module = %p (%s), process = %p, "
+            "header_addr = 0x%" PRIx64,
+            static_cast<void *>(this), static_cast<void *>(module_sp.get()),
+            module_sp->GetSpecificationDescription().c_str(),
+            static_cast<void *>(process_sp.get()), m_memory_addr);
 }
 
 ObjectFile::~ObjectFile() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
-  if (log)
-    log->Printf("%p ObjectFile::~ObjectFile ()\n", static_cast<void *>(this));
+  LLDB_LOGF(log, "%p ObjectFile::~ObjectFile ()\n", static_cast<void *>(this));
 }
 
 bool ObjectFile::SetModulesArchitecture(const ArchSpec &new_arch) {
@@ -595,10 +594,9 @@ void ObjectFile::ClearSymtab() {
   if (module_sp) {
     std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
-    if (log)
-      log->Printf("%p ObjectFile::ClearSymtab () symtab = %p",
-                  static_cast<void *>(this),
-                  static_cast<void *>(m_symtab_up.get()));
+    LLDB_LOGF(log, "%p ObjectFile::ClearSymtab () symtab = %p",
+              static_cast<void *>(this),
+              static_cast<void *>(m_symtab_up.get()));
     m_symtab_up.reset();
   }
 }

Modified: lldb/trunk/source/Symbol/SymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolContext.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolContext.cpp Wed Jul 24 10:56:10 2019
@@ -494,7 +494,8 @@ bool SymbolContext::GetParentOfInlinedSc
         Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS));
 
         if (log) {
-          log->Printf(
+          LLDB_LOGF(
+              log,
               "warning: inlined block 0x%8.8" PRIx64
               " doesn't have a range that contains file address 0x%" PRIx64,
               curr_inlined_block->GetID(), curr_frame_pc.GetFileAddress());

Modified: lldb/trunk/source/Symbol/UnwindPlan.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/UnwindPlan.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/UnwindPlan.cpp (original)
+++ lldb/trunk/source/Symbol/UnwindPlan.cpp Wed Jul 24 10:56:10 2019
@@ -402,10 +402,10 @@ const UnwindPlan::RowSP UnwindPlan::GetR
     return m_row_list[idx];
   else {
     Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND));
-    if (log)
-      log->Printf("error: UnwindPlan::GetRowAtIndex(idx = %u) invalid index "
-                  "(number rows is %u)",
-                  idx, (uint32_t)m_row_list.size());
+    LLDB_LOGF(log,
+              "error: UnwindPlan::GetRowAtIndex(idx = %u) invalid index "
+              "(number rows is %u)",
+              idx, (uint32_t)m_row_list.size());
     return UnwindPlan::RowSP();
   }
 }
@@ -413,8 +413,7 @@ const UnwindPlan::RowSP UnwindPlan::GetR
 const UnwindPlan::RowSP UnwindPlan::GetLastRow() const {
   if (m_row_list.empty()) {
     Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND));
-    if (log)
-      log->Printf("UnwindPlan::GetLastRow() when rows are empty");
+    LLDB_LOGF(log, "UnwindPlan::GetLastRow() when rows are empty");
     return UnwindPlan::RowSP();
   }
   return m_row_list.back();
@@ -434,13 +433,14 @@ bool UnwindPlan::PlanValidAtAddress(Addr
     if (log) {
       StreamString s;
       if (addr.Dump(&s, nullptr, Address::DumpStyleSectionNameOffset)) {
-        log->Printf("UnwindPlan is invalid -- no unwind rows for UnwindPlan "
-                    "'%s' at address %s",
-                    m_source_name.GetCString(), s.GetData());
+        LLDB_LOGF(log,
+                  "UnwindPlan is invalid -- no unwind rows for UnwindPlan "
+                  "'%s' at address %s",
+                  m_source_name.GetCString(), s.GetData());
       } else {
-        log->Printf(
-            "UnwindPlan is invalid -- no unwind rows for UnwindPlan '%s'",
-            m_source_name.GetCString());
+        LLDB_LOGF(log,
+                  "UnwindPlan is invalid -- no unwind rows for UnwindPlan '%s'",
+                  m_source_name.GetCString());
       }
     }
     return false;
@@ -456,13 +456,15 @@ bool UnwindPlan::PlanValidAtAddress(Addr
     if (log) {
       StreamString s;
       if (addr.Dump(&s, nullptr, Address::DumpStyleSectionNameOffset)) {
-        log->Printf("UnwindPlan is invalid -- no CFA register defined in row 0 "
-                    "for UnwindPlan '%s' at address %s",
-                    m_source_name.GetCString(), s.GetData());
+        LLDB_LOGF(log,
+                  "UnwindPlan is invalid -- no CFA register defined in row 0 "
+                  "for UnwindPlan '%s' at address %s",
+                  m_source_name.GetCString(), s.GetData());
       } else {
-        log->Printf("UnwindPlan is invalid -- no CFA register defined in row 0 "
-                    "for UnwindPlan '%s'",
-                    m_source_name.GetCString());
+        LLDB_LOGF(log,
+                  "UnwindPlan is invalid -- no CFA register defined in row 0 "
+                  "for UnwindPlan '%s'",
+                  m_source_name.GetCString());
       }
     }
     return false;

Modified: lldb/trunk/source/Target/Memory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Memory.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/Memory.cpp (original)
+++ lldb/trunk/source/Target/Memory.cpp Wed Jul 24 10:56:10 2019
@@ -348,10 +348,11 @@ AllocatedMemoryCache::AllocatePage(uint3
 
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
   if (log) {
-    log->Printf("Process::DoAllocateMemory (byte_size = 0x%8.8" PRIx32
-                ", permissions = %s) => 0x%16.16" PRIx64,
-                (uint32_t)page_byte_size, GetPermissionsAsCString(permissions),
-                (uint64_t)addr);
+    LLDB_LOGF(log,
+              "Process::DoAllocateMemory (byte_size = 0x%8.8" PRIx32
+              ", permissions = %s) => 0x%16.16" PRIx64,
+              (uint32_t)page_byte_size, GetPermissionsAsCString(permissions),
+              (uint64_t)addr);
   }
 
   if (addr != LLDB_INVALID_ADDRESS) {
@@ -385,12 +386,11 @@ lldb::addr_t AllocatedMemoryCache::Alloc
       addr = block_sp->ReserveBlock(byte_size);
   }
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf(
-        "AllocatedMemoryCache::AllocateMemory (byte_size = 0x%8.8" PRIx32
-        ", permissions = %s) => 0x%16.16" PRIx64,
-        (uint32_t)byte_size, GetPermissionsAsCString(permissions),
-        (uint64_t)addr);
+  LLDB_LOGF(log,
+            "AllocatedMemoryCache::AllocateMemory (byte_size = 0x%8.8" PRIx32
+            ", permissions = %s) => 0x%16.16" PRIx64,
+            (uint32_t)byte_size, GetPermissionsAsCString(permissions),
+            (uint64_t)addr);
   return addr;
 }
 
@@ -406,9 +406,9 @@ bool AllocatedMemoryCache::DeallocateMem
     }
   }
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("AllocatedMemoryCache::DeallocateMemory (addr = 0x%16.16" PRIx64
-                ") => %i",
-                (uint64_t)addr, success);
+  LLDB_LOGF(log,
+            "AllocatedMemoryCache::DeallocateMemory (addr = 0x%16.16" PRIx64
+            ") => %i",
+            (uint64_t)addr, success);
   return success;
 }

Modified: lldb/trunk/source/Target/ModuleCache.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ModuleCache.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/ModuleCache.cpp (original)
+++ lldb/trunk/source/Target/ModuleCache.cpp Wed Jul 24 10:56:10 2019
@@ -94,9 +94,8 @@ void DeleteExistingModule(const FileSpec
   Status error;
   ModuleLock lock(root_dir_spec, module_uuid, error);
   if (error.Fail()) {
-    if (log)
-      log->Printf("Failed to lock module %s: %s",
-                  module_uuid.GetAsString().c_str(), error.AsCString());
+    LLDB_LOGF(log, "Failed to lock module %s: %s",
+              module_uuid.GetAsString().c_str(), error.AsCString());
   }
 
   namespace fs = llvm::sys::fs;

Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Wed Jul 24 10:56:10 2019
@@ -386,8 +386,7 @@ Platform::Platform(bool is_host)
       m_calculated_trap_handlers(false),
       m_module_cache(llvm::make_unique<ModuleCache>()) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
-  if (log)
-    log->Printf("%p Platform::Platform()", static_cast<void *>(this));
+  LLDB_LOGF(log, "%p Platform::Platform()", static_cast<void *>(this));
 }
 
 /// Destructor.
@@ -396,8 +395,7 @@ Platform::Platform(bool is_host)
 /// inherited from by the plug-in instance.
 Platform::~Platform() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
-  if (log)
-    log->Printf("%p Platform::~Platform()", static_cast<void *>(this));
+  LLDB_LOGF(log, "%p Platform::~Platform()", static_cast<void *>(this));
 }
 
 void Platform::GetStatus(Stream &strm) {
@@ -637,9 +635,8 @@ Status Platform::Install(const FileSpec
   Status error;
 
   Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
-  if (log)
-    log->Printf("Platform::Install (src='%s', dst='%s')", src.GetPath().c_str(),
-                dst.GetPath().c_str());
+  LLDB_LOGF(log, "Platform::Install (src='%s', dst='%s')",
+            src.GetPath().c_str(), dst.GetPath().c_str());
   FileSpec fixed_dst(dst);
 
   if (!fixed_dst.GetFilename())
@@ -690,10 +687,9 @@ Status Platform::Install(const FileSpec
     }
   }
 
-  if (log)
-    log->Printf("Platform::Install (src='%s', dst='%s') fixed_dst='%s'",
-                src.GetPath().c_str(), dst.GetPath().c_str(),
-                fixed_dst.GetPath().c_str());
+  LLDB_LOGF(log, "Platform::Install (src='%s', dst='%s') fixed_dst='%s'",
+            src.GetPath().c_str(), dst.GetPath().c_str(),
+            fixed_dst.GetPath().c_str());
 
   if (GetSupportsRSync()) {
     error = PutFile(src, dst);
@@ -821,9 +817,8 @@ ConstString Platform::GetFullNameForDyli
 
 bool Platform::SetRemoteWorkingDirectory(const FileSpec &working_dir) {
   Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
-  if (log)
-    log->Printf("Platform::SetRemoteWorkingDirectory('%s')",
-                working_dir.GetCString());
+  LLDB_LOGF(log, "Platform::SetRemoteWorkingDirectory('%s')",
+            working_dir.GetCString());
   m_working_dir = working_dir;
   return true;
 }
@@ -1010,8 +1005,7 @@ uint32_t Platform::FindProcesses(const P
 Status Platform::LaunchProcess(ProcessLaunchInfo &launch_info) {
   Status error;
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
-  if (log)
-    log->Printf("Platform::%s()", __FUNCTION__);
+  LLDB_LOGF(log, "Platform::%s()", __FUNCTION__);
 
   // Take care of the host case so that each subclass can just call this
   // function to get the host functionality.
@@ -1027,10 +1021,10 @@ Status Platform::LaunchProcess(ProcessLa
       if (log) {
         const FileSpec &shell = launch_info.GetShell();
         std::string shell_str = (shell) ? shell.GetPath() : "<null>";
-        log->Printf(
-            "Platform::%s GetResumeCountForLaunchInfo() returned %" PRIu32
-            ", shell is '%s'",
-            __FUNCTION__, num_resumes, shell_str.c_str());
+        LLDB_LOGF(log,
+                  "Platform::%s GetResumeCountForLaunchInfo() returned %" PRIu32
+                  ", shell is '%s'",
+                  __FUNCTION__, num_resumes, shell_str.c_str());
       }
 
       if (!launch_info.ConvertArgumentsForLaunchingInShell(
@@ -1048,9 +1042,8 @@ Status Platform::LaunchProcess(ProcessLa
       }
     }
 
-    if (log)
-      log->Printf("Platform::%s final launch_info resume count: %" PRIu32,
-                  __FUNCTION__, launch_info.GetResumeCount());
+    LLDB_LOGF(log, "Platform::%s final launch_info resume count: %" PRIu32,
+              __FUNCTION__, launch_info.GetResumeCount());
 
     error = Host::LaunchProcess(launch_info);
   } else
@@ -1067,8 +1060,7 @@ Status Platform::ShellExpandArguments(Pr
 
 Status Platform::KillProcess(const lldb::pid_t pid) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
-  if (log)
-    log->Printf("Platform::%s, pid %" PRIu64, __FUNCTION__, pid);
+  LLDB_LOGF(log, "Platform::%s, pid %" PRIu64, __FUNCTION__, pid);
 
   // Try to find a process plugin to handle this Kill request.  If we can't,
   // fall back to the default OS implementation.
@@ -1098,9 +1090,8 @@ Platform::DebugProcess(ProcessLaunchInfo
                                        // new target, else use existing one
                        Status &error) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
-  if (log)
-    log->Printf("Platform::%s entered (target %p)", __FUNCTION__,
-                static_cast<void *>(target));
+  LLDB_LOGF(log, "Platform::%s entered (target %p)", __FUNCTION__,
+            static_cast<void *>(target));
 
   ProcessSP process_sp;
   // Make sure we stop at the entry point
@@ -1124,10 +1115,10 @@ Platform::DebugProcess(ProcessLaunchInfo
       // Give this ProcessLaunchInfo filter a chance to adjust the launch info.
       error = (*filter_callback)(launch_info, target);
       if (!error.Success()) {
-        if (log)
-          log->Printf("Platform::%s() StructuredDataPlugin launch "
-                      "filter failed.",
-                      __FUNCTION__);
+        LLDB_LOGF(log,
+                  "Platform::%s() StructuredDataPlugin launch "
+                  "filter failed.",
+                  __FUNCTION__);
         return process_sp;
       }
     }
@@ -1135,17 +1126,15 @@ Platform::DebugProcess(ProcessLaunchInfo
 
   error = LaunchProcess(launch_info);
   if (error.Success()) {
-    if (log)
-      log->Printf("Platform::%s LaunchProcess() call succeeded (pid=%" PRIu64
-                  ")",
-                  __FUNCTION__, launch_info.GetProcessID());
+    LLDB_LOGF(log,
+              "Platform::%s LaunchProcess() call succeeded (pid=%" PRIu64 ")",
+              __FUNCTION__, launch_info.GetProcessID());
     if (launch_info.GetProcessID() != LLDB_INVALID_PROCESS_ID) {
       ProcessAttachInfo attach_info(launch_info);
       process_sp = Attach(attach_info, debugger, target, error);
       if (process_sp) {
-        if (log)
-          log->Printf("Platform::%s Attach() succeeded, Process plugin: %s",
-                      __FUNCTION__, process_sp->GetPluginName().AsCString());
+        LLDB_LOGF(log, "Platform::%s Attach() succeeded, Process plugin: %s",
+                  __FUNCTION__, process_sp->GetPluginName().AsCString());
         launch_info.SetHijackListener(attach_info.GetHijackListener());
 
         // Since we attached to the process, it will think it needs to detach
@@ -1163,20 +1152,18 @@ Platform::DebugProcess(ProcessLaunchInfo
           process_sp->SetSTDIOFileDescriptor(pty_fd);
         }
       } else {
-        if (log)
-          log->Printf("Platform::%s Attach() failed: %s", __FUNCTION__,
-                      error.AsCString());
+        LLDB_LOGF(log, "Platform::%s Attach() failed: %s", __FUNCTION__,
+                  error.AsCString());
       }
     } else {
-      if (log)
-        log->Printf("Platform::%s LaunchProcess() returned launch_info with "
-                    "invalid process id",
-                    __FUNCTION__);
+      LLDB_LOGF(log,
+                "Platform::%s LaunchProcess() returned launch_info with "
+                "invalid process id",
+                __FUNCTION__);
     }
   } else {
-    if (log)
-      log->Printf("Platform::%s LaunchProcess() failed: %s", __FUNCTION__,
-                  error.AsCString());
+    LLDB_LOGF(log, "Platform::%s LaunchProcess() failed: %s", __FUNCTION__,
+              error.AsCString());
   }
 
   return process_sp;
@@ -1231,8 +1218,7 @@ bool Platform::IsCompatibleArchitecture(
 Status Platform::PutFile(const FileSpec &source, const FileSpec &destination,
                          uint32_t uid, uint32_t gid) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
-  if (log)
-    log->Printf("[PutFile] Using block by block transfer....\n");
+  LLDB_LOGF(log, "[PutFile] Using block by block transfer....\n");
 
   uint32_t source_open_options =
       File::eOpenOptionRead | File::eOpenOptionCloseOnExec;
@@ -1253,8 +1239,7 @@ Status Platform::PutFile(const FileSpec
       destination, File::eOpenOptionCanCreate | File::eOpenOptionWrite |
                        File::eOpenOptionTruncate | File::eOpenOptionCloseOnExec,
       permissions, error);
-  if (log)
-    log->Printf("dest_file = %" PRIu64 "\n", dest_file);
+  LLDB_LOGF(log, "dest_file = %" PRIu64 "\n", dest_file);
 
   if (error.Fail())
     return error;
@@ -1630,10 +1615,9 @@ bool Platform::GetCachedSharedModule(con
   if (error.Success())
     return true;
 
-  if (log)
-    log->Printf("Platform::%s - module %s not found in local cache: %s",
-                __FUNCTION__, module_spec.GetUUID().GetAsString().c_str(),
-                error.AsCString());
+  LLDB_LOGF(log, "Platform::%s - module %s not found in local cache: %s",
+            __FUNCTION__, module_spec.GetUUID().GetAsString().c_str(),
+            error.AsCString());
   return false;
 }
 

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Wed Jul 24 10:56:10 2019
@@ -544,8 +544,7 @@ Process::Process(lldb::TargetSP target_s
   CheckInWithManager();
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
-  if (log)
-    log->Printf("%p Process::Process()", static_cast<void *>(this));
+  LLDB_LOGF(log, "%p Process::Process()", static_cast<void *>(this));
 
   if (!m_unix_signals_sp)
     m_unix_signals_sp = std::make_shared<UnixSignals>();
@@ -593,8 +592,7 @@ Process::Process(lldb::TargetSP target_s
 
 Process::~Process() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
-  if (log)
-    log->Printf("%p Process::~Process()", static_cast<void *>(this));
+  LLDB_LOGF(log, "%p Process::~Process()", static_cast<void *>(this));
   StopPrivateStateThread();
 
   // ThreadList::Clear() will try to acquire this process's mutex, so
@@ -781,10 +779,10 @@ StateType Process::WaitForProcessToStop(
 
   if (!wait_always && StateIsStoppedState(state, true) &&
       StateIsStoppedState(GetPrivateState(), true)) {
-    if (log)
-      log->Printf("Process::%s returning without waiting for events; process "
-                  "private and public states are already 'stopped'.",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "Process::%s returning without waiting for events; process "
+              "private and public states are already 'stopped'.",
+              __FUNCTION__);
     // We need to toggle the run lock as this won't get done in
     // SetPublicState() if the process is hijacked.
     if (hijack_listener_sp && use_run_lock)
@@ -1073,19 +1071,17 @@ StateType Process::GetStateChangedEvents
 Event *Process::PeekAtStateChangedEvents() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
 
-  if (log)
-    log->Printf("Process::%s...", __FUNCTION__);
+  LLDB_LOGF(log, "Process::%s...", __FUNCTION__);
 
   Event *event_ptr;
   event_ptr = m_listener_sp->PeekAtNextEventForBroadcasterWithType(
       this, eBroadcastBitStateChanged);
   if (log) {
     if (event_ptr) {
-      log->Printf(
-          "Process::%s (event_ptr) => %s", __FUNCTION__,
-          StateAsCString(ProcessEventData::GetStateFromEvent(event_ptr)));
+      LLDB_LOGF(log, "Process::%s (event_ptr) => %s", __FUNCTION__,
+                StateAsCString(ProcessEventData::GetStateFromEvent(event_ptr)));
     } else {
-      log->Printf("Process::%s no events found", __FUNCTION__);
+      LLDB_LOGF(log, "Process::%s no events found", __FUNCTION__);
     }
   }
   return event_ptr;
@@ -1149,17 +1145,14 @@ bool Process::SetExitStatus(int status,
 
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE |
                                                   LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf(
-        "Process::SetExitStatus (status=%i (0x%8.8x), description=%s%s%s)",
-        status, status, cstr ? "\"" : "", cstr ? cstr : "NULL",
-        cstr ? "\"" : "");
+  LLDB_LOGF(
+      log, "Process::SetExitStatus (status=%i (0x%8.8x), description=%s%s%s)",
+      status, status, cstr ? "\"" : "", cstr ? cstr : "NULL", cstr ? "\"" : "");
 
   // We were already in the exited state
   if (m_private_state.GetValue() == eStateExited) {
-    if (log)
-      log->Printf("Process::SetExitStatus () ignoring exit status because "
-                  "state was already set to eStateExited");
+    LLDB_LOGF(log, "Process::SetExitStatus () ignoring exit status because "
+                   "state was already set to eStateExited");
     return false;
   }
 
@@ -1207,10 +1200,10 @@ bool Process::SetProcessExitStatus(
     int exit_status // Exit value of process if signal is zero
     ) {
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("Process::SetProcessExitStatus (pid=%" PRIu64
-                ", exited=%i, signal=%i, exit_status=%i)\n",
-                pid, exited, signo, exit_status);
+  LLDB_LOGF(log,
+            "Process::SetProcessExitStatus (pid=%" PRIu64
+            ", exited=%i, signal=%i, exit_status=%i)\n",
+            pid, exited, signo, exit_status);
 
   if (exited) {
     TargetSP target_sp(Debugger::FindTargetWithProcessID(pid));
@@ -1353,9 +1346,8 @@ StateType Process::GetState() {
 void Process::SetPublicState(StateType new_state, bool restarted) {
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE |
                                                   LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("Process::SetPublicState (state = %s, restarted = %i)",
-                StateAsCString(new_state), restarted);
+  LLDB_LOGF(log, "Process::SetPublicState (state = %s, restarted = %i)",
+            StateAsCString(new_state), restarted);
   const StateType old_state = m_public_state.GetValue();
   m_public_state.SetValue(new_state);
 
@@ -1364,19 +1356,17 @@ void Process::SetPublicState(StateType n
   // program to run.
   if (!StateChangedIsExternallyHijacked()) {
     if (new_state == eStateDetached) {
-      if (log)
-        log->Printf(
-            "Process::SetPublicState (%s) -- unlocking run lock for detach",
-            StateAsCString(new_state));
+      LLDB_LOGF(log,
+                "Process::SetPublicState (%s) -- unlocking run lock for detach",
+                StateAsCString(new_state));
       m_public_run_lock.SetStopped();
     } else {
       const bool old_state_is_stopped = StateIsStoppedState(old_state, false);
       const bool new_state_is_stopped = StateIsStoppedState(new_state, false);
       if ((old_state_is_stopped != new_state_is_stopped)) {
         if (new_state_is_stopped && !restarted) {
-          if (log)
-            log->Printf("Process::SetPublicState (%s) -- unlocking run lock",
-                        StateAsCString(new_state));
+          LLDB_LOGF(log, "Process::SetPublicState (%s) -- unlocking run lock",
+                    StateAsCString(new_state));
           m_public_run_lock.SetStopped();
         }
       }
@@ -1387,12 +1377,10 @@ void Process::SetPublicState(StateType n
 Status Process::Resume() {
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE |
                                                   LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("Process::Resume -- locking run lock");
+  LLDB_LOGF(log, "Process::Resume -- locking run lock");
   if (!m_public_run_lock.TrySetRunning()) {
     Status error("Resume request failed - process still running.");
-    if (log)
-      log->Printf("Process::Resume: -- TrySetRunning failed, not resuming.");
+    LLDB_LOGF(log, "Process::Resume: -- TrySetRunning failed, not resuming.");
     return error;
   }
   Status error = PrivateResume();
@@ -1408,12 +1396,10 @@ static const char *g_resume_sync_name =
 Status Process::ResumeSynchronous(Stream *stream) {
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE |
                                                   LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("Process::ResumeSynchronous -- locking run lock");
+  LLDB_LOGF(log, "Process::ResumeSynchronous -- locking run lock");
   if (!m_public_run_lock.TrySetRunning()) {
     Status error("Resume request failed - process still running.");
-    if (log)
-      log->Printf("Process::Resume: -- TrySetRunning failed, not resuming.");
+    LLDB_LOGF(log, "Process::Resume: -- TrySetRunning failed, not resuming.");
     return error;
   }
 
@@ -1472,8 +1458,7 @@ void Process::SetPrivateState(StateType
                                                   LIBLLDB_LOG_PROCESS));
   bool state_changed = false;
 
-  if (log)
-    log->Printf("Process::SetPrivateState (%s)", StateAsCString(new_state));
+  LLDB_LOGF(log, "Process::SetPrivateState (%s)", StateAsCString(new_state));
 
   std::lock_guard<std::recursive_mutex> thread_guard(m_thread_list.GetMutex());
   std::lock_guard<std::recursive_mutex> guard(m_private_state.GetMutex());
@@ -1512,9 +1497,8 @@ void Process::SetPrivateState(StateType
       if (!m_mod_id.IsLastResumeForUserExpression())
         m_mod_id.SetStopEventForLastNaturalStopID(event_sp);
       m_memory_cache.Clear();
-      if (log)
-        log->Printf("Process::SetPrivateState (%s) stop_id = %u",
-                    StateAsCString(new_state), m_mod_id.GetStopID());
+      LLDB_LOGF(log, "Process::SetPrivateState (%s) stop_id = %u",
+                StateAsCString(new_state), m_mod_id.GetStopID());
     }
 
     // Use our target to get a shared pointer to ourselves...
@@ -1523,10 +1507,9 @@ void Process::SetPrivateState(StateType
     else
       m_private_state_broadcaster.BroadcastEvent(event_sp);
   } else {
-    if (log)
-      log->Printf(
-          "Process::SetPrivateState (%s) state didn't change. Ignoring...",
-          StateAsCString(new_state));
+    LLDB_LOGF(log,
+              "Process::SetPrivateState (%s) state didn't change. Ignoring...",
+              StateAsCString(new_state));
   }
 }
 
@@ -1816,16 +1799,15 @@ Status Process::EnableSoftwareBreakpoint
   assert(bp_site != nullptr);
   Log *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%" PRIx64,
-        bp_site->GetID(), (uint64_t)bp_addr);
+  LLDB_LOGF(
+      log, "Process::EnableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64,
+      bp_site->GetID(), (uint64_t)bp_addr);
   if (bp_site->IsEnabled()) {
-    if (log)
-      log->Printf(
-          "Process::EnableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64
-          " -- already enabled",
-          bp_site->GetID(), (uint64_t)bp_addr);
+    LLDB_LOGF(
+        log,
+        "Process::EnableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64
+        " -- already enabled",
+        bp_site->GetID(), (uint64_t)bp_addr);
     return error;
   }
 
@@ -1864,10 +1846,10 @@ Status Process::EnableSoftwareBreakpoint
                        bp_opcode_size) == 0) {
             bp_site->SetEnabled(true);
             bp_site->SetType(BreakpointSite::eSoftware);
-            if (log)
-              log->Printf("Process::EnableSoftwareBreakpoint (site_id = %d) "
-                          "addr = 0x%" PRIx64 " -- SUCCESS",
-                          bp_site->GetID(), (uint64_t)bp_addr);
+            LLDB_LOGF(log,
+                      "Process::EnableSoftwareBreakpoint (site_id = %d) "
+                      "addr = 0x%" PRIx64 " -- SUCCESS",
+                      bp_site->GetID(), (uint64_t)bp_addr);
           } else
             error.SetErrorString(
                 "failed to verify the breakpoint trap in memory.");
@@ -1880,7 +1862,8 @@ Status Process::EnableSoftwareBreakpoint
       error.SetErrorString("Unable to read memory at breakpoint address.");
   }
   if (log && error.Fail())
-    log->Printf(
+    LLDB_LOGF(
+        log,
         "Process::EnableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64
         " -- FAILED: %s",
         bp_site->GetID(), (uint64_t)bp_addr, error.AsCString());
@@ -1893,10 +1876,10 @@ Status Process::DisableSoftwareBreakpoin
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
   addr_t bp_addr = bp_site->GetLoadAddress();
   lldb::user_id_t breakID = bp_site->GetID();
-  if (log)
-    log->Printf("Process::DisableSoftwareBreakpoint (breakID = %" PRIu64
-                ") addr = 0x%" PRIx64,
-                breakID, (uint64_t)bp_addr);
+  LLDB_LOGF(log,
+            "Process::DisableSoftwareBreakpoint (breakID = %" PRIu64
+            ") addr = 0x%" PRIx64,
+            breakID, (uint64_t)bp_addr);
 
   if (bp_site->IsHardware()) {
     error.SetErrorString("Breakpoint site is a hardware breakpoint.");
@@ -1943,10 +1926,10 @@ Status Process::DisableSoftwareBreakpoin
                          break_op_size) == 0) {
               // SUCCESS
               bp_site->SetEnabled(false);
-              if (log)
-                log->Printf("Process::DisableSoftwareBreakpoint (site_id = %d) "
-                            "addr = 0x%" PRIx64 " -- SUCCESS",
-                            bp_site->GetID(), (uint64_t)bp_addr);
+              LLDB_LOGF(log,
+                        "Process::DisableSoftwareBreakpoint (site_id = %d) "
+                        "addr = 0x%" PRIx64 " -- SUCCESS",
+                        bp_site->GetID(), (uint64_t)bp_addr);
               return error;
             } else {
               if (break_op_found)
@@ -1961,19 +1944,19 @@ Status Process::DisableSoftwareBreakpoin
             "Unable to read memory that should contain the breakpoint trap.");
     }
   } else {
-    if (log)
-      log->Printf(
-          "Process::DisableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64
-          " -- already disabled",
-          bp_site->GetID(), (uint64_t)bp_addr);
+    LLDB_LOGF(
+        log,
+        "Process::DisableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64
+        " -- already disabled",
+        bp_site->GetID(), (uint64_t)bp_addr);
     return error;
   }
 
-  if (log)
-    log->Printf(
-        "Process::DisableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64
-        " -- FAILED: %s",
-        bp_site->GetID(), (uint64_t)bp_addr, error.AsCString());
+  LLDB_LOGF(
+      log,
+      "Process::DisableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64
+      " -- FAILED: %s",
+      bp_site->GetID(), (uint64_t)bp_addr, error.AsCString());
   return error;
 }
 
@@ -2371,13 +2354,13 @@ addr_t Process::AllocateMemory(size_t si
 #else
   addr_t allocated_addr = DoAllocateMemory(size, permissions, error);
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("Process::AllocateMemory(size=%" PRIu64
-                ", permissions=%s) => 0x%16.16" PRIx64
-                " (m_stop_id = %u m_memory_id = %u)",
-                (uint64_t)size, GetPermissionsAsCString(permissions),
-                (uint64_t)allocated_addr, m_mod_id.GetStopID(),
-                m_mod_id.GetMemoryID());
+  LLDB_LOGF(log,
+            "Process::AllocateMemory(size=%" PRIu64
+            ", permissions=%s) => 0x%16.16" PRIx64
+            " (m_stop_id = %u m_memory_id = %u)",
+            (uint64_t)size, GetPermissionsAsCString(permissions),
+            (uint64_t)allocated_addr, m_mod_id.GetStopID(),
+            m_mod_id.GetMemoryID());
   return allocated_addr;
 #endif
 }
@@ -2403,16 +2386,16 @@ bool Process::CanJIT() {
 
     if (err.Success()) {
       m_can_jit = eCanJITYes;
-      if (log)
-        log->Printf("Process::%s pid %" PRIu64
-                    " allocation test passed, CanJIT () is true",
-                    __FUNCTION__, GetID());
+      LLDB_LOGF(log,
+                "Process::%s pid %" PRIu64
+                " allocation test passed, CanJIT () is true",
+                __FUNCTION__, GetID());
     } else {
       m_can_jit = eCanJITNo;
-      if (log)
-        log->Printf("Process::%s pid %" PRIu64
-                    " allocation test failed, CanJIT () is false: %s",
-                    __FUNCTION__, GetID(), err.AsCString());
+      LLDB_LOGF(log,
+                "Process::%s pid %" PRIu64
+                " allocation test failed, CanJIT () is false: %s",
+                __FUNCTION__, GetID(), err.AsCString());
     }
 
     DeallocateMemory(allocated_memory);
@@ -2441,11 +2424,11 @@ Status Process::DeallocateMemory(addr_t
   error = DoDeallocateMemory(ptr);
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("Process::DeallocateMemory(addr=0x%16.16" PRIx64
-                ") => err = %s (m_stop_id = %u, m_memory_id = %u)",
-                ptr, error.AsCString("SUCCESS"), m_mod_id.GetStopID(),
-                m_mod_id.GetMemoryID());
+  LLDB_LOGF(log,
+            "Process::DeallocateMemory(addr=0x%16.16" PRIx64
+            ") => err = %s (m_stop_id = %u, m_memory_id = %u)",
+            ptr, error.AsCString("SUCCESS"), m_mod_id.GetStopID(),
+            m_mod_id.GetMemoryID());
 #endif
   return error;
 }
@@ -2455,8 +2438,9 @@ ModuleSP Process::ReadModuleFromMemory(c
                                        size_t size_to_read) {
   Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
   if (log) {
-    log->Printf("Process::ReadModuleFromMemory reading %s binary from memory",
-                file_spec.GetPath().c_str());
+    LLDB_LOGF(log,
+              "Process::ReadModuleFromMemory reading %s binary from memory",
+              file_spec.GetPath().c_str());
   }
   ModuleSP module_sp(new Module(file_spec, ArchSpec()));
   if (module_sp) {
@@ -2691,9 +2675,8 @@ Status Process::LoadCore() {
 
     if (!StateIsStoppedState(state, false)) {
       Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-      if (log)
-        log->Printf("Process::Halt() failed to stop, state is: %s",
-                    StateAsCString(state));
+      LLDB_LOGF(log, "Process::Halt() failed to stop, state is: %s",
+                StateAsCString(state));
       error.SetErrorString(
           "Did not get stopped event after loading the core file.");
     }
@@ -2728,10 +2711,10 @@ Process::AttachCompletionHandler::Attach
                                                           uint32_t exec_count)
     : NextEventAction(process), m_exec_count(exec_count) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf(
-        "Process::AttachCompletionHandler::%s process=%p, exec_count=%" PRIu32,
-        __FUNCTION__, static_cast<void *>(process), exec_count);
+  LLDB_LOGF(
+      log,
+      "Process::AttachCompletionHandler::%s process=%p, exec_count=%" PRIu32,
+      __FUNCTION__, static_cast<void *>(process), exec_count);
 }
 
 Process::NextEventAction::EventActionResult
@@ -2739,10 +2722,9 @@ Process::AttachCompletionHandler::Perfor
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
 
   StateType state = ProcessEventData::GetStateFromEvent(event_sp.get());
-  if (log)
-    log->Printf(
-        "Process::AttachCompletionHandler::%s called with state %s (%d)",
-        __FUNCTION__, StateAsCString(state), static_cast<int>(state));
+  LLDB_LOGF(log,
+            "Process::AttachCompletionHandler::%s called with state %s (%d)",
+            __FUNCTION__, StateAsCString(state), static_cast<int>(state));
 
   switch (state) {
   case eStateAttaching:
@@ -2764,18 +2746,18 @@ Process::AttachCompletionHandler::Perfor
     if (m_exec_count > 0) {
       --m_exec_count;
 
-      if (log)
-        log->Printf("Process::AttachCompletionHandler::%s state %s: reduced "
-                    "remaining exec count to %" PRIu32 ", requesting resume",
-                    __FUNCTION__, StateAsCString(state), m_exec_count);
+      LLDB_LOGF(log,
+                "Process::AttachCompletionHandler::%s state %s: reduced "
+                "remaining exec count to %" PRIu32 ", requesting resume",
+                __FUNCTION__, StateAsCString(state), m_exec_count);
 
       RequestResume();
       return eEventActionRetry;
     } else {
-      if (log)
-        log->Printf("Process::AttachCompletionHandler::%s state %s: no more "
-                    "execs expected to start, continuing with attach",
-                    __FUNCTION__, StateAsCString(state));
+      LLDB_LOGF(log,
+                "Process::AttachCompletionHandler::%s state %s: no more "
+                "execs expected to start, continuing with attach",
+                __FUNCTION__, StateAsCString(state));
 
       m_process->CompleteAttach();
       return eEventActionSuccess;
@@ -2932,8 +2914,7 @@ Status Process::Attach(ProcessAttachInfo
 void Process::CompleteAttach() {
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS |
                                                   LIBLLDB_LOG_TARGET));
-  if (log)
-    log->Printf("Process::%s()", __FUNCTION__);
+  LLDB_LOGF(log, "Process::%s()", __FUNCTION__);
 
   // Let the process subclass figure out at much as it can about the process
   // before we go looking for a dynamic loader plug-in.
@@ -2944,9 +2925,10 @@ void Process::CompleteAttach() {
     GetTarget().SetArchitecture(process_arch);
     if (log) {
       const char *triple_str = process_arch.GetTriple().getTriple().c_str();
-      log->Printf("Process::%s replacing process architecture with DidAttach() "
-                  "architecture: %s",
-                  __FUNCTION__, triple_str ? triple_str : "<null>");
+      LLDB_LOGF(log,
+                "Process::%s replacing process architecture with DidAttach() "
+                "architecture: %s",
+                __FUNCTION__, triple_str ? triple_str : "<null>");
     }
   }
 
@@ -2965,11 +2947,11 @@ void Process::CompleteAttach() {
       if (platform_sp) {
         GetTarget().SetPlatform(platform_sp);
         GetTarget().SetArchitecture(platform_arch);
-        if (log)
-          log->Printf("Process::%s switching platform to %s and architecture "
-                      "to %s based on info from attach",
-                      __FUNCTION__, platform_sp->GetName().AsCString(""),
-                      platform_arch.GetTriple().getTriple().c_str());
+        LLDB_LOGF(log,
+                  "Process::%s switching platform to %s and architecture "
+                  "to %s based on info from attach",
+                  __FUNCTION__, platform_sp->GetName().AsCString(""),
+                  platform_arch.GetTriple().getTriple().c_str());
       }
     } else if (!process_arch.IsValid()) {
       ProcessInstanceInfo process_info;
@@ -2978,11 +2960,11 @@ void Process::CompleteAttach() {
       if (process_arch.IsValid() &&
           !GetTarget().GetArchitecture().IsExactMatch(process_arch)) {
         GetTarget().SetArchitecture(process_arch);
-        if (log)
-          log->Printf("Process::%s switching architecture to %s based on info "
-                      "the platform retrieved for pid %" PRIu64,
-                      __FUNCTION__,
-                      process_arch.GetTriple().getTriple().c_str(), GetID());
+        LLDB_LOGF(log,
+                  "Process::%s switching architecture to %s based on info "
+                  "the platform retrieved for pid %" PRIu64,
+                  __FUNCTION__, process_arch.GetTriple().getTriple().c_str(),
+                  GetID());
       }
     }
   }
@@ -2994,12 +2976,13 @@ void Process::CompleteAttach() {
     dyld->DidAttach();
     if (log) {
       ModuleSP exe_module_sp = GetTarget().GetExecutableModule();
-      log->Printf("Process::%s after DynamicLoader::DidAttach(), target "
-                  "executable is %s (using %s plugin)",
-                  __FUNCTION__,
-                  exe_module_sp ? exe_module_sp->GetFileSpec().GetPath().c_str()
-                                : "<none>",
-                  dyld->GetPluginName().AsCString("<unnamed>"));
+      LLDB_LOGF(log,
+                "Process::%s after DynamicLoader::DidAttach(), target "
+                "executable is %s (using %s plugin)",
+                __FUNCTION__,
+                exe_module_sp ? exe_module_sp->GetFileSpec().GetPath().c_str()
+                              : "<none>",
+                dyld->GetPluginName().AsCString("<unnamed>"));
     }
   }
 
@@ -3010,12 +2993,13 @@ void Process::CompleteAttach() {
     system_runtime->DidAttach();
     if (log) {
       ModuleSP exe_module_sp = GetTarget().GetExecutableModule();
-      log->Printf("Process::%s after SystemRuntime::DidAttach(), target "
-                  "executable is %s (using %s plugin)",
-                  __FUNCTION__,
-                  exe_module_sp ? exe_module_sp->GetFileSpec().GetPath().c_str()
-                                : "<none>",
-                  system_runtime->GetPluginName().AsCString("<unnamed>"));
+      LLDB_LOGF(log,
+                "Process::%s after SystemRuntime::DidAttach(), target "
+                "executable is %s (using %s plugin)",
+                __FUNCTION__,
+                exe_module_sp ? exe_module_sp->GetFileSpec().GetPath().c_str()
+                              : "<none>",
+                system_runtime->GetPluginName().AsCString("<unnamed>"));
     }
   }
 
@@ -3048,7 +3032,8 @@ void Process::CompleteAttach() {
                                     eLoadDependentsNo);
     if (log) {
       ModuleSP exe_module_sp = GetTarget().GetExecutableModule();
-      log->Printf(
+      LLDB_LOGF(
+          log,
           "Process::%s after looping through modules, target executable is %s",
           __FUNCTION__,
           exe_module_sp ? exe_module_sp->GetFileSpec().GetPath().c_str()
@@ -3092,11 +3077,11 @@ Status Process::ConnectRemote(Stream *st
 Status Process::PrivateResume() {
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS |
                                                   LIBLLDB_LOG_STEP));
-  if (log)
-    log->Printf("Process::PrivateResume() m_stop_id = %u, public state: %s "
-                "private state: %s",
-                m_mod_id.GetStopID(), StateAsCString(m_public_state.GetValue()),
-                StateAsCString(m_private_state.GetValue()));
+  LLDB_LOGF(log,
+            "Process::PrivateResume() m_stop_id = %u, public state: %s "
+            "private state: %s",
+            m_mod_id.GetStopID(), StateAsCString(m_public_state.GetValue()),
+            StateAsCString(m_private_state.GetValue()));
 
   // If signals handing status changed we might want to update our signal
   // filters before resuming.
@@ -3123,12 +3108,9 @@ Status Process::PrivateResume() {
         if (error.Success()) {
           DidResume();
           m_thread_list.DidResume();
-          if (log)
-            log->Printf("Process thinks the process has resumed.");
+          LLDB_LOGF(log, "Process thinks the process has resumed.");
         } else {
-          if (log)
-            log->Printf(
-                "Process::PrivateResume() DoResume failed.");
+          LLDB_LOGF(log, "Process::PrivateResume() DoResume failed.");
           return error;
         }
       }
@@ -3137,16 +3119,15 @@ Status Process::PrivateResume() {
       // from one frame of a set of inlined frames that share the same PC to
       // another.)  So generate a continue & a stopped event, and let the world
       // handle them.
-      if (log)
-        log->Printf(
-            "Process::PrivateResume() asked to simulate a start & stop.");
+      LLDB_LOGF(log,
+                "Process::PrivateResume() asked to simulate a start & stop.");
 
       SetPrivateState(eStateRunning);
       SetPrivateState(eStateStopped);
     }
-  } else if (log)
-    log->Printf("Process::PrivateResume() got an error \"%s\".",
-                error.AsCString("<unknown error>"));
+  } else
+    LLDB_LOGF(log, "Process::PrivateResume() got an error \"%s\".",
+              error.AsCString("<unknown error>"));
   return error;
 }
 
@@ -3199,8 +3180,7 @@ Status Process::StopForDestroyOrDetach(l
   if (m_public_state.GetValue() == eStateRunning ||
       m_private_state.GetValue() == eStateRunning) {
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-    if (log)
-      log->Printf("Process::%s() About to stop.", __FUNCTION__);
+    LLDB_LOGF(log, "Process::%s() About to stop.", __FUNCTION__);
 
     ListenerSP listener_sp(
         Listener::MakeListener("lldb.Process.StopForDestroyOrDetach.hijack"));
@@ -3220,17 +3200,15 @@ Status Process::StopForDestroyOrDetach(l
     // anymore...
 
     if (state == eStateExited || m_private_state.GetValue() == eStateExited) {
-      if (log)
-        log->Printf("Process::%s() Process exited while waiting to stop.",
-                    __FUNCTION__);
+      LLDB_LOGF(log, "Process::%s() Process exited while waiting to stop.",
+                __FUNCTION__);
       return error;
     } else
       exit_event_sp.reset(); // It is ok to consume any non-exit stop events
 
     if (state != eStateStopped) {
-      if (log)
-        log->Printf("Process::%s() failed to stop, state is: %s", __FUNCTION__,
-                    StateAsCString(state));
+      LLDB_LOGF(log, "Process::%s() failed to stop, state is: %s", __FUNCTION__,
+                StateAsCString(state));
       // If we really couldn't stop the process then we should just error out
       // here, but if the lower levels just bobbled sending the event and we
       // really are stopped, then continue on.
@@ -3475,10 +3453,10 @@ bool Process::ShouldBroadcastEvent(Event
     m_stdio_communication.SynchronizeWithReadThread();
     RefreshStateAfterStop();
     if (ProcessEventData::GetInterruptedFromEvent(event_ptr)) {
-      if (log)
-        log->Printf("Process::ShouldBroadcastEvent (%p) stopped due to an "
-                    "interrupt, state: %s",
-                    static_cast<void *>(event_ptr), StateAsCString(state));
+      LLDB_LOGF(log,
+                "Process::ShouldBroadcastEvent (%p) stopped due to an "
+                "interrupt, state: %s",
+                static_cast<void *>(event_ptr), StateAsCString(state));
       // Even though we know we are going to stop, we should let the threads
       // have a look at the stop, so they can properly set their state.
       m_thread_list.ShouldStop(event_ptr);
@@ -3496,11 +3474,11 @@ bool Process::ShouldBroadcastEvent(Event
 
       if (was_restarted || should_resume || m_resume_requested) {
         Vote stop_vote = m_thread_list.ShouldReportStop(event_ptr);
-        if (log)
-          log->Printf("Process::ShouldBroadcastEvent: should_resume: %i state: "
-                      "%s was_restarted: %i stop_vote: %d.",
-                      should_resume, StateAsCString(state), was_restarted,
-                      stop_vote);
+        LLDB_LOGF(log,
+                  "Process::ShouldBroadcastEvent: should_resume: %i state: "
+                  "%s was_restarted: %i stop_vote: %d.",
+                  should_resume, StateAsCString(state), was_restarted,
+                  stop_vote);
 
         switch (stop_vote) {
         case eVoteYes:
@@ -3513,10 +3491,10 @@ bool Process::ShouldBroadcastEvent(Event
         }
 
         if (!was_restarted) {
-          if (log)
-            log->Printf("Process::ShouldBroadcastEvent (%p) Restarting process "
-                        "from state: %s",
-                        static_cast<void *>(event_ptr), StateAsCString(state));
+          LLDB_LOGF(log,
+                    "Process::ShouldBroadcastEvent (%p) Restarting process "
+                    "from state: %s",
+                    static_cast<void *>(event_ptr), StateAsCString(state));
           ProcessEventData::SetRestartedInEvent(event_ptr, true);
           PrivateResume();
         }
@@ -3543,12 +3521,12 @@ bool Process::ShouldBroadcastEvent(Event
   if (return_value)
     m_last_broadcast_state = state;
 
-  if (log)
-    log->Printf("Process::ShouldBroadcastEvent (%p) => new state: %s, last "
-                "broadcast state: %s - %s",
-                static_cast<void *>(event_ptr), StateAsCString(state),
-                StateAsCString(m_last_broadcast_state),
-                return_value ? "YES" : "NO");
+  LLDB_LOGF(log,
+            "Process::ShouldBroadcastEvent (%p) => new state: %s, last "
+            "broadcast state: %s - %s",
+            static_cast<void *>(event_ptr), StateAsCString(state),
+            StateAsCString(m_last_broadcast_state),
+            return_value ? "YES" : "NO");
   return return_value;
 }
 
@@ -3556,10 +3534,9 @@ bool Process::StartPrivateStateThread(bo
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS));
 
   bool already_running = PrivateStateThreadIsValid();
-  if (log)
-    log->Printf("Process::%s()%s ", __FUNCTION__,
-                already_running ? " already running"
-                                : " starting private state thread");
+  LLDB_LOGF(log, "Process::%s()%s ", __FUNCTION__,
+            already_running ? " already running"
+                            : " starting private state thread");
 
   if (!is_secondary_thread && already_running)
     return true;
@@ -3617,9 +3594,9 @@ void Process::StopPrivateStateThread() {
     ControlPrivateStateThread(eBroadcastInternalStateControlStop);
   else {
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-    if (log)
-      log->Printf(
-          "Went to stop the private state thread, but it was already invalid.");
+    LLDB_LOGF(
+        log,
+        "Went to stop the private state thread, but it was already invalid.");
   }
 }
 
@@ -3630,8 +3607,7 @@ void Process::ControlPrivateStateThread(
          signal == eBroadcastInternalStateControlPause ||
          signal == eBroadcastInternalStateControlResume);
 
-  if (log)
-    log->Printf("Process::%s (signal = %d)", __FUNCTION__, signal);
+  LLDB_LOGF(log, "Process::%s (signal = %d)", __FUNCTION__, signal);
 
   // Signal the private state thread
   if (m_private_state_thread.IsJoinable()) {
@@ -3640,8 +3616,7 @@ void Process::ControlPrivateStateThread(
     // possible that the thread state is invalid but that the thread is waiting
     // on a control event instead of simply being on its way out (this should
     // not happen, but it apparently can).
-    if (log)
-      log->Printf("Sending control event of type: %d.", signal);
+    LLDB_LOGF(log, "Sending control event of type: %d.", signal);
     std::shared_ptr<EventDataReceipt> event_receipt_sp(new EventDataReceipt());
     m_private_state_control_broadcaster.BroadcastEvent(signal,
                                                        event_receipt_sp);
@@ -3669,9 +3644,9 @@ void Process::ControlPrivateStateThread(
       m_private_state_thread.Reset();
     }
   } else {
-    if (log)
-      log->Printf(
-          "Private state thread already dead, no need to signal it to stop.");
+    LLDB_LOGF(
+        log,
+        "Private state thread already dead, no need to signal it to stop.");
   }
 }
 
@@ -3694,8 +3669,7 @@ void Process::HandlePrivateEvent(EventSP
   if (m_next_event_action_up) {
     NextEventAction::EventActionResult action_result =
         m_next_event_action_up->PerformAction(event_sp);
-    if (log)
-      log->Printf("Ran next event action, result was %d.", action_result);
+    LLDB_LOGF(log, "Ran next event action, result was %d.", action_result);
 
     switch (action_result) {
     case NextEventAction::eEventActionSuccess:
@@ -3726,11 +3700,12 @@ void Process::HandlePrivateEvent(EventSP
   if (should_broadcast) {
     const bool is_hijacked = IsHijackedForEvent(eBroadcastBitStateChanged);
     if (log) {
-      log->Printf("Process::%s (pid = %" PRIu64
-                  ") broadcasting new state %s (old state %s) to %s",
-                  __FUNCTION__, GetID(), StateAsCString(new_state),
-                  StateAsCString(GetState()),
-                  is_hijacked ? "hijacked" : "public");
+      LLDB_LOGF(log,
+                "Process::%s (pid = %" PRIu64
+                ") broadcasting new state %s (old state %s) to %s",
+                __FUNCTION__, GetID(), StateAsCString(new_state),
+                StateAsCString(GetState()),
+                is_hijacked ? "hijacked" : "public");
     }
     Process::ProcessEventData::SetUpdateStateOnRemoval(event_sp.get());
     if (StateIsRunningState(new_state)) {
@@ -3742,9 +3717,8 @@ void Process::HandlePrivateEvent(EventSP
         PushProcessIOHandler();
         m_iohandler_sync.SetValue(m_iohandler_sync.GetValue() + 1,
                                   eBroadcastAlways);
-        if (log)
-          log->Printf("Process::%s updated m_iohandler_sync to %d",
-                      __FUNCTION__, m_iohandler_sync.GetValue());
+        LLDB_LOGF(log, "Process::%s updated m_iohandler_sync to %d",
+                  __FUNCTION__, m_iohandler_sync.GetValue());
       }
     } else if (StateIsStoppedState(new_state, false)) {
       if (!Process::ProcessEventData::GetRestartedFromEvent(event_sp.get())) {
@@ -3785,7 +3759,8 @@ void Process::HandlePrivateEvent(EventSP
     BroadcastEvent(event_sp);
   } else {
     if (log) {
-      log->Printf(
+      LLDB_LOGF(
+          log,
           "Process::%s (pid = %" PRIu64
           ") suppressing state %s (old state %s): should_broadcast == false",
           __FUNCTION__, GetID(), StateAsCString(new_state),
@@ -3820,9 +3795,8 @@ thread_result_t Process::RunPrivateState
   bool control_only = true;
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("Process::%s (arg = %p, pid = %" PRIu64 ") thread starting...",
-                __FUNCTION__, static_cast<void *>(this), GetID());
+  LLDB_LOGF(log, "Process::%s (arg = %p, pid = %" PRIu64 ") thread starting...",
+            __FUNCTION__, static_cast<void *>(this), GetID());
 
   bool exit_now = false;
   bool interrupt_requested = false;
@@ -3830,11 +3804,11 @@ thread_result_t Process::RunPrivateState
     EventSP event_sp;
     GetEventsPrivate(event_sp, llvm::None, control_only);
     if (event_sp->BroadcasterIs(&m_private_state_control_broadcaster)) {
-      if (log)
-        log->Printf("Process::%s (arg = %p, pid = %" PRIu64
-                    ") got a control event: %d",
-                    __FUNCTION__, static_cast<void *>(this), GetID(),
-                    event_sp->GetType());
+      LLDB_LOGF(log,
+                "Process::%s (arg = %p, pid = %" PRIu64
+                ") got a control event: %d",
+                __FUNCTION__, static_cast<void *>(this), GetID(),
+                event_sp->GetType());
 
       switch (event_sp->GetType()) {
       case eBroadcastInternalStateControlStop:
@@ -3853,23 +3827,24 @@ thread_result_t Process::RunPrivateState
       continue;
     } else if (event_sp->GetType() == eBroadcastBitInterrupt) {
       if (m_public_state.GetValue() == eStateAttaching) {
-        if (log)
-          log->Printf("Process::%s (arg = %p, pid = %" PRIu64
-                      ") woke up with an interrupt while attaching - "
-                      "forwarding interrupt.",
-                      __FUNCTION__, static_cast<void *>(this), GetID());
+        LLDB_LOGF(log,
+                  "Process::%s (arg = %p, pid = %" PRIu64
+                  ") woke up with an interrupt while attaching - "
+                  "forwarding interrupt.",
+                  __FUNCTION__, static_cast<void *>(this), GetID());
         BroadcastEvent(eBroadcastBitInterrupt, nullptr);
       } else if (StateIsRunningState(m_last_broadcast_state)) {
-        if (log)
-          log->Printf("Process::%s (arg = %p, pid = %" PRIu64
-                      ") woke up with an interrupt - Halting.",
-                      __FUNCTION__, static_cast<void *>(this), GetID());
+        LLDB_LOGF(log,
+                  "Process::%s (arg = %p, pid = %" PRIu64
+                  ") woke up with an interrupt - Halting.",
+                  __FUNCTION__, static_cast<void *>(this), GetID());
         Status error = HaltPrivate();
         if (error.Fail() && log)
-          log->Printf("Process::%s (arg = %p, pid = %" PRIu64
-                      ") failed to halt the process: %s",
-                      __FUNCTION__, static_cast<void *>(this), GetID(),
-                      error.AsCString());
+          LLDB_LOGF(log,
+                    "Process::%s (arg = %p, pid = %" PRIu64
+                    ") failed to halt the process: %s",
+                    __FUNCTION__, static_cast<void *>(this), GetID(),
+                    error.AsCString());
         // Halt should generate a stopped event. Make a note of the fact that
         // we were doing the interrupt, so we can set the interrupted flag
         // after we receive the event. We deliberately set this to true even if
@@ -3883,10 +3858,9 @@ thread_result_t Process::RunPrivateState
         // request. We use m_last_broadcast_state, because the Stopped event
         // may not have been popped of the event queue yet, which is when the
         // public state gets updated.
-        if (log)
-          log->Printf(
-              "Process::%s ignoring interrupt as we have already stopped.",
-              __FUNCTION__);
+        LLDB_LOGF(log,
+                  "Process::%s ignoring interrupt as we have already stopped.",
+                  __FUNCTION__);
       }
       continue;
     }
@@ -3908,9 +3882,10 @@ thread_result_t Process::RunPrivateState
           ProcessEventData::SetInterruptedInEvent(event_sp.get(), true);
           interrupt_requested = false;
         } else if (log) {
-          log->Printf("Process::%s interrupt_requested, but a non-stopped "
-                      "state '%s' received.",
-                      __FUNCTION__, StateAsCString(internal_state));
+          LLDB_LOGF(log,
+                    "Process::%s interrupt_requested, but a non-stopped "
+                    "state '%s' received.",
+                    __FUNCTION__, StateAsCString(internal_state));
         }
       }
 
@@ -3919,20 +3894,19 @@ thread_result_t Process::RunPrivateState
 
     if (internal_state == eStateInvalid || internal_state == eStateExited ||
         internal_state == eStateDetached) {
-      if (log)
-        log->Printf("Process::%s (arg = %p, pid = %" PRIu64
-                    ") about to exit with internal state %s...",
-                    __FUNCTION__, static_cast<void *>(this), GetID(),
-                    StateAsCString(internal_state));
+      LLDB_LOGF(log,
+                "Process::%s (arg = %p, pid = %" PRIu64
+                ") about to exit with internal state %s...",
+                __FUNCTION__, static_cast<void *>(this), GetID(),
+                StateAsCString(internal_state));
 
       break;
     }
   }
 
   // Verify log is still enabled before attempting to write to it...
-  if (log)
-    log->Printf("Process::%s (arg = %p, pid = %" PRIu64 ") thread exiting...",
-                __FUNCTION__, static_cast<void *>(this), GetID());
+  LLDB_LOGF(log, "Process::%s (arg = %p, pid = %" PRIu64 ") thread exiting...",
+            __FUNCTION__, static_cast<void *>(this), GetID());
 
   // If we are a secondary thread, then the primary thread we are working for
   // will have already acquired the public_run_lock, and isn't done with what
@@ -4042,10 +4016,10 @@ void Process::ProcessEventData::DoOnRemo
       if (curr_thread_list.GetSize() != num_threads) {
         Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP |
                                                         LIBLLDB_LOG_PROCESS));
-        if (log)
-          log->Printf(
-              "Number of threads changed from %u to %u while processing event.",
-              num_threads, curr_thread_list.GetSize());
+        LLDB_LOGF(
+            log,
+            "Number of threads changed from %u to %u while processing event.",
+            num_threads, curr_thread_list.GetSize());
         break;
       }
 
@@ -4054,10 +4028,10 @@ void Process::ProcessEventData::DoOnRemo
       if (thread_sp->GetIndexID() != thread_index_array[idx]) {
         Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP |
                                                         LIBLLDB_LOG_PROCESS));
-        if (log)
-          log->Printf("The thread at position %u changed from %u to %u while "
-                      "processing event.",
-                      idx, thread_index_array[idx], thread_sp->GetIndexID());
+        LLDB_LOGF(log,
+                  "The thread at position %u changed from %u to %u while "
+                  "processing event.",
+                  idx, thread_index_array[idx], thread_sp->GetIndexID());
         break;
       }
 
@@ -4303,9 +4277,8 @@ size_t Process::GetAsyncProfileData(char
   size_t bytes_available = one_profile_data.size();
   if (bytes_available > 0) {
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-    if (log)
-      log->Printf("Process::GetProfileData (buf = %p, size = %" PRIu64 ")",
-                  static_cast<void *>(buf), static_cast<uint64_t>(buf_size));
+    LLDB_LOGF(log, "Process::GetProfileData (buf = %p, size = %" PRIu64 ")",
+              static_cast<void *>(buf), static_cast<uint64_t>(buf_size));
     if (bytes_available > buf_size) {
       memcpy(buf, one_profile_data.c_str(), buf_size);
       one_profile_data.erase(0, buf_size);
@@ -4325,9 +4298,8 @@ size_t Process::GetSTDOUT(char *buf, siz
   size_t bytes_available = m_stdout_data.size();
   if (bytes_available > 0) {
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-    if (log)
-      log->Printf("Process::GetSTDOUT (buf = %p, size = %" PRIu64 ")",
-                  static_cast<void *>(buf), static_cast<uint64_t>(buf_size));
+    LLDB_LOGF(log, "Process::GetSTDOUT (buf = %p, size = %" PRIu64 ")",
+              static_cast<void *>(buf), static_cast<uint64_t>(buf_size));
     if (bytes_available > buf_size) {
       memcpy(buf, m_stdout_data.c_str(), buf_size);
       m_stdout_data.erase(0, buf_size);
@@ -4345,9 +4317,8 @@ size_t Process::GetSTDERR(char *buf, siz
   size_t bytes_available = m_stderr_data.size();
   if (bytes_available > 0) {
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-    if (log)
-      log->Printf("Process::GetSTDERR (buf = %p, size = %" PRIu64 ")",
-                  static_cast<void *>(buf), static_cast<uint64_t>(buf_size));
+    LLDB_LOGF(log, "Process::GetSTDERR (buf = %p, size = %" PRIu64 ")",
+              static_cast<void *>(buf), static_cast<uint64_t>(buf_size));
     if (bytes_available > buf_size) {
       memcpy(buf, m_stderr_data.c_str(), buf_size);
       m_stderr_data.erase(0, buf_size);
@@ -4532,8 +4503,7 @@ bool Process::PushProcessIOHandler() {
   IOHandlerSP io_handler_sp(m_process_input_reader);
   if (io_handler_sp) {
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-    if (log)
-      log->Printf("Process::%s pushing IO handler", __FUNCTION__);
+    LLDB_LOGF(log, "Process::%s pushing IO handler", __FUNCTION__);
 
     io_handler_sp->SetIsDone(false);
     // If we evaluate an utility function, then we don't cancel the current
@@ -4797,9 +4767,8 @@ Process::RunThreadPlan(ExecutionContext
     // public events. The simplest thing to do is to spin up a temporary thread
     // to handle private state thread events while we are fielding public
     // events here.
-    if (log)
-      log->Printf("Running thread plan on private state thread, spinning up "
-                  "another state thread to handle the events.");
+    LLDB_LOGF(log, "Running thread plan on private state thread, spinning up "
+                   "another state thread to handle the events.");
 
     backup_private_state_thread = m_private_state_thread;
 
@@ -4854,9 +4823,10 @@ Process::RunThreadPlan(ExecutionContext
     if (log) {
       StreamString s;
       thread_plan_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
-      log->Printf("Process::RunThreadPlan(): Resuming thread %u - 0x%4.4" PRIx64
-                  " to run thread plan \"%s\".",
-                  thread->GetIndexID(), thread->GetID(), s.GetData());
+      LLDB_LOGF(log,
+                "Process::RunThreadPlan(): Resuming thread %u - 0x%4.4" PRIx64
+                " to run thread plan \"%s\".",
+                thread->GetIndexID(), thread->GetID(), s.GetData());
     }
 
     bool got_event;
@@ -4877,10 +4847,9 @@ Process::RunThreadPlan(ExecutionContext
     if (!options.GetStopOthers() || !options.GetTryAllThreads())
       before_first_timeout = false;
 
-    if (log)
-      log->Printf("Stop others: %u, try all: %u, before_first: %u.\n",
-                  options.GetStopOthers(), options.GetTryAllThreads(),
-                  before_first_timeout);
+    LLDB_LOGF(log, "Stop others: %u, try all: %u, before_first: %u.\n",
+              options.GetStopOthers(), options.GetTryAllThreads(),
+              before_first_timeout);
 
     // This isn't going to work if there are unfetched events on the queue. Are
     // there cases where we might want to run the remaining events here, and
@@ -4919,10 +4888,10 @@ Process::RunThreadPlan(ExecutionContext
       // loop. The only exception is if we get two running events with no
       // intervening stop, which can happen, we will just wait for then next
       // stop event.
-      if (log)
-        log->Printf("Top of while loop: do_resume: %i handle_running_event: %i "
-                    "before_first_timeout: %i.",
-                    do_resume, handle_running_event, before_first_timeout);
+      LLDB_LOGF(log,
+                "Top of while loop: do_resume: %i handle_running_event: %i "
+                "before_first_timeout: %i.",
+                do_resume, handle_running_event, before_first_timeout);
 
       if (do_resume || handle_running_event) {
         // Do the initial resume and wait for the running event before going
@@ -4944,10 +4913,10 @@ Process::RunThreadPlan(ExecutionContext
         got_event =
             listener_sp->GetEvent(event_sp, GetUtilityExpressionTimeout());
         if (!got_event) {
-          if (log)
-            log->Printf("Process::RunThreadPlan(): didn't get any event after "
-                        "resume %" PRIu32 ", exiting.",
-                        num_resumes);
+          LLDB_LOGF(log,
+                    "Process::RunThreadPlan(): didn't get any event after "
+                    "resume %" PRIu32 ", exiting.",
+                    num_resumes);
 
           diagnostic_manager.Printf(eDiagnosticSeverityError,
                                     "didn't get any event after resume %" PRIu32
@@ -4966,13 +4935,13 @@ Process::RunThreadPlan(ExecutionContext
           if (stop_state == eStateStopped) {
             restarted = Process::ProcessEventData::GetRestartedFromEvent(
                 event_sp.get());
-            if (log)
-              log->Printf(
-                  "Process::RunThreadPlan(): didn't get running event after "
-                  "resume %d, got %s instead (restarted: %i, do_resume: %i, "
-                  "handle_running_event: %i).",
-                  num_resumes, StateAsCString(stop_state), restarted, do_resume,
-                  handle_running_event);
+            LLDB_LOGF(
+                log,
+                "Process::RunThreadPlan(): didn't get running event after "
+                "resume %d, got %s instead (restarted: %i, do_resume: %i, "
+                "handle_running_event: %i).",
+                num_resumes, StateAsCString(stop_state), restarted, do_resume,
+                handle_running_event);
           }
 
           if (restarted) {
@@ -5015,12 +4984,13 @@ Process::RunThreadPlan(ExecutionContext
       if (log) {
         if (timeout) {
           auto now = system_clock::now();
-          log->Printf("Process::RunThreadPlan(): about to wait - now is %s - "
-                      "endpoint is %s",
-                      llvm::to_string(now).c_str(),
-                      llvm::to_string(now + *timeout).c_str());
+          LLDB_LOGF(log,
+                    "Process::RunThreadPlan(): about to wait - now is %s - "
+                    "endpoint is %s",
+                    llvm::to_string(now).c_str(),
+                    llvm::to_string(now + *timeout).c_str());
         } else {
-          log->Printf("Process::RunThreadPlan(): about to wait forever.");
+          LLDB_LOGF(log, "Process::RunThreadPlan(): about to wait forever.");
         }
       }
 
@@ -5044,17 +5014,15 @@ Process::RunThreadPlan(ExecutionContext
             return_value = eExpressionInterrupted;
             diagnostic_manager.PutString(eDiagnosticSeverityRemark,
                                          "execution halted by user interrupt.");
-            if (log)
-              log->Printf("Process::RunThreadPlan(): Got  interrupted by "
-                          "eBroadcastBitInterrupted, exiting.");
+            LLDB_LOGF(log, "Process::RunThreadPlan(): Got  interrupted by "
+                           "eBroadcastBitInterrupted, exiting.");
             break;
           } else {
             stop_state =
                 Process::ProcessEventData::GetStateFromEvent(event_sp.get());
-            if (log)
-              log->Printf(
-                  "Process::RunThreadPlan(): in while loop, got event: %s.",
-                  StateAsCString(stop_state));
+            LLDB_LOGF(log,
+                      "Process::RunThreadPlan(): in while loop, got event: %s.",
+                      StateAsCString(stop_state));
 
             switch (stop_state) {
             case lldb::eStateStopped: {
@@ -5064,18 +5032,18 @@ Process::RunThreadPlan(ExecutionContext
               if (!thread_sp) {
                 // Ooh, our thread has vanished.  Unlikely that this was
                 // successful execution...
-                if (log)
-                  log->Printf("Process::RunThreadPlan(): execution completed "
-                              "but our thread (index-id=%u) has vanished.",
-                              thread_idx_id);
+                LLDB_LOGF(log,
+                          "Process::RunThreadPlan(): execution completed "
+                          "but our thread (index-id=%u) has vanished.",
+                          thread_idx_id);
                 return_value = eExpressionInterrupted;
               } else if (Process::ProcessEventData::GetRestartedFromEvent(
                              event_sp.get())) {
                 // If we were restarted, we just need to go back up to fetch
                 // another event.
                 if (log) {
-                  log->Printf("Process::RunThreadPlan(): Got a stop and "
-                              "restart, so we'll continue waiting.");
+                  LLDB_LOGF(log, "Process::RunThreadPlan(): Got a stop and "
+                                 "restart, so we'll continue waiting.");
                 }
                 keep_going = true;
                 do_resume = false;
@@ -5098,10 +5066,10 @@ Process::RunThreadPlan(ExecutionContext
               break;
 
             default:
-              if (log)
-                log->Printf("Process::RunThreadPlan(): execution stopped with "
-                            "unexpected state: %s.",
-                            StateAsCString(stop_state));
+              LLDB_LOGF(log,
+                        "Process::RunThreadPlan(): execution stopped with "
+                        "unexpected state: %s.",
+                        StateAsCString(stop_state));
 
               if (stop_state == eStateExited)
                 event_to_broadcast_sp = event_sp;
@@ -5162,8 +5130,7 @@ Process::RunThreadPlan(ExecutionContext
         while (try_halt_again < num_retries) {
           Status halt_error;
           if (do_halt) {
-            if (log)
-              log->Printf("Process::RunThreadPlan(): Running Halt.");
+            LLDB_LOGF(log, "Process::RunThreadPlan(): Running Halt.");
             const bool clear_thread_plans = false;
             const bool use_run_lock = false;
             Halt(clear_thread_plans, use_run_lock);
@@ -5179,8 +5146,9 @@ Process::RunThreadPlan(ExecutionContext
               stop_state =
                   Process::ProcessEventData::GetStateFromEvent(event_sp.get());
               if (log) {
-                log->Printf("Process::RunThreadPlan(): Stopped with event: %s",
-                            StateAsCString(stop_state));
+                LLDB_LOGF(log,
+                          "Process::RunThreadPlan(): Stopped with event: %s",
+                          StateAsCString(stop_state));
                 if (stop_state == lldb::eStateStopped &&
                     Process::ProcessEventData::GetInterruptedFromEvent(
                         event_sp.get()))
@@ -5379,24 +5347,25 @@ Process::RunThreadPlan(ExecutionContext
         } while (false);
 
         if (event_explanation)
-          log->Printf("Process::RunThreadPlan(): execution interrupted: %s %s",
-                      s.GetData(), event_explanation);
+          LLDB_LOGF(log,
+                    "Process::RunThreadPlan(): execution interrupted: %s %s",
+                    s.GetData(), event_explanation);
         else
-          log->Printf("Process::RunThreadPlan(): execution interrupted: %s",
-                      s.GetData());
+          LLDB_LOGF(log, "Process::RunThreadPlan(): execution interrupted: %s",
+                    s.GetData());
       }
 
       if (should_unwind) {
-        if (log)
-          log->Printf("Process::RunThreadPlan: ExecutionInterrupted - "
-                      "discarding thread plans up to %p.",
-                      static_cast<void *>(thread_plan_sp.get()));
+        LLDB_LOGF(log,
+                  "Process::RunThreadPlan: ExecutionInterrupted - "
+                  "discarding thread plans up to %p.",
+                  static_cast<void *>(thread_plan_sp.get()));
         thread->DiscardThreadPlansUpToPlan(thread_plan_sp);
       } else {
-        if (log)
-          log->Printf("Process::RunThreadPlan: ExecutionInterrupted - for "
-                      "plan: %p not discarding.",
-                      static_cast<void *>(thread_plan_sp.get()));
+        LLDB_LOGF(log,
+                  "Process::RunThreadPlan: ExecutionInterrupted - for "
+                  "plan: %p not discarding.",
+                  static_cast<void *>(thread_plan_sp.get()));
       }
     } else if (return_value == eExpressionSetupError) {
       if (log)
@@ -5559,9 +5528,8 @@ size_t Process::GetThreadStatus(Stream &
       ++num_thread_infos_dumped;
     } else {
       Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
-      if (log)
-        log->Printf("Process::GetThreadStatus - thread 0x" PRIu64
-                    " vanished while running Thread::GetStatus.");
+      LLDB_LOGF(log, "Process::GetThreadStatus - thread 0x" PRIu64
+                     " vanished while running Thread::GetStatus.");
     }
   }
   return num_thread_infos_dumped;
@@ -5622,8 +5590,7 @@ void Process::Flush() {
 
 void Process::DidExec() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-  if (log)
-    log->Printf("Process::%s()", __FUNCTION__);
+  LLDB_LOGF(log, "Process::%s()", __FUNCTION__);
 
   Target &target = GetTarget();
   target.CleanupProcess();
@@ -5929,19 +5896,18 @@ void Process::MapSupportedStructuredData
 
   // Bail out early if there are no type names to map.
   if (supported_type_names.GetSize() == 0) {
-    if (log)
-      log->Printf("Process::%s(): no structured data types supported",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "Process::%s(): no structured data types supported",
+              __FUNCTION__);
     return;
   }
 
   // Convert StructuredData type names to ConstString instances.
   std::set<ConstString> const_type_names;
 
-  if (log)
-    log->Printf("Process::%s(): the process supports the following async "
-                "structured data types:",
-                __FUNCTION__);
+  LLDB_LOGF(log,
+            "Process::%s(): the process supports the following async "
+            "structured data types:",
+            __FUNCTION__);
 
   supported_type_names.ForEach(
       [&const_type_names, &log](StructuredData::Object *object) {
@@ -5988,11 +5954,11 @@ void Process::MapSupportedStructuredData
         m_structured_data_plugin_map.insert(
             std::make_pair(type_name, plugin_sp));
         names_to_remove.push_back(type_name);
-        if (log)
-          log->Printf("Process::%s(): using plugin %s for type name "
-                      "%s",
-                      __FUNCTION__, plugin_sp->GetPluginName().GetCString(),
-                      type_name.GetCString());
+        LLDB_LOGF(log,
+                  "Process::%s(): using plugin %s for type name "
+                  "%s",
+                  __FUNCTION__, plugin_sp->GetPluginName().GetCString(),
+                  type_name.GetCString());
       }
     }
 

Modified: lldb/trunk/source/Target/SectionLoadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/SectionLoadList.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/SectionLoadList.cpp (original)
+++ lldb/trunk/source/Target/SectionLoadList.cpp Wed Jul 24 10:56:10 2019
@@ -121,7 +121,8 @@ bool SectionLoadList::SetSectionLoadAddr
 
   } else {
     if (log) {
-      log->Printf(
+      LLDB_LOGF(
+          log,
           "SectionLoadList::%s (section = %p (%s), load_addr = 0x%16.16" PRIx64
           ") error: module has been deleted",
           __FUNCTION__, static_cast<void *>(section.get()),
@@ -145,9 +146,9 @@ size_t SectionLoadList::SetSectionUnload
             section_sp->GetModule()->GetFileSpec());
         module_name = module_file_spec.GetPath();
       }
-      log->Printf("SectionLoadList::%s (section = %p (%s.%s))", __FUNCTION__,
-                  static_cast<void *>(section_sp.get()), module_name.c_str(),
-                  section_sp->GetName().AsCString());
+      LLDB_LOGF(log, "SectionLoadList::%s (section = %p (%s.%s))", __FUNCTION__,
+                static_cast<void *>(section_sp.get()), module_name.c_str(),
+                section_sp->GetName().AsCString());
     }
 
     std::lock_guard<std::recursive_mutex> guard(m_mutex);
@@ -179,7 +180,8 @@ bool SectionLoadList::SetSectionUnloaded
       const FileSpec &module_file_spec(section_sp->GetModule()->GetFileSpec());
       module_name = module_file_spec.GetPath();
     }
-    log->Printf(
+    LLDB_LOGF(
+        log,
         "SectionLoadList::%s (section = %p (%s.%s), load_addr = 0x%16.16" PRIx64
         ")",
         __FUNCTION__, static_cast<void *>(section_sp.get()),

Modified: lldb/trunk/source/Target/StackFrameList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrameList.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrameList.cpp (original)
+++ lldb/trunk/source/Target/StackFrameList.cpp Wed Jul 24 10:56:10 2019
@@ -67,7 +67,8 @@ uint32_t StackFrameList::GetCurrentInlin
       m_current_inlined_depth = UINT32_MAX;
       Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
       if (log && log->GetVerbose())
-        log->Printf(
+        LLDB_LOGF(
+            log,
             "GetCurrentInlinedDepth: invalidating current inlined depth.\n");
     }
     return m_current_inlined_depth;
@@ -90,7 +91,8 @@ void StackFrameList::ResetCurrentInlined
     m_current_inlined_pc = LLDB_INVALID_ADDRESS;
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
     if (log && log->GetVerbose())
-      log->Printf(
+      LLDB_LOGF(
+          log,
           "ResetCurrentInlinedDepth: Invalidating current inlined depth.\n");
     return;
   }
@@ -184,9 +186,10 @@ void StackFrameList::ResetCurrentInlined
     m_current_inlined_depth = num_inlined_functions + 1;
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
     if (log && log->GetVerbose())
-      log->Printf("ResetCurrentInlinedDepth: setting inlined "
-                  "depth: %d 0x%" PRIx64 ".\n",
-                  m_current_inlined_depth, curr_pc);
+      LLDB_LOGF(log,
+                "ResetCurrentInlinedDepth: setting inlined "
+                "depth: %d 0x%" PRIx64 ".\n",
+                m_current_inlined_depth, curr_pc);
 
     break;
   }

Modified: lldb/trunk/source/Target/StopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/StopInfo.cpp (original)
+++ lldb/trunk/source/Target/StopInfo.cpp Wed Jul 24 10:56:10 2019
@@ -147,10 +147,10 @@ public:
         } else {
           Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
 
-          if (log)
-            log->Printf(
-                "Process::%s could not find breakpoint site id: %" PRId64 "...",
-                __FUNCTION__, m_value);
+          LLDB_LOGF(log,
+                    "Process::%s could not find breakpoint site id: %" PRId64
+                    "...",
+                    __FUNCTION__, m_value);
 
           m_should_stop = true;
         }
@@ -270,7 +270,7 @@ protected:
       if (!thread_sp->IsValid()) {
         // This shouldn't ever happen, but just in case, don't do more harm.
         if (log) {
-          log->Printf("PerformAction got called with an invalid thread.");
+          LLDB_LOGF(log, "PerformAction got called with an invalid thread.");
         }
         m_should_stop = true;
         m_should_stop_is_valid = true;
@@ -339,10 +339,9 @@ protected:
               return;
             }
 
-            if (log)
-              log->Printf("StopInfoBreakpoint::PerformAction - Hit a "
-                          "breakpoint while running an expression,"
-                          " not running commands to avoid recursion.");
+            LLDB_LOGF(log, "StopInfoBreakpoint::PerformAction - Hit a "
+                           "breakpoint while running an expression,"
+                           " not running commands to avoid recursion.");
             bool ignoring_breakpoints =
                 process->GetIgnoreBreakpointsInExpressions();
             if (ignoring_breakpoints) {
@@ -359,10 +358,10 @@ protected:
             } else {
               m_should_stop = true;
             }
-            if (log)
-              log->Printf("StopInfoBreakpoint::PerformAction - in expression, "
-                          "continuing: %s.",
-                          m_should_stop ? "true" : "false");
+            LLDB_LOGF(log,
+                      "StopInfoBreakpoint::PerformAction - in expression, "
+                      "continuing: %s.",
+                      m_should_stop ? "true" : "false");
             process->GetTarget().GetDebugger().GetAsyncOutputStream()->Printf(
                 "Warning: hit breakpoint while running function, skipping "
                 "commands and conditions to prevent recursion.\n");
@@ -402,10 +401,11 @@ protected:
             // aren't:
             if (!bp_loc_sp->ValidForThisThread(thread_sp.get())) {
               if (log) {
-                log->Printf("Breakpoint %s hit on thread 0x%llx but it was not "
-                            "for this thread, continuing.",
-                            loc_desc.GetData(), static_cast<unsigned long long>(
-                                             thread_sp->GetID()));
+                LLDB_LOGF(log,
+                          "Breakpoint %s hit on thread 0x%llx but it was not "
+                          "for this thread, continuing.",
+                          loc_desc.GetData(),
+                          static_cast<unsigned long long>(thread_sp->GetID()));
               }
               continue;
             }
@@ -445,21 +445,18 @@ protected:
                 error_sp->EOL();
                 const char *err_str =
                     condition_error.AsCString("<Unknown Error>");
-                if (log)
-                  log->Printf("Error evaluating condition: \"%s\"\n", err_str);
+                LLDB_LOGF(log, "Error evaluating condition: \"%s\"\n", err_str);
 
                 error_sp->PutCString(err_str);
                 error_sp->EOL();
                 error_sp->Flush();
               } else {
-                if (log) {
-                  log->Printf("Condition evaluated for breakpoint %s on thread "
-                              "0x%llx conditon_says_stop: %i.",
-                              loc_desc.GetData(), 
-                              static_cast<unsigned long long>(
-                                               thread_sp->GetID()),
-                              condition_says_stop);
-                }
+                LLDB_LOGF(log,
+                          "Condition evaluated for breakpoint %s on thread "
+                          "0x%llx conditon_says_stop: %i.",
+                          loc_desc.GetData(),
+                          static_cast<unsigned long long>(thread_sp->GetID()),
+                          condition_says_stop);
                 if (!condition_says_stop) {
                   // We don't want to increment the hit count of breakpoints if
                   // the condition fails. We've already bumped it by the time
@@ -479,9 +476,9 @@ protected:
             bool auto_continue_says_stop = true;
             if (bp_loc_sp->IsAutoContinue())
             {
-              if (log)
-                log->Printf("Continuing breakpoint %s as AutoContinue was set.",
-                            loc_desc.GetData());
+              LLDB_LOGF(log,
+                        "Continuing breakpoint %s as AutoContinue was set.",
+                        loc_desc.GetData());
               // We want this stop reported, so you will know we auto-continued
               // but only for external breakpoints:
               if (!internal_breakpoint)
@@ -533,10 +530,10 @@ protected:
         Log *log_process(
             lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
 
-        if (log_process)
-          log_process->Printf(
-              "Process::%s could not find breakpoint site id: %" PRId64 "...",
-              __FUNCTION__, m_value);
+        LLDB_LOGF(log_process,
+                  "Process::%s could not find breakpoint site id: %" PRId64
+                  "...",
+                  __FUNCTION__, m_value);
       }
 
       if ((!m_should_stop || internal_breakpoint) &&
@@ -552,9 +549,9 @@ protected:
         thread_sp->ResetStopInfo();
       }
 
-      if (log)
-        log->Printf("Process::%s returning from action with m_should_stop: %d.",
-                    __FUNCTION__, m_should_stop);
+      LLDB_LOGF(log,
+                "Process::%s returning from action with m_should_stop: %d.",
+                __FUNCTION__, m_should_stop);
     }
   }
 
@@ -664,11 +661,10 @@ protected:
       } else {
         Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
 
-        if (log)
-          log->Printf(
-              "Process::%s could not find watchpoint location id: %" PRId64
-              "...",
-              __FUNCTION__, GetValue());
+        LLDB_LOGF(log,
+                  "Process::%s could not find watchpoint location id: %" PRId64
+                  "...",
+                  __FUNCTION__, GetValue());
 
         m_should_stop = true;
       }
@@ -817,15 +813,14 @@ protected:
                   m_should_stop = false;
                 } else
                   m_should_stop = true;
-                if (log)
-                  log->Printf(
-                      "Condition successfully evaluated, result is %s.\n",
-                      m_should_stop ? "true" : "false");
+                LLDB_LOGF(log,
+                          "Condition successfully evaluated, result is %s.\n",
+                          m_should_stop ? "true" : "false");
               } else {
                 m_should_stop = true;
-                if (log)
-                  log->Printf(
-                      "Failed to get an integer result from the expression.");
+                LLDB_LOGF(
+                    log,
+                    "Failed to get an integer result from the expression.");
               }
             }
           } else {
@@ -836,8 +831,7 @@ protected:
             error_sp->Printf(": \"%s\"", wp_sp->GetConditionText());
             error_sp->EOL();
             const char *err_str = error.AsCString("<Unknown Error>");
-            if (log)
-              log->Printf("Error evaluating condition: \"%s\"\n", err_str);
+            LLDB_LOGF(log, "Error evaluating condition: \"%s\"\n", err_str);
 
             error_sp->PutCString(err_str);
             error_sp->EOL();
@@ -889,14 +883,13 @@ protected:
         Log *log_process(
             lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
 
-        if (log_process)
-          log_process->Printf(
-              "Process::%s could not find watchpoint id: %" PRId64 "...",
-              __FUNCTION__, m_value);
+        LLDB_LOGF(log_process,
+                  "Process::%s could not find watchpoint id: %" PRId64 "...",
+                  __FUNCTION__, m_value);
       }
-      if (log)
-        log->Printf("Process::%s returning from action with m_should_stop: %d.",
-                    __FUNCTION__, m_should_stop);
+      LLDB_LOGF(log,
+                "Process::%s returning from action with m_should_stop: %d.",
+                __FUNCTION__, m_should_stop);
 
       m_should_stop_is_valid = true;
     }

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=366936&r1=366935&r2=366936&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Wed Jul 24 10:56:10 2019
@@ -643,8 +643,8 @@ void Target::AddBreakpoint(lldb::Breakpo
   if (log) {
     StreamString s;
     bp_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
-    log->Printf("Target::%s (internal = %s) => break_id = %s\n", __FUNCTION__,
-                bp_sp->IsInternal() ? "yes" : "no", s.GetData());
+    LLDB_LOGF(log, "Target::%s (internal = %s) => break_id = %s\n",
+              __FUNCTION__, bp_sp->IsInternal() ? "yes" : "no", s.GetData());
   }
 
   bp_sp->ResolveBreakpoint();
@@ -776,10 +776,10 @@ WatchpointSP Target::CreateWatchpoint(ll
                                       const CompilerType *type, uint32_t kind,
                                       Status &error) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
-  if (log)
-    log->Printf("Target::%s (addr = 0x%8.8" PRIx64 " size = %" PRIu64
-                " type = %u)\n",
-                __FUNCTION__, addr, (uint64_t)size, kind);
+  LLDB_LOGF(log,
+            "Target::%s (addr = 0x%8.8" PRIx64 " size = %" PRIu64
+            " type = %u)\n",
+            __FUNCTION__, addr, (uint64_t)size, kind);
 
   WatchpointSP wp_sp;
   if (!ProcessIsValid()) {
@@ -834,10 +834,9 @@ WatchpointSP Target::CreateWatchpoint(ll
   }
 
   error = m_process_sp->EnableWatchpoint(wp_sp.get(), notify);
-  if (log)
-    log->Printf("Target::%s (creation of watchpoint %s with id = %u)\n",
-                __FUNCTION__, error.Success() ? "succeeded" : "failed",
-                wp_sp->GetID());
+  LLDB_LOGF(log, "Target::%s (creation of watchpoint %s with id = %u)\n",
+            __FUNCTION__, error.Success() ? "succeeded" : "failed",
+            wp_sp->GetID());
 
   if (error.Fail()) {
     // Enabling the watchpoint on the device side failed. Remove the said
@@ -856,8 +855,7 @@ WatchpointSP Target::CreateWatchpoint(ll
 
 void Target::RemoveAllowedBreakpoints() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
-  if (log)
-    log->Printf("Target::%s \n", __FUNCTION__);
+  LLDB_LOGF(log, "Target::%s \n", __FUNCTION__);
 
   m_breakpoint_list.RemoveAllowed(true);
 
@@ -866,9 +864,8 @@ void Target::RemoveAllowedBreakpoints()
 
 void Target::RemoveAllBreakpoints(bool internal_also) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
-  if (log)
-    log->Printf("Target::%s (internal_also = %s)\n", __FUNCTION__,
-                internal_also ? "yes" : "no");
+  LLDB_LOGF(log, "Target::%s (internal_also = %s)\n", __FUNCTION__,
+            internal_also ? "yes" : "no");
 
   m_breakpoint_list.RemoveAll(true);
   if (internal_also)
@@ -879,9 +876,8 @@ void Target::RemoveAllBreakpoints(bool i
 
 void Target::DisableAllBreakpoints(bool internal_also) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
-  if (log)
-    log->Printf("Target::%s (internal_also = %s)\n", __FUNCTION__,
-                internal_also ? "yes" : "no");
+  LLDB_LOGF(log, "Target::%s (internal_also = %s)\n", __FUNCTION__,
+            internal_also ? "yes" : "no");
 
   m_breakpoint_list.SetEnabledAll(false);
   if (internal_also)
@@ -890,17 +886,15 @@ void Target::DisableAllBreakpoints(bool
 
 void Target::DisableAllowedBreakpoints() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
-  if (log)
-    log->Printf("Target::%s", __FUNCTION__);
+  LLDB_LOGF(log, "Target::%s", __FUNCTION__);
 
   m_breakpoint_list.SetEnabledAllowed(false);
 }
 
 void Target::EnableAllBreakpoints(bool internal_also) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
-  if (log)
-    log->Printf("Target::%s (internal_also = %s)\n", __FUNCTION__,
-                internal_also ? "yes" : "no");
+  LLDB_LOGF(log, "Target::%s (internal_also = %s)\n", __FUNCTION__,
+            internal_also ? "yes" : "no");
 
   m_breakpoint_list.SetEnabledAll(true);
   if (internal_also)
@@ -909,17 +903,15 @@ void Target::EnableAllBreakpoints(bool i
 
 void Target::EnableAllowedBreakpoints() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
-  if (log)
-    log->Printf("Target::%s", __FUNCTION__);
+  LLDB_LOGF(log, "Target::%s", __FUNCTION__);
 
   m_breakpoint_list.SetEnabledAllowed(true);
 }
 
 bool Target::RemoveBreakpointByID(break_id_t break_id) {
   Log *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");
+  LLDB_LOGF(log, "Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
+            break_id, LLDB_BREAK_ID_IS_INTERNAL(break_id) ? "yes" : "no");
 
   if (DisableBreakpointByID(break_id)) {
     if (LLDB_BREAK_ID_IS_INTERNAL(break_id))
@@ -938,9 +930,8 @@ bool Target::RemoveBreakpointByID(break_
 
 bool Target::DisableBreakpointByID(break_id_t break_id) {
   Log *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");
+  LLDB_LOGF(log, "Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
+            break_id, LLDB_BREAK_ID_IS_INTERNAL(break_id) ? "yes" : "no");
 
   BreakpointSP bp_sp;
 
@@ -957,9 +948,8 @@ bool Target::DisableBreakpointByID(break
 
 bool Target::EnableBreakpointByID(break_id_t break_id) {
   Log *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");
+  LLDB_LOGF(log, "Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
+            break_id, LLDB_BREAK_ID_IS_INTERNAL(break_id) ? "yes" : "no");
 
   BreakpointSP bp_sp;
 
@@ -1137,8 +1127,7 @@ Status Target::CreateBreakpointsFromFile
 // to end operations.
 bool Target::RemoveAllWatchpoints(bool end_to_end) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
-  if (log)
-    log->Printf("Target::%s\n", __FUNCTION__);
+  LLDB_LOGF(log, "Target::%s\n", __FUNCTION__);
 
   if (!end_to_end) {
     m_watchpoint_list.RemoveAll(true);
@@ -1169,8 +1158,7 @@ bool Target::RemoveAllWatchpoints(bool e
 // to end operations.
 bool Target::DisableAllWatchpoints(bool end_to_end) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
-  if (log)
-    log->Printf("Target::%s\n", __FUNCTION__);
+  LLDB_LOGF(log, "Target::%s\n", __FUNCTION__);
 
   if (!end_to_end) {
     m_watchpoint_list.SetEnabledAll(false);
@@ -1199,8 +1187,7 @@ bool Target::DisableAllWatchpoints(bool
 // to end operations.
 bool Target::EnableAllWatchpoints(bool end_to_end) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
-  if (log)
-    log->Printf("Target::%s\n", __FUNCTION__);
+  LLDB_LOGF(log, "Target::%s\n", __FUNCTION__);
 
   if (!end_to_end) {
     m_watchpoint_list.SetEnabledAll(true);
@@ -1228,8 +1215,7 @@ bool Target::EnableAllWatchpoints(bool e
 // Assumption: Caller holds the list mutex lock for m_watchpoint_list.
 bool Target::ClearAllWatchpointHitCounts() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
-  if (log)
-    log->Printf("Target::%s\n", __FUNCTION__);
+  LLDB_LOGF(log, "Target::%s\n", __FUNCTION__);
 
   size_t num_watchpoints = m_watchpoint_list.GetSize();
   for (size_t i = 0; i < num_watchpoints; ++i) {
@@ -1245,8 +1231,7 @@ bool Target::ClearAllWatchpointHitCounts
 // Assumption: Caller holds the list mutex lock for m_watchpoint_list.
 bool Target::ClearAllWatchpointHistoricValues() {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
-  if (log)
-    log->Printf("Target::%s\n", __FUNCTION__);
+  LLDB_LOGF(log, "Target::%s\n", __FUNCTION__);
 
   size_t num_watchpoints = m_watchpoint_list.GetSize();
   for (size_t i = 0; i < num_watchpoints; ++i) {
@@ -1263,8 +1248,7 @@ bool Target::ClearAllWatchpointHistoricV
 // these operations.
 bool Target::IgnoreAllWatchpoints(uint32_t ignore_count) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
-  if (log)
-    log->Printf("Target::%s\n", __FUNCTION__);
+  LLDB_LOGF(log, "Target::%s\n", __FUNCTION__);
 
   if (!ProcessIsValid())
     return false;
@@ -1283,8 +1267,7 @@ bool Target::IgnoreAllWatchpoints(uint32
 // Assumption: Caller holds the list mutex lock for m_watchpoint_list.
 bool Target::DisableWatchpointByID(lldb::watch_id_t watch_id) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
-  if (log)
-    log->Printf("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
+  LLDB_LOGF(log, "Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
 
   if (!ProcessIsValid())
     return false;
@@ -1303,8 +1286,7 @@ bool Target::DisableWatchpointByID(lldb:
 // Assumption: Caller holds the list mutex lock for m_watchpoint_list.
 bool Target::EnableWatchpointByID(lldb::watch_id_t watch_id) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
-  if (log)
-    log->Printf("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
+  LLDB_LOGF(log, "Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
 
   if (!ProcessIsValid())
     return false;
@@ -1323,8 +1305,7 @@ bool Target::EnableWatchpointByID(lldb::
 // Assumption: Caller holds the list mutex lock for m_watchpoint_list.
 bool Target::RemoveWatchpointByID(lldb::watch_id_t watch_id) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
-  if (log)
-    log->Printf("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
+  LLDB_LOGF(log, "Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
 
   WatchpointSP watch_to_remove_sp = m_watchpoint_list.FindByID(watch_id);
   if (watch_to_remove_sp == m_last_created_watchpoint)
@@ -1341,8 +1322,7 @@ bool Target::RemoveWatchpointByID(lldb::
 bool Target::IgnoreWatchpointByID(lldb::watch_id_t watch_id,
                                   uint32_t ignore_count) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
-  if (log)
-    log->Printf("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
+  LLDB_LOGF(log, "Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
 
   if (!ProcessIsValid())
     return false;
@@ -1533,10 +1513,9 @@ bool Target::SetArchitecture(const ArchS
 
   // If we have an executable file, try to reset the executable to the desired
   // architecture
-  if (log)
-    log->Printf("Target::SetArchitecture changing architecture to %s (%s)",
-                arch_spec.GetArchitectureName(),
-                arch_spec.GetTriple().getTriple().c_str());
+  LLDB_LOGF(log, "Target::SetArchitecture changing architecture to %s (%s)",
+            arch_spec.GetArchitectureName(),
+            arch_spec.GetTriple().getTriple().c_str());
   m_arch = other;
   ModuleSP executable_sp = GetExecutableModule();
 
@@ -1544,11 +1523,11 @@ bool Target::SetArchitecture(const ArchS
   // Need to do something about unsetting breakpoints.
 
   if (executable_sp) {
-    if (log)
-      log->Printf("Target::SetArchitecture Trying to select executable file "
-                  "architecture %s (%s)",
-                  arch_spec.GetArchitectureName(),
-                  arch_spec.GetTriple().getTriple().c_str());
+    LLDB_LOGF(log,
+              "Target::SetArchitecture Trying to select executable file "
+              "architecture %s (%s)",
+              arch_spec.GetArchitectureName(),
+              arch_spec.GetTriple().getTriple().c_str());
     ModuleSpec module_spec(executable_sp->GetFileSpec(), other);
     FileSpecList search_paths = GetExecutableSearchPaths();
     Status error = ModuleList::GetSharedModule(module_spec, executable_sp,
@@ -1569,12 +1548,11 @@ bool Target::MergeArchitecture(const Arc
       // The current target arch is compatible with "arch_spec", see if we can
       // improve our current architecture using bits from "arch_spec"
 
-      if (log)
-        log->Printf(
-            "Target::MergeArchitecture target has arch %s, merging with "
-            "arch %s",
-            m_arch.GetSpec().GetTriple().getTriple().c_str(),
-            arch_spec.GetTriple().getTriple().c_str());
+      LLDB_LOGF(log,
+                "Target::MergeArchitecture target has arch %s, merging with "
+                "arch %s",
+                m_arch.GetSpec().GetTriple().getTriple().c_str(),
+                arch_spec.GetTriple().getTriple().c_str());
 
       // Merge bits from arch_spec into "merged_arch" and set our architecture
       ArchSpec merged_arch(m_arch.GetSpec());
@@ -2835,9 +2813,8 @@ Status Target::Launch(ProcessLaunchInfo
   Status error;
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET));
 
-  if (log)
-    log->Printf("Target::%s() called for %s", __FUNCTION__,
-                launch_info.GetExecutableFile().GetPath().c_str());
+  LLDB_LOGF(log, "Target::%s() called for %s", __FUNCTION__,
+            launch_info.GetExecutableFile().GetPath().c_str());
 
   StateType state = eStateInvalid;
 
@@ -2849,14 +2826,12 @@ Status Target::Launch(ProcessLaunchInfo
 
     if (process_sp) {
       state = process_sp->GetState();
-      if (log)
-        log->Printf(
-            "Target::%s the process exists, and its current state is %s",
-            __FUNCTION__, StateAsCString(state));
+      LLDB_LOGF(log,
+                "Target::%s the process exists, and its current state is %s",
+                __FUNCTION__, StateAsCString(state));
     } else {
-      if (log)
-        log->Printf("Target::%s the process instance doesn't currently exist.",
-                    __FUNCTION__);
+      LLDB_LOGF(log, "Target::%s the process instance doesn't currently exist.",
+                __FUNCTION__);
     }
   }
 
@@ -2888,9 +2863,8 @@ Status Target::Launch(ProcessLaunchInfo
   // that can launch a process for debugging, go ahead and do that here.
   if (state != eStateConnected && platform_sp &&
       platform_sp->CanDebugProcess()) {
-    if (log)
-      log->Printf("Target::%s asking the platform to debug the process",
-                  __FUNCTION__);
+    LLDB_LOGF(log, "Target::%s asking the platform to debug the process",
+              __FUNCTION__);
 
     // If there was a previous process, delete it before we make the new one.
     // One subtle point, we delete the process before we release the reference
@@ -2902,10 +2876,10 @@ Status Target::Launch(ProcessLaunchInfo
         GetPlatform()->DebugProcess(launch_info, debugger, this, error);
 
   } else {
-    if (log)
-      log->Printf("Target::%s the platform doesn't know how to debug a "
-                  "process, getting a process plugin to do this for us.",
-                  __FUNCTION__);
+    LLDB_LOGF(log,
+              "Target::%s the platform doesn't know how to debug a "
+              "process, getting a process plugin to do this for us.",
+              __FUNCTION__);
 
     if (state == eStateConnected) {
       assert(m_process_sp);




More information about the lldb-commits mailing list