Skip to content
Permalink
Browse files

[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

llvm-svn: 366936
  • Loading branch information...
JDevlieghere committed Jul 24, 2019
1 parent 2bf871b commit 63e5fb76ecfed3434252868d8cf07d676f979f2f
Showing with 5,364 additions and 5,934 deletions.
  1. +8 −0 lldb/include/lldb/Utility/Log.h
  2. +47 −53 lldb/source/API/SBDebugger.cpp
  3. +4 −4 lldb/source/API/SBFrame.cpp
  4. +4 −4 lldb/source/API/SBTarget.cpp
  5. +10 −11 lldb/source/Breakpoint/Breakpoint.cpp
  6. +6 −7 lldb/source/Breakpoint/BreakpointLocation.cpp
  7. +10 −10 lldb/source/Breakpoint/BreakpointResolver.cpp
  8. +1 −2 lldb/source/Breakpoint/BreakpointResolverAddress.cpp
  9. +1 −1 lldb/source/Breakpoint/BreakpointResolverName.cpp
  10. +4 −3 lldb/source/Commands/CommandObjectTarget.cpp
  11. +7 −7 lldb/source/Core/AddressResolverFileLine.cpp
  12. +2 −3 lldb/source/Core/Communication.cpp
  13. +56 −64 lldb/source/Core/FormatEntity.cpp
  14. +4 −4 lldb/source/Core/Mangled.cpp
  15. +20 −19 lldb/source/Core/Module.cpp
  16. +8 −7 lldb/source/Core/ModuleList.cpp
  17. +6 −6 lldb/source/Core/ValueObject.cpp
  18. +2 −2 lldb/source/Core/ValueObjectDynamicValue.cpp
  19. +56 −58 lldb/source/Core/ValueObjectSyntheticFilter.cpp
  20. +73 −88 lldb/source/DataFormatters/FormatManager.cpp
  21. +27 −29 lldb/source/DataFormatters/TypeCategoryMap.cpp
  22. +10 −10 lldb/source/Expression/DWARFExpression.cpp
  23. +7 −11 lldb/source/Expression/ExpressionVariable.cpp
  24. +21 −21 lldb/source/Expression/FunctionCaller.cpp
  25. +39 −44 lldb/source/Expression/IRExecutionUnit.cpp
  26. +133 −176 lldb/source/Expression/IRInterpreter.cpp
  27. +34 −30 lldb/source/Expression/IRMemoryMap.cpp
  28. +7 −9 lldb/source/Expression/LLVMUserExpression.cpp
  29. +48 −41 lldb/source/Expression/Materializer.cpp
  30. +21 −20 lldb/source/Expression/UserExpression.cpp
  31. +18 −21 lldb/source/Host/common/Host.cpp
  32. +10 −11 lldb/source/Host/common/HostInfoBase.cpp
  33. +1 −2 lldb/source/Host/common/HostNativeThreadBase.cpp
  34. +10 −9 lldb/source/Host/common/NativeProcessProtocol.cpp
  35. +15 −17 lldb/source/Host/common/NativeRegisterContext.cpp
  36. +21 −23 lldb/source/Host/common/Socket.cpp
  37. +2 −4 lldb/source/Host/common/TCPSocket.cpp
  38. +1 −2 lldb/source/Host/common/UDPSocket.cpp
  39. +17 −22 lldb/source/Host/linux/HostInfoLinux.cpp
  40. +19 −24 lldb/source/Host/macosx/objcxx/Host.mm
  41. +2 −3 lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
  42. +62 −66 lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
  43. +14 −14 lldb/source/Host/windows/ConnectionGenericFileWindows.cpp
  44. +11 −14 lldb/source/Interpreter/CommandInterpreter.cpp
  45. +2 −3 lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
  46. +2 −3 lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
  47. +9 −16 lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
  48. +9 −16 lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
  49. +10 −14 lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
  50. +17 −25 lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
  51. +7 −12 lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
  52. +10 −14 lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
  53. +10 −14 lldb/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp
  54. +4 −4 lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
  55. +45 −41 lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  56. +22 −28 lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
  57. +16 −16 lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp
  58. +40 −42 lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
  59. +4 −5 lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
  60. +14 −15 lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
  61. +45 −53 lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
  62. +94 −102 lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
  63. +20 −22 lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
  64. +2 −2 lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp
  65. +14 −16 lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
  66. +177 −177 lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  67. +100 −100 lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  68. +27 −32 lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  69. +1 −2 lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
  70. +10 −11 lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
  71. +8 −16 lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  72. +9 −13 lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
  73. +87 −93 lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
  74. +20 −26 lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
  75. +32 −35 lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
  76. +57 −56 lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
  77. +7 −5 lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
  78. +69 −76 lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  79. +26 −32 lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
  80. +11 −14 ...source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
  81. +4 −3 lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
  82. +4 −4 lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp
  83. +271 −380 lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  84. +5 −6 lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
  85. +44 −51 lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  86. +12 −7 lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  87. +24 −25 lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  88. +27 −27 lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
  89. +12 −16 lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
  90. +11 −15 lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
  91. +6 −8 lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
  92. +7 −9 lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
  93. +36 −38 lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  94. +38 −40 lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
  95. +5 −7 lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
  96. +7 −8 lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
  97. +6 −8 lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
  98. +6 −8 lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
  99. +40 −27 lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
  100. +5 −5 lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
  101. +6 −7 lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
  102. +10 −16 lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
  103. +50 −55 lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  104. +19 −23 lldb/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp
  105. +102 −92 lldb/source/Plugins/Process/Darwin/MachException.cpp
  106. +279 −285 lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
  107. +9 −9 lldb/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp
  108. +11 −17 lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp
  109. +26 −32 lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
  110. +38 −42 lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
  111. +3 −6 lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
  112. +3 −6 lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
  113. +2 −2 lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
  114. +15 −16 lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
  115. +13 −13 lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
  116. +41 −49 lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
  117. +2 −2 lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
  118. +3 −3 lldb/source/Plugins/Process/Utility/AuxVector.cpp
  119. +3 −5 lldb/source/Plugins/Process/Utility/HistoryThread.cpp
  120. +4 −11 lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
  121. +5 −4 lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
  122. +3 −3 lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp
  123. +6 −4 lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
  124. +35 −40 lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp
  125. +1 −1 lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
  126. +2 −3 lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
  127. +31 −39 lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
  128. +82 −97 lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  129. +40 −42 lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  130. +4 −4 lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp
  131. +3 −4 lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
  132. +4 −7 lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  133. +246 −254 lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  134. +12 −13 lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
  135. +30 −21 lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
  136. +264 −288 lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  137. +3 −5 lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
  138. +39 −39 lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
  139. +16 −18 lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  140. +133 −138 lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
  141. +80 −87 lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  142. +2 −2 lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
  143. +22 −22 lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
  144. +7 −8 lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  145. +26 −33 lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
  146. +29 −33 lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
  147. +25 −29 lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
  148. +28 −31 lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
  149. +7 −7 lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
  150. +17 −15 lldb/source/Symbol/Block.cpp
  151. +1 −1 lldb/source/Symbol/ClangASTContext.cpp
  152. +93 −89 lldb/source/Symbol/ClangASTImporter.cpp
  153. +2 −2 lldb/source/Symbol/CompactUnwindInfo.cpp
  154. +6 −7 lldb/source/Symbol/DWARFCallFrameInfo.cpp
  155. +4 −4 lldb/source/Symbol/LocateSymbolFile.cpp
  156. +36 −31 lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
  157. +17 −19 lldb/source/Symbol/ObjectFile.cpp
  158. +2 −1 lldb/source/Symbol/SymbolContext.cpp
  159. +20 −18 lldb/source/Symbol/UnwindPlan.cpp
  160. +14 −14 lldb/source/Target/Memory.cpp
  161. +2 −3 lldb/source/Target/ModuleCache.cpp
  162. +41 −57 lldb/source/Target/Platform.cpp
  163. +323 −357 lldb/source/Target/Process.cpp
  164. +7 −5 lldb/source/Target/SectionLoadList.cpp
  165. +8 −5 lldb/source/Target/StackFrameList.cpp
  166. +51 −58 lldb/source/Target/StopInfo.cpp
  167. +60 −86 lldb/source/Target/Target.cpp
  168. +92 −100 lldb/source/Target/Thread.cpp
  169. +27 −28 lldb/source/Target/ThreadList.cpp
  170. +2 −1 lldb/source/Target/ThreadPlan.cpp
  171. +20 −20 lldb/source/Target/ThreadPlanBase.cpp
  172. +46 −55 lldb/source/Target/ThreadPlanCallFunction.cpp
  173. +2 −3 lldb/source/Target/ThreadPlanCallUserExpression.cpp
  174. +12 −18 lldb/source/Target/ThreadPlanPython.cpp
  175. +1 −2 lldb/source/Target/ThreadPlanRunToAddress.cpp
  176. +7 −10 lldb/source/Target/ThreadPlanShouldStopHere.cpp
  177. +25 −22 lldb/source/Target/ThreadPlanStepInRange.cpp
  178. +12 −12 lldb/source/Target/ThreadPlanStepInstruction.cpp
  179. +2 −2 lldb/source/Target/ThreadPlanStepOut.cpp
  180. +7 −9 lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp
  181. +7 −7 lldb/source/Target/ThreadPlanStepOverRange.cpp
  182. +29 −28 lldb/source/Target/ThreadPlanStepRange.cpp
  183. +8 −8 lldb/source/Target/ThreadPlanStepThrough.cpp
  184. +1 −2 lldb/source/Target/ThreadPlanStepUntil.cpp
  185. +4 −2 lldb/source/Utility/ArchSpec.cpp
  186. +6 −5 lldb/source/Utility/Broadcaster.cpp
  187. +34 −35 lldb/source/Utility/Listener.cpp
  188. +4 −5 lldb/tools/lldb-server/lldb-gdbserver.cpp
  189. +1 −1 lldb/unittests/Host/ConnectionFileDescriptorTest.cpp
  190. +1 −1 lldb/unittests/TestingSupport/TestUtilities.cpp
@@ -142,6 +142,7 @@ class Log final {
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 @@ class Log final {
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); \
@@ -680,13 +680,13 @@ lldb::SBTarget SBDebugger::CreateTarget(const char *filename,
}

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::CreateTargetWithFileAndTargetTriple(const char *filename,
}

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::CreateTargetWithFileAndArch(const char *filename,
}
}

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 char *filename) {
}
}
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::SBTarget &target) {
}

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(SBTarget &sb_target) {
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::GetSelectedPlatform() {
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(SBPlatform &sb_platform) {
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 void *data, size_t data_len) {
// 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() const {

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::SetCurrentPlatformSDKRoot(const char *sysroot) {

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;
}
@@ -1120,10 +1120,10 @@ lldb::SBValue SBFrame::EvaluateExpression(const char *expr,
}
}

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);
}
@@ -2355,10 +2355,10 @@ lldb::SBValue SBTarget::EvaluateExpression(const char *expr,
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);
}

@@ -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(ModuleList &module_list, bool load,
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 SymbolContextsMightBeEquivalent(SymbolContext &old_sc,
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;
@@ -257,9 +257,8 @@ bool BreakpointLocation::ConditionSaysStop(ExecutionContext &exe_ctx,
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::ConditionSaysStop(ExecutionContext &exe_ctx,
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(StoppointCallbackContext *context) {
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;
@@ -294,18 +294,18 @@ void BreakpointResolver::AddLocation(SearchFilter &filter,
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(SearchFilter &filter,
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());
}
}

@@ -149,8 +149,7 @@ BreakpointResolverAddress::SearchCallback(SearchFilter &filter,
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);
@@ -388,7 +388,7 @@ BreakpointResolverName::SearchCallback(SearchFilter &filter,
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());
}
}
}
@@ -1064,9 +1064,10 @@ class CommandObjectTargetModulesSearchPathsAdd : public CommandObjectParsed {
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(

0 comments on commit 63e5fb7

Please sign in to comment.
You can’t perform that action at this time.