summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins')
-rw-r--r--lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp5
-rw-r--r--lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp5
-rw-r--r--lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp25
-rw-r--r--lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp25
-rw-r--r--lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp24
-rw-r--r--lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp42
-rw-r--r--lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp19
-rw-r--r--lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp24
-rw-r--r--lldb/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp24
-rw-r--r--lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp8
-rw-r--r--lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp86
-rw-r--r--lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp50
-rw-r--r--lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp32
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp82
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp9
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp29
-rw-r--r--lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp98
-rw-r--r--lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp196
-rw-r--r--lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp42
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp4
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp30
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp354
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp200
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp59
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp3
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp21
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp24
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp22
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp180
-rw-r--r--lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp46
-rw-r--r--lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp67
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp113
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp12
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp145
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp58
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp25
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp7
-rw-r--r--lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp8
-rw-r--r--lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp651
-rw-r--r--lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp11
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp95
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp19
-rw-r--r--lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp49
-rw-r--r--lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp54
-rw-r--r--lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp28
-rw-r--r--lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp26
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp14
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp16
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp74
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp78
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp12
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp15
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp14
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp14
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp67
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp10
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp13
-rw-r--r--lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp26
-rw-r--r--lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp105
-rw-r--r--lldb/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp42
-rw-r--r--lldb/source/Plugins/Process/Darwin/MachException.cpp194
-rw-r--r--lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp564
-rw-r--r--lldb/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp18
-rw-r--r--lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp28
-rw-r--r--lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp58
-rw-r--r--lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp80
-rw-r--r--lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp9
-rw-r--r--lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp9
-rw-r--r--lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp4
-rw-r--r--lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp31
-rw-r--r--lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp26
-rw-r--r--lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp90
-rw-r--r--lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp4
-rw-r--r--lldb/source/Plugins/Process/Utility/AuxVector.cpp6
-rw-r--r--lldb/source/Plugins/Process/Utility/HistoryThread.cpp8
-rw-r--r--lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp15
-rw-r--r--lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp9
-rw-r--r--lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp6
-rw-r--r--lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp10
-rw-r--r--lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp75
-rw-r--r--lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp2
-rw-r--r--lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp5
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp70
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp179
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp82
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp8
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp7
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp11
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp500
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp25
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp51
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp552
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp8
-rw-r--r--lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp78
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp34
-rw-r--r--lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp271
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp167
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp4
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp44
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp15
-rw-r--r--lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp59
-rw-r--r--lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp62
-rw-r--r--lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp54
-rw-r--r--lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp59
-rw-r--r--lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp14
105 files changed, 3431 insertions, 3810 deletions
diff --git a/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp b/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
index fd788e7902b..e5c72bd549b 100644
--- a/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
+++ b/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
@@ -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;
}
diff --git a/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp b/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
index f9647ef7d49..beb54031c64 100644
--- a/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
+++ b/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
@@ -1706,9 +1706,8 @@ bool ABISysV_arm64::PrepareTrivialCall(Thread &thread, addr_t sp,
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;
}
diff --git a/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp b/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
index 9d15cb57bd0..df63a31d198 100644
--- a/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
+++ b/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
@@ -600,9 +600,8 @@ bool ABISysV_mips::PrepareTrivialCall(Thread &thread, addr_t sp,
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(Thread &thread, addr_t sp,
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(Thread &thread, addr_t sp,
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(Thread &thread, addr_t sp,
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)
diff --git a/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp b/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
index 3f3b807a47c..7fb1ea243ea 100644
--- a/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
+++ b/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
@@ -589,18 +589,16 @@ bool ABISysV_mips64::PrepareTrivialCall(Thread &thread, addr_t sp,
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(Thread &thread, addr_t sp,
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(Thread &thread, addr_t sp,
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)
diff --git a/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp b/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
index 3f2d49c7df0..e37a6ae046a 100644
--- a/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
+++ b/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
@@ -255,18 +255,16 @@ bool ABISysV_ppc::PrepareTrivialCall(Thread &thread, addr_t sp,
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(Thread &thread, addr_t sp,
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(Thread &thread, addr_t sp,
// %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;
diff --git a/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp b/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
index 66f812df3d6..92d5f9ce08d 100644
--- a/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
+++ b/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
@@ -106,18 +106,16 @@ bool ABISysV_ppc64::PrepareTrivialCall(Thread &thread, addr_t sp,
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(Thread &thread, addr_t sp,
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(Thread &thread, addr_t sp,
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(Thread &thread, addr_t sp,
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;
diff --git a/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp b/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
index abe847b386a..227925fd903 100644
--- a/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
+++ b/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
@@ -252,16 +252,14 @@ bool ABISysV_s390x::PrepareTrivialCall(Thread &thread, addr_t sp,
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(Thread &thread, addr_t sp,
// %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;
diff --git a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
index 255db1d2dfb..80b99e6b42b 100644
--- a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
+++ b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
@@ -270,18 +270,16 @@ bool ABISysV_x86_64::PrepareTrivialCall(Thread &thread, addr_t sp,
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(Thread &thread, addr_t sp,
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(Thread &thread, addr_t sp,
// %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;
diff --git a/lldb/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp b/lldb/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp
index 5dc7717d865..fdd10a60209 100644
--- a/lldb/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp
+++ b/lldb/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp
@@ -1129,18 +1129,16 @@ bool ABIWindows_x86_64::PrepareTrivialCall(Thread &thread, addr_t sp,
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::PrepareTrivialCall(Thread &thread, addr_t sp,
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::PrepareTrivialCall(Thread &thread, addr_t sp,
// %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;
diff --git a/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
index 60f1a2eb757..5f2f6eeb826 100644
--- a/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
+++ b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
@@ -127,10 +127,10 @@ lldb::addr_t ArchitectureMips::GetBreakableLoadAddress(lldb::addr_t addr,
// 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;
}
diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
index 242085ac872..7ff783da346 100644
--- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -430,10 +430,10 @@ DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress(lldb::addr_t addr,
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::CheckForKernelImageAtAddress(lldb::addr_t addr,
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::CheckForKernelImageAtAddress(lldb::addr_t addr,
} 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::KextImageInfo::ReadMemoryModule(
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::KextImageInfo::ReadMemoryModule(
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::KextImageInfo::LoadImageUsingMemoryModule(
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::BreakpointHit(StoppointCallbackContext *context,
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::ParseKextSummaries(
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::ParseKextSummaries(
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(Log *log) const {
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::GetStepThroughTrampolinePlan(Thread &thread,
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;
}
diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
index 23c8416f498..5b19647a27b 100644
--- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
@@ -277,8 +277,7 @@ bool DynamicLoaderHexagonDYLD::SetRendezvousBreakpoint() {
// 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::SetRendezvousBreakpoint() {
.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::RendezvousBreakpointHit(
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::RendezvousBreakpointHit(
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::RefreshModules() {
}
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::RefreshModules() {
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::LoadAllCurrentModules() {
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::LoadAllCurrentModules() {
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::GetThreadLocalData(const lldb::ModuleSP module,
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;
diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp
index 844a06c2b37..a3f3c3d3168 100644
--- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp
@@ -339,16 +339,16 @@ void HexagonDYLDRendezvous::DumpToLog(Log *log) const {
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(Log *log) const {
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);
}
}
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
index 57d87eb145e..61afe51034e 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
@@ -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::UpdateSpecialBinariesFromNewImageInfos(
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::UpdateSpecialBinariesFromNewImageInfos(
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::AddModulesUsingImageInfos(
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::PutToLog(Log *log,
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::GetStepThroughTrampolinePlan(Thread &thread,
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::GetStepThroughTrampolinePlan(Thread &thread,
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::GetStepThroughTrampolinePlan(Thread &thread,
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::GetStepThroughTrampolinePlan(Thread &thread,
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::GetStepThroughTrampolinePlan(Thread &thread,
&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::GetStepThroughTrampolinePlan(Thread &thread,
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(Process *process) {
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;
}
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
index 6bc65ecef35..057c20f1fb2 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
@@ -173,9 +173,8 @@ void DynamicLoaderMacOS::DoInitialImageFetch() {
->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() &&
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
index 53424f018c5..4d7c5623c79 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
@@ -525,8 +525,7 @@ bool DynamicLoaderMacOSXDYLD::AddModulesUsingImageInfosAddress(
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::RemoveModulesUsingImageInfosAddress(
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::RemoveModulesUsingImageInfosAddress(
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::RemoveModulesUsingImageInfosAddress(
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::InitializeFromAllImageInfos() {
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(Log *log) const {
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) {
diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
index 0d736738ebb..bc5b480c674 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
@@ -33,16 +33,14 @@ static addr_t ResolveRendezvousAddress(Process *process) {
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(Process *process) {
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 *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) const {
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) const {
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);
}
}
diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
index b55660899d0..3ca73e1af15 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -85,15 +85,13 @@ DynamicLoaderPOSIXDYLD::~DynamicLoaderPOSIXDYLD() {
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::EntryBreakpointHit(
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::EntryBreakpointHit(
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::RendezvousBreakpointHit(
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::LoadAllCurrentModules() {
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::LoadAllCurrentModules() {
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::GetThreadLocalData(const lldb::ModuleSP module_sp,
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::ResolveExecutableModule(
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::ResolveExecutableModule(
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;
}
diff --git a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
index fa3fbe0d9fa..aa007805c9f 100644
--- a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
@@ -122,38 +122,36 @@ lldb::addr_t DynamicLoaderWindowsDYLD::GetLoadAddress(ModuleSP executable) {
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;
+ // 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;
+ // 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);
+ // 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();
+ 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())
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp
index 369f88327dd..fbafa131ac4 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp
@@ -92,7 +92,7 @@ void ASTDumper::ToLog(Log *log, const char *prefix) {
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 char *prefix) {
end = strchr(str, '\n');
}
- log->Printf("%s%s", prefix, str);
+ LLDB_LOGF(log, "%s%s", prefix, str);
free(alloc);
}
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
index 526ef90782e..68eaad33f51 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
@@ -58,13 +58,13 @@ void ASTResultSynthesizer::TransformTopLevelDecl(Decl *D) {
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::SynthesizeFunctionResult(FunctionDecl *FunDecl) {
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::SynthesizeFunctionResult(FunctionDecl *FunDecl) {
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::SynthesizeObjCMethodResult(
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::SynthesizeObjCMethodResult(
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::SynthesizeBodyResult(CompoundStmt *Body,
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::MaybeRecordPersistentType(TypeDecl *D) {
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::RecordPersistentDecl(NamedDecl *D) {
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::CommitPersistentDecls() {
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;
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
index c5778f86bb6..5910d062b24 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -273,13 +273,13 @@ void ClangASTSource::CompleteType(TagDecl *tag_decl) {
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(TagDecl *tag_decl) {
// 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(TagDecl *tag_decl) {
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(TagDecl *tag_decl) {
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(TagDecl *tag_decl) {
}
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::ObjCInterfaceDecl *interface_decl) {
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::ObjCInterfaceDecl *interface_decl) {
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::FindExternalLexicalDecls(
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::FindExternalLexicalDecls(
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::FindExternalLexicalDecls(
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::FindExternalVisibleDecls(NameSearchContext &context) {
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::FindExternalVisibleDecls(NameSearchContext &context) {
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::FindExternalVisibleDecls(NameSearchContext &context) {
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::FindExternalVisibleDecls(NameSearchContext &context) {
} 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::FindExternalVisibleDecls(NameSearchContext &context) {
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::FindExternalVisibleDecls(
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::FindExternalVisibleDecls(
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::FindExternalVisibleDecls(
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::FindExternalVisibleDecls(
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::FindExternalVisibleDecls(
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::FindExternalVisibleDecls(
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::FindExternalVisibleDecls(
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::FindExternalVisibleDecls(
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::FindObjCMethodDeclsWithOrigin(
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(NameSearchContext &context) {
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(NameSearchContext &context) {
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(NameSearchContext &context) {
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 FindObjCPropertyAndIvarDeclsWithOrigin(
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 FindObjCPropertyAndIvarDeclsWithOrigin(
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::FindObjCPropertyAndIvarDecls(NameSearchContext &context) {
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::FindObjCPropertyAndIvarDecls(NameSearchContext &context) {
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::FindObjCPropertyAndIvarDecls(NameSearchContext &context) {
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::FindObjCPropertyAndIvarDecls(NameSearchContext &context) {
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(const RecordDecl *record, uint64_t &size,
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(const RecordDecl *record, uint64_t &size,
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(const RecordDecl *record, uint64_t &size,
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(const RecordDecl *record, uint64_t &size,
: 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::CompleteNamespaceMap(
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::CompleteNamespaceMap(
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::CompleteNamespaceMap(
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::AddFunDecl(const CompilerType &type,
} 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
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index e95a0305cd1..3092994f2c0 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -383,8 +383,7 @@ bool ClangExpressionDeclMap::AddPersistentVariable(const NamedDecl *decl,
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::AddPersistentVariable(const NamedDecl *decl,
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::AddValueToStruct(const NamedDecl *decl,
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::AddValueToStruct(const NamedDecl *decl,
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::AddValueToStruct(const NamedDecl *decl,
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::FindExternalVisibleDecls(
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::FindExternalVisibleDecls(
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::FindExternalVisibleDecls(
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::FindExternalVisibleDecls(
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::FindExternalVisibleDecls(
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::FindExternalVisibleDecls(
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::FindExternalVisibleDecls(
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::FindExternalVisibleDecls(
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::FindExternalVisibleDecls(
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::FindExternalVisibleDecls(
: 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::FindExternalVisibleDecls(
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::FindExternalVisibleDecls(
: 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::GetVariableValue(VariableSP &var,
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::GetVariableValue(VariableSP &var,
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::AddOneVariable(NameSearchContext &context,
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::AddOneVariable(NameSearchContext &context,
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::AddOneVariable(NameSearchContext &context,
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::AddOneGenericVariable(NameSearchContext &context,
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::ResolveUnknownTypes() {
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::ResolveUnknownTypes() {
}
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::AddOneRegister(NameSearchContext &context,
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::AddOneRegister(NameSearchContext &context,
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::AddOneFunction(NameSearchContext &context,
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::AddOneFunction(NameSearchContext &context,
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::AddOneFunction(NameSearchContext &context,
} 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::AddOneFunction(NameSearchContext &context,
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(NameSearchContext &context,
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(NameSearchContext &context,
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(NameSearchContext &context,
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;
}
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index 9e83f5ca153..c9226ba5e92 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -331,9 +331,8 @@ ClangExpressionParser::ClangExpressionParser(
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::ClangExpressionParser(
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::ClangExpressionParser(
// 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::ClangExpressionParser(
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 ClangExpressionParser::PrepareForExecution(
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 ClangExpressionParser::PrepareForExecution(
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 ClangExpressionParser::PrepareForExecution(
}
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 ClangExpressionParser::PrepareForExecution(
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 ClangExpressionParser::PrepareForExecution(
}
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);
}
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
index eabc96aa8e5..8fbfa6e4757 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
@@ -179,8 +179,7 @@ ClangFunctionCaller::CompileFunction(lldb::ThreadSP thread_to_use_sp,
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
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
index 65c54739183..42d3f22014d 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
@@ -30,10 +30,10 @@ static bool VerifyClangPath(const llvm::Twine &clang_path) {
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 DefaultComputeClangResourceDirectory(FileSpec &lldb_shlib_spec,
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::GetClangResourceDir() {
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;
}
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
index 2dae5b7022f..6e8aa688a73 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -90,21 +90,18 @@ ClangUserExpression::~ClangUserExpression() {}
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(ExecutionContext &exe_ctx, Status &err) {
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(ExecutionContext &exe_ctx, Status &err) {
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(DiagnosticManager &diagnostic_manager,
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(ExecutionContext &exe_ctx,
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
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
index f8e004fe7d4..d5ffb9529f3 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
@@ -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::Module &M) {
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::Module &M) {
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;
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
index 07acb2e1030..ae91e18e8da 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
@@ -195,8 +195,7 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) {
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(llvm::Function &llvm_function) {
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(llvm::Function &llvm_function) {
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(llvm::Function &llvm_function) {
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(llvm::Function &llvm_function) {
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(llvm::Function &llvm_function) {
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(llvm::Function &llvm_function) {
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(llvm::Function &llvm_function) {
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(llvm::GlobalVariable *ns_str,
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(llvm::GlobalVariable *ns_str,
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::RewriteObjCConstStrings() {
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::RewriteObjCConstStrings() {
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(Instruction *selector_load) {
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(Instruction *selector_load) {
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::RewriteObjCClassReference(Instruction *class_load) {
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::RewriteObjCClassReference(Instruction *class_load) {
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(llvm::Instruction *persistent_alloc) {
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::RewritePersistentAllocs(llvm::BasicBlock &basic_block) {
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(uint8_t *data, Constant *initializer) {
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(Value *llvm_value_ptr) {
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(Value *llvm_value_ptr) {
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(Value *llvm_value_ptr) {
(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(Value *llvm_value_ptr) {
}
} 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 *symbol) {
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 *symbol) {
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::MaybeHandleCallArguments(CallInst *Old) {
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 *classlist_reference) {
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(Function &llvm_function) {
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(Function &llvm_function) {
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(Function &llvm_function) {
}
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(Function &llvm_function) {
}
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(Function &llvm_function) {
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(Function &llvm_function) {
}
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 &llvm_module) {
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 &llvm_module) {
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 &llvm_module) {
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 &llvm_module) {
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 &llvm_module) {
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 &llvm_module) {
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 &llvm_module) {
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 &llvm_module) {
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 &llvm_module) {
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 &llvm_module) {
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 &llvm_module) {
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 &llvm_module) {
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 &llvm_module) {
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 &llvm_module) {
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 &llvm_module) {
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;
diff --git a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
index 140d09ed43c..bc429d747cf 100644
--- a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
+++ b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
@@ -177,8 +177,8 @@ void JITLoaderGDB::SetJITBreakpoint(lldb_private::ModuleList &module_list) {
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_private::ModuleList &module_list) {
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(void *baton,
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(bool all_entries) {
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(bool all_entries) {
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(bool all_entries) {
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(bool all_entries) {
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()) {
diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
index 52519c8fd2f..4e50ae0be28 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
@@ -79,11 +79,10 @@ TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfoFromVTableAddress(
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::GetTypeInfoFromVTableAddress(
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::GetTypeInfoFromVTableAddress(
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::GetTypeInfoFromVTableAddress(
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::GetTypeInfoFromVTableAddress(
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)
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
index 18f2a1829a4..078543a86ca 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
@@ -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());
-
- log->Printf(" AOEAS::CT[%u] Before:", current_id);
+ 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());
+
+ 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());
-
- log->Printf(" AOEAS::CT[%u] Before:", current_id);
+ 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());
+
+ 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(clang::ObjCInterfaceDecl *interface_decl) {
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(clang::ObjCInterfaceDecl *interface_decl) {
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(clang::ObjCInterfaceDecl *interface_decl) {
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(clang::ObjCInterfaceDecl *interface_decl) {
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(clang::ObjCInterfaceDecl *interface_decl) {
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(ConstString name, bool append,
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(ConstString name, bool append,
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(ConstString name, bool append,
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(ConstString name, bool append,
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(ConstString name, bool append,
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);
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
index c8884fd5c9b..88bfe2ce020 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
@@ -395,10 +395,11 @@ void AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded() {
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::UpdateISAToDescriptorMapIfNeeded() {
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",
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 635eaff637b..cfec2de1fb9 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -1209,11 +1209,11 @@ AppleObjCRuntimeV2::GetClassDescriptor(ValueObject &valobj) {
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::UpdateISAToDescriptorMapDynamic(
// 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::UpdateISAToDescriptorMapDynamic(
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::UpdateISAToDescriptorMapDynamic(
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::UpdateISAToDescriptorMapDynamic(
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::UpdateISAToDescriptorMapDynamic(
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::UpdateISAToDescriptorMapDynamic(
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::ParseClassInfoArray(const DataExtractor &data,
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::ParseClassInfoArray(const DataExtractor &data,
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::UpdateISAToDescriptorMapSharedCache() {
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::UpdateISAToDescriptorMapSharedCache() {
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::UpdateISAToDescriptorMapSharedCache() {
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::UpdateISAToDescriptorMapSharedCache() {
}
} 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::UpdateISAToDescriptorMapFromMemory(
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::UpdateISAToDescriptorMapIfNeeded() {
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::NonPointerISACache::EvaluateNonPointerISA(
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::NonPointerISACache::EvaluateNonPointerISA(
// 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::NonPointerISACache::EvaluateNonPointerISA(
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::NonPointerISACache::EvaluateNonPointerISA(
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::NonPointerISACache::EvaluateNonPointerISA(
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
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
index b3eb09caa86..f46cc1f8522 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
@@ -593,7 +593,7 @@ bool AppleObjCTrampolineHandler::AppleObjCVTables::ReadRegions(
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::SetupDispatchFunction(Thread &thread,
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::SetupDispatchFunction(Thread &thread,
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::SetupDispatchFunction(Thread &thread,
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::GetStepThroughDispatchPlan(Thread &thread,
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::GetStepThroughDispatchPlan(Thread &thread,
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::GetStepThroughDispatchPlan(Thread &thread,
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::GetStepThroughDispatchPlan(Thread &thread,
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::GetStepThroughDispatchPlan(Thread &thread,
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::GetStepThroughDispatchPlan(Thread &thread,
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::GetStepThroughDispatchPlan(Thread &thread,
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());
}
}
}
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
index d18435c9c6d..af630eee726 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
@@ -141,17 +141,15 @@ bool AppleThreadPlanStepThroughObjCTrampoline::ShouldStop(Event *event_ptr) {
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 AppleThreadPlanStepThroughObjCTrampoline::ShouldStop(Event *event_ptr) {
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:
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
index 631c15c46ce..1e39ff14a89 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
@@ -64,9 +64,10 @@ void ObjCLanguageRuntime::AddToMethodCache(lldb::addr_t class_addr,
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));
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp
index 60549663db6..b396781e672 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp
@@ -140,10 +140,10 @@ bool RenderScriptRuntimeModulePass::runOnModule(llvm::Module &module) {
// 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);
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
index c9cd34cf379..f45c9b74721 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -138,9 +138,8 @@ bool GetArgsX86(const GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) {
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, ArgItem *arg_list, size_t num_args) {
// 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, ArgItem *arg_list, size_t num_args) {
}
// 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 *arg_list, size_t num_args) {
}
// 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, ArgItem *arg_list, size_t num_args) {
}
// 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, ArgItem *arg_list, size_t num_args) {
}
// 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, ArgItem *arg_list, size_t num_args) {
}
// 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, ArgItem *arg_list, size_t num_args) {
// 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, ArgItem *arg_list, size_t num_args) {
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, Address &addr) {
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::SearchCallback(lldb_private::SearchFilter &filter,
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 RSScriptGroupBreakpointResolver::SearchCallback(
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(RuntimeHook *hook,
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::CaptureDebugHintScriptGroup2(
}};
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::CaptureDebugHintScriptGroup2(
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::CaptureDebugHintScriptGroup2(
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::CaptureDebugHintScriptGroup2(
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::CaptureDebugHintScriptGroup2(
// 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::CaptureDebugHintScriptGroup2(
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::CaptureScriptInvokeForEachMulti(
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::CaptureScriptInvokeForEachMulti(
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::CaptureScriptInvokeForEachMulti(
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::CaptureScriptInvokeForEachMulti(
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::CaptureSetGlobalVar(RuntimeHook *hook,
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::CaptureAllocationInit(RuntimeHook *hook,
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::CaptureAllocationDestroy(RuntimeHook *hook,
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::CaptureScriptInit(RuntimeHook *hook,
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::CaptureScriptInit(RuntimeHook *hook,
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::LoadRuntimeHooks(lldb::ModuleSP module,
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::LoadRuntimeHooks(lldb::ModuleSP module,
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::LoadRuntimeHooks(lldb::ModuleSP module,
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::LoadRuntimeHooks(lldb::ModuleSP module,
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::FixupScriptDetails(RSModuleDescriptorSP rsmodule_sp) {
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::FixupScriptDetails(RSModuleDescriptorSP rsmodule_sp) {
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::EvalRSExpression(const char *expr,
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::EvalRSExpression(const char *expr,
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::EvalRSExpression(const char *expr,
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::EvalRSExpression(const char *expr,
*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(AllocationDetails *alloc,
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(AllocationDetails *alloc,
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(AllocationDetails *alloc,
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(AllocationDetails *alloc,
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(AllocationDetails *alloc,
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(AllocationDetails *alloc,
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(AllocationDetails *alloc,
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::JITElementPacked(Element &elem,
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::JITElementPacked(Element &elem,
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::JITElementPacked(Element &elem,
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(Element &elem,
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(Element &elem,
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(Element &elem,
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(Element &elem,
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::JITAllocationSize(AllocationDetails *alloc,
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::JITAllocationSize(AllocationDetails *alloc,
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::JITAllocationSize(AllocationDetails *alloc,
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::JITAllocationStride(AllocationDetails *alloc,
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::JITAllocationStride(AllocationDetails *alloc,
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::FindStructTypeName(Element &elem,
// '#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::FindStructTypeName(Element &elem,
// 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(Element &elem) {
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(AllocationDetails *alloc,
// 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(AllocationDetails *alloc,
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(AllocationDetails *alloc,
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(Stream &strm, const uint32_t alloc_id,
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(Stream &strm, const uint32_t alloc_id,
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(Stream &strm, const uint32_t alloc_id,
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(Stream &strm, const uint32_t alloc_id,
// 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(Stream &strm, const uint32_t alloc_id,
// 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(Stream &strm, const uint32_t alloc_id,
// 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(const lldb::ModuleSP &module_sp) {
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::ParseExportReduceCount(llvm::StringRef *lines,
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(Stream &strm, StackFrame *frame_ptr,
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(Stream &strm, StackFrame *frame_ptr,
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(Stream &strm, StackFrame *frame_ptr,
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(Stream &strm, StackFrame *frame_ptr,
*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::SetBreakAllKernels(bool do_break, TargetSP target) {
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::CreateKernelBreakpoint(ConstString name) {
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::CreateKernelBreakpoint(ConstString name) {
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::CreateReductionBreakpoint(ConstString name,
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::CreateReductionBreakpoint(ConstString name,
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::GetFrameVarAsUnsigned(const StackFrameSP frame_sp,
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::GetFrameVarAsUnsigned(const StackFrameSP frame_sp,
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::GetKernelCoordinate(RSCoordinate &coord,
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::GetKernelCoordinate(RSCoordinate &coord,
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::KernelBreakpointHit(void *baton,
// 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::KernelBreakpointHit(void *baton,
// 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::CreateScriptGroupBreakpoint(ConstString name,
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::CreateScriptGroupBreakpoint(ConstString name,
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(addr_t address) {
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::ResolveKernelName(lldb::addr_t kernel_addr,
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::ResolveKernelName(lldb::addr_t kernel_addr,
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;
}
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
index 4725e8c5b0e..a6d225d2fbd 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
@@ -93,9 +93,8 @@ llvm::FunctionType *cloneToStructRetFnTy(llvm::CallInst *call_inst) {
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(llvm::CallInst *call_inst) {
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);
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 4bfd593cd54..7d6ebc1693e 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -264,8 +264,7 @@ bool ELFNote::Parse(const DataExtractor &data, lldb::offset_t *offset) {
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::GetModuleSpecifications(
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::GetModuleSpecifications(
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::GetModuleSpecifications(
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::RefineModuleDetailsFromNote(lldb_private::DataExtractor &data,
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::RefineModuleDetailsFromNote(lldb_private::DataExtractor &data,
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::RefineModuleDetailsFromNote(lldb_private::DataExtractor &data,
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::RefineModuleDetailsFromNote(lldb_private::DataExtractor &data,
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::GetSectionHeaderInfo(SectionHeaderColl &section_headers,
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);
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 050cb78577b..1007dbbe12e 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -2103,8 +2103,9 @@ UUID ObjectFileMachO::GetSharedCacheUUID(FileSpec dyld_shared_cache,
}
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::GetProcessSharedCacheUUID(Process *process, addr_t &base_a
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::GetLLDBSharedCacheUUID(addr_t &base_addr, UUID &uuid) {
}
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
}
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index cc2b3ae845b..c1b57090534 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -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::ParseDependentModules() {
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::ParseDependentModules() {
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;
}
diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
index c1fe0cc8ddd..94cc5182776 100644
--- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
+++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
@@ -120,10 +120,10 @@ DynamicRegisterInfo *OperatingSystemPython::GetDynamicRegisterInfo() {
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::UpdateThreadList(ThreadList &old_thread_list,
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::UpdateThreadList(ThreadList &old_thread_list,
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::CreateRegisterContextForThread(Thread *thread,
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::CreateRegisterContextForThread(Thread *thread,
// 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::CreateThread(lldb::tid_t tid,
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
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
index 3b8c9206ca3..7076872dcaf 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -68,8 +68,8 @@ PlatformSP PlatformAndroid::CreateInstance(bool force, const ArchSpec *arch) {
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::CreateInstance(bool force, const ArchSpec *arch) {
}
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 FileSpec &source,
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::DownloadSymbolFile(const lldb::ModuleSP &module_sp,
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);
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
index e36527dc129..64b6fdb9079 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
@@ -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::LaunchGDBServer(lldb::pid_t &pid,
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::ConnectRemote(Args &args) {
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::DeleteForwardPort(lldb::pid_t pid) {
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);
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
index 6fc9d384ee4..40148e23a1b 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
@@ -70,8 +70,8 @@ PlatformSP PlatformAppleTVSimulator::CreateInstance(bool force,
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::CreateInstance(bool force,
}
}
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();
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
index 7f271a07998..0e21f3b96d9 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
@@ -69,8 +69,8 @@ PlatformSP PlatformAppleWatchSimulator::CreateInstance(bool force,
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::CreateInstance(bool force,
}
}
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();
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index c1292b2ed7d..73df7a2ed83 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -220,16 +220,16 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
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::GetSharedModuleWithLocalCache(
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::GetSharedModuleWithLocalCache(
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::GetSharedModuleWithLocalCache(
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::FindBundleBinaryInExecSearchPaths (const ModuleSpec &module_spec
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
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
index cb453b529d9..ee0d19253bf 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
@@ -80,8 +80,8 @@ PlatformSP PlatformDarwinKernel::CreateInstance(bool force,
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::CreateInstance(bool force,
// 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::CreateInstance(bool force,
}
}
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(Stream &strm) {
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::GetKernelsAndKextsInDirectoryHelper(
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::GetKernelsAndKextsInDirectoryHelper(
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::GetKernelsAndKextsInDirectoryHelper(
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(PlatformDarwinKernel *thisp,
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));
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
index 51908fae7cb..95ba81a2ab4 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
@@ -70,8 +70,8 @@ PlatformSP PlatformMacOSX::CreateInstance(bool force, const ArchSpec *arch) {
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::CreateInstance(bool force, const ArchSpec *arch) {
}
}
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();
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
index 8b45a867d85..ca50ea2863b 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
@@ -68,8 +68,8 @@ PlatformSP PlatformRemoteAppleBridge::CreateInstance(bool force,
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::CreateInstance(bool force,
}
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();
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
index 5b50acda2ee..10adc700fd8 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
@@ -69,8 +69,8 @@ PlatformSP PlatformRemoteAppleTV::CreateInstance(bool force,
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::CreateInstance(bool force,
}
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();
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
index 5dec3a06652..9fb388c26c7 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
@@ -66,8 +66,8 @@ PlatformSP PlatformRemoteAppleWatch::CreateInstance(bool force,
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::CreateInstance(bool force,
#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();
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
index 439ca8fcf05..e9bb2929318 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
@@ -150,17 +150,21 @@ bool PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() {
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::UpdateSDKDirectoryInfosIfNeeded() {
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::UpdateSDKDirectoryInfosIfNeeded() {
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::UpdateSDKDirectoryInfosIfNeeded() {
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::UpdateSDKDirectoryInfosIfNeeded() {
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::GetFileInSDK(const char *platform_file_path,
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::GetSymbolFile(const FileSpec &platform_file,
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::GetSymbolFile(const FileSpec &platform_file,
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::GetSymbolFile(const FileSpec &platform_file,
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;
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
index 9e916d8db03..81d9fcfe83c 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
@@ -61,8 +61,8 @@ PlatformSP PlatformRemoteiOS::CreateInstance(bool force, const ArchSpec *arch) {
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::CreateInstance(bool force, const ArchSpec *arch) {
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();
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
index e455edd38a0..6230962c2e2 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
@@ -70,8 +70,8 @@ PlatformSP PlatformiOSSimulator::CreateInstance(bool force,
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::CreateInstance(bool force,
}
}
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();
}
diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
index d10557596ff..b801816d18f 100644
--- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -276,8 +276,7 @@ PlatformPOSIX::PutFile(const lldb_private::FileSpec &source,
} 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::GetFile(
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::GetFile(
// 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(ProcessAttachInfo &attach_info,
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 =
diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
index 9c52b59e2b0..a63e6eac85e 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -169,21 +169,21 @@ bool PlatformRemoteGDBServer::GetModuleSpec(const FileSpec &module_file_spec,
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::GetRemoteWorkingDirectory() {
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::SetRemoteWorkingDirectory(
// 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::LaunchProcess(ProcessLaunchInfo &launch_info) {
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::LaunchProcess(ProcessLaunchInfo &launch_info) {
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::LaunchProcess(ProcessLaunchInfo &launch_info) {
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::MakeDirectory(const FileSpec &file_spec,
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::GetFilePermissions(const FileSpec &file_spec,
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::SetFilePermissions(const FileSpec &file_spec,
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::CreateSymlink(
{
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;
}
diff --git a/lldb/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp b/lldb/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp
index 3ec410fe7d7..f70ef97a2bc 100644
--- a/lldb/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp
+++ b/lldb/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp
@@ -254,9 +254,8 @@ CreatePosixSpawnFileAction(const FileAction &action,
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 PosixSpawnChildForPTraceDebugging(const char *path,
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 PosixSpawnChildForPTraceDebugging(const char *path,
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 PosixSpawnChildForPTraceDebugging(const char *path,
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 &launch_info, int *pty_master_fd,
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];
diff --git a/lldb/source/Plugins/Process/Darwin/MachException.cpp b/lldb/source/Plugins/Process/Darwin/MachException.cpp
index 70ad6736a74..073ad64b300 100644
--- a/lldb/source/Plugins/Process/Darwin/MachException.cpp
+++ b/lldb/source/Plugins/Process/Darwin/MachException.cpp
@@ -67,10 +67,11 @@ extern "C" kern_return_t catch_mach_exception_raise_state(
// 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_exception_raise_state_identity(
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 exc_port, mach_port_t thread_port,
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(mach_port_t port,
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(mach_port_t port,
// 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::CatchExceptionRaise(task_t task) {
} 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(::pid_t inferior_pid, task_t inferior_task,
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(::pid_t inferior_pid, task_t inferior_task,
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(::pid_t inferior_pid, task_t inferior_task,
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(task_t task) {
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(task_t task) {
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(task_t task) {
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(task_t task) {
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(task_t task) {
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());
}
}
diff --git a/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp b/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
index fe7de27e0ee..50baa9c9397 100644
--- a/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
+++ b/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
@@ -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::FinalizeLaunch(LaunchFlavor launch_flavor,
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::FinalizeLaunch(LaunchFlavor launch_flavor,
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::FinalizeLaunch(LaunchFlavor launch_flavor,
// 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::ExceptionMessageReceived(
// 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::ExceptionThread(void *arg) {
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::DoExceptionThread() {
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::DoExceptionThread() {
// 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::DoExceptionThread() {
// 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::DoExceptionThread() {
// 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::DoExceptionThread() {
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::DoExceptionThread() {
}
#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::StartExceptionThread() {
&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::StartExceptionThread() {
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::StartExceptionThread() {
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::StartExceptionThread() {
::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::ExceptionMessageBundleComplete() {
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::ExceptionMessageBundleComplete() {
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::ExceptionMessageBundleComplete() {
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::ExceptionMessageBundleComplete() {
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::ExceptionMessageBundleComplete() {
// 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::StartWaitpidThread(MainLoop &main_loop) {
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::StartWaitpidThread(MainLoop &main_loop) {
::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::StartWaitpidThread(MainLoop &main_loop) {
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::DoWaitpidThread() {
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::DoWaitpidThread() {
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::DoWaitpidThread() {
// 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::SendInferiorExitStatusToMainLoop(::pid_t pid,
// 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::SendInferiorExitStatusToMainLoop(::pid_t pid,
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::HandleWaitpidResult() {
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::HandleWaitpidResult() {
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::TaskPortForProcessID(Status &error,
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::TaskPortForProcessID(Status &error,
// 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::PrivateResume() {
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::ReplyToAllExceptions() {
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::ReplyToAllExceptions() {
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::ReplyToAllExceptions() {
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(task_t task,
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(task_t task,
(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 ResumeActionList &resume_actions) {
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 ResumeActionList &resume_actions) {
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;
}
diff --git a/lldb/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp b/lldb/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp
index 89de92a6df4..1faa5b219cb 100644
--- a/lldb/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp
+++ b/lldb/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp
@@ -301,10 +301,10 @@ uint32_t NativeThreadListDarwin::UpdateThreadList(NativeProcessDarwin &process,
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::UpdateThreadList(NativeProcessDarwin &process,
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;
}
diff --git a/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp b/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp
index 74983553127..0a49f96f54a 100644
--- a/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp
+++ b/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp
@@ -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 ProcessMessage &message) {
// 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 ProcessMessage &message) {
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 ProcessMessage &message) {
// 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));
diff --git a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
index 770794569f7..6186e1fb83f 100644
--- a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
+++ b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
@@ -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(ThreadList &old_thread_list,
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(Watchpoint *wp, bool notify) {
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(Watchpoint *wp, bool notify) {
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::SetSoftwareSingleStepBreakpoint(lldb::tid_t tid,
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::SetSoftwareSingleStepBreakpoint(lldb::tid_t tid,
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();
diff --git a/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp b/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
index 4b9225db5e3..2866ebf479b 100644
--- a/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
+++ b/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
@@ -66,13 +66,14 @@ extern long PtraceWrapper(int req, lldb::pid_t pid, void *addr, int data,
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::pid_t pid, void *addr, int data,
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::pid_t pid, void *addr, int data,
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(ProcessMonitor *monitor, lldb::pid_t pid,
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::MonitorSIGTRAP(ProcessMonitor *monitor,
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::MonitorSIGTRAP(ProcessMonitor *monitor,
// 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::MonitorSignal(ProcessMonitor *monitor,
//
// 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 unused, uint32_t signo) {
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;
}
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
index d7206195acb..27eaefd7590 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
@@ -346,8 +346,7 @@ bool NativeRegisterContextLinux_arm::IsFPR(unsigned reg) const {
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::GetHardwareBreakHitIndex(
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::GetHardwareBreakHitIndex(
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;
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
index 9bb9e6b77ec..e65b768ff14 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -347,8 +347,7 @@ bool NativeRegisterContextLinux_arm64::IsFPR(unsigned reg) const {
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::GetHardwareBreakHitIndex(
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::GetHardwareBreakHitIndex(
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;
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
index 3c5326898b0..49f1d44b39d 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
@@ -1191,8 +1191,8 @@ uint32_t NativeRegisterContextLinux_x86_64::SetHardwareWatchpoint(
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;
diff --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
index 287a271689a..677aee34a18 100644
--- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
@@ -133,9 +133,10 @@ bool NativeThreadLinux::GetStopReason(ThreadStopInfo &stop_info,
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(uint32_t signo) {
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;
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
index 1a75326f3b2..5737efd1d6e 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
@@ -70,8 +70,8 @@ bool CommunicationKDP::SendRequestAndGetReply(
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::SendRequestPacketNoLock(
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::SendRequestPacketNoLock(
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(const uint8_t *src, size_t src_len,
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(const uint8_t *src, size_t src_len,
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(const uint8_t *src, size_t src_len,
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;
}
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
index 6f1bb4b6476..52c494db6be 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -394,8 +394,7 @@ void ProcessKDP::DidAttach(ArchSpec &process_arch) {
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_stop) {
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_private::Debugger &debugger) {
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;
diff --git a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
index a7cd637bf82..6cc2810fa23 100644
--- a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
+++ b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
@@ -906,8 +906,8 @@ uint32_t NativeRegisterContextNetBSD_x86_64::SetHardwareWatchpoint(
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;
diff --git a/lldb/source/Plugins/Process/Utility/AuxVector.cpp b/lldb/source/Plugins/Process/Utility/AuxVector.cpp
index aab164ff93a..25a1d0b5af0 100644
--- a/lldb/source/Plugins/Process/Utility/AuxVector.cpp
+++ b/lldb/source/Plugins/Process/Utility/AuxVector.cpp
@@ -43,9 +43,9 @@ void AuxVector::DumpToLog(lldb_private::Log *log) const {
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);
}
}
diff --git a/lldb/source/Plugins/Process/Utility/HistoryThread.cpp b/lldb/source/Plugins/Process/Utility/HistoryThread.cpp
index 3cb58317262..295c17e474f 100644
--- a/lldb/source/Plugins/Process/Utility/HistoryThread.cpp
+++ b/lldb/source/Plugins/Process/Utility/HistoryThread.cpp
@@ -32,17 +32,15 @@ HistoryThread::HistoryThread(lldb_private::Process &process, lldb::tid_t tid,
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();
}
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
index e804a4d251f..4ca33c248c6 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
@@ -1111,9 +1111,10 @@ int RegisterContextDarwin_arm::WriteRegisterSet(uint32_t set) {
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::NumSupportedHardwareBreakpoints() {
// 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::NumSupportedHardwareWatchpoints() {
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::SetHardwareWatchpoint(lldb::addr_t addr,
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
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
index 85d518a487b..331acddb975 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
@@ -285,10 +285,11 @@ int RegisterContextDarwin_arm64::WriteRegisterSet(uint32_t set) {
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]);
}
}
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp
index 820d280c37f..873713fd837 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp
@@ -496,11 +496,11 @@ int RegisterContextDarwin_i386::GetSetForNativeRegNum(int reg_num) {
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]);
}
}
}
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
index 786c4a5df49..62f38dcd85a 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
@@ -2087,8 +2087,9 @@ void RegisterContextLLDB::UnwindLogMsg(const char *fmt, ...) {
}
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::UnwindLogMsgVerbose(const char *fmt, ...) {
}
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);
}
}
diff --git a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp
index 38209fb2494..4b135351593 100644
--- a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp
+++ b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp
@@ -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::GetOneMoreFrame(ABI *abi) {
// 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::GetOneMoreFrame(ABI *abi) {
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::GetOneMoreFrame(ABI *abi) {
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::GetOneMoreFrame(ABI *abi) {
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::GetOneMoreFrame(ABI *abi) {
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::GetOneMoreFrame(ABI *abi) {
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::GetOneMoreFrame(ABI *abi) {
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 *abi) {
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;
}
diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
index 980169e16c5..d92c20ef8a9 100644
--- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -417,7 +417,7 @@ static void ParseFreeBSDPrStatus(ThreadData &thread_data,
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
diff --git a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
index a5d1fc4a7bf..508c8a3108a 100644
--- a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
+++ b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
@@ -181,9 +181,8 @@ ThreadElfCore::CreateRegisterContextForFrame(StackFrame *frame) {
}
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");
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
index fe7ef6b3ace..140e2433023 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
@@ -63,18 +63,16 @@ StateType GDBRemoteClientBase::SendContinuePacketAndWaitForResponse(
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::SendContinuePacketAndWaitForResponse(
// 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::SendPacketAndWaitForResponse(
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::SendPacketAndReceiveResponseWithOutputSupport(
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::SendPacketAndWaitForResponseNoLock(
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::SendPacketAndWaitForResponseNoLock(
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::unlock() {
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::SyncWithContinueThread(bool interrupt) {
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)
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 11052eff948..23a069d8223 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -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::SendRawPacketNoLock(llvm::StringRef packet,
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::SendRawPacketNoLock(llvm::StringRef packet,
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::DecompressPacket() {
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(const uint8_t *src, size_t src_len,
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(const uint8_t *src, size_t src_len,
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(const uint8_t *src, size_t src_len,
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(const uint8_t *src, size_t src_len,
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(const uint8_t *src, size_t src_len,
}
} 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::StartDebugserverProcess(
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::StartDebugserverProcess(
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::StartDebugserverProcess(
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::StartDebugserverProcess(
// 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::StartDebugserverProcess(
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::StartDebugserverProcess(
// 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::StartDebugserverProcess(
// 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::StartDebugserverProcess(
*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::StartDebugserverProcess(
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::StartDebugserverProcess(
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::StartDebugserverProcess(
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::StartDebugserverProcess(
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::StartDebugserverProcess(
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::StartDebugserverProcess(
}
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;
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 9797184026e..8ebeaf03be9 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -439,8 +439,7 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() {
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::SendThreadSpecificPacketAndWaitForResponse(
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::SendPacketsAndConcatenateResponses(
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::GetHostInfo(bool force) {
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::GetCurrentProcessInfo(bool allow_lazy) {
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::GetThreadStopInfo(
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::GetCurrentThreadIDs(
#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::ServeSymbolLookups(
} 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::GetSupportedStructuredDataPlugins() {
!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());
}
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp
index bcddb4faf86..f9f67fcbcaa 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp
@@ -95,10 +95,10 @@ void GDBRemoteCommunicationHistory::Dump(Log *log) const {
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());
}
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
index 49cbeb023fd..d137c4c39ec 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
@@ -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);
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
index 9767d3e8b98..c1eaa1dc2ed 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
@@ -421,8 +421,7 @@ GDBRemoteCommunicationServerCommon::Handle_qUserName(
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::Handle_qUserName(
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::Handle_A(StringExtractorGDBRemote &packet) {
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;
}
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 190db341ae0..6bdbbd24fdb 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -249,18 +249,18 @@ Status GDBRemoteCommunicationServerLLGS::LaunchProcess() {
// 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::LaunchProcess() {
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::AttachToProcess(lldb::pid_t pid) {
// 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::InitializeDelegate(
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(NativeThreadProtocol &thread) {
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(NativeThreadProtocol &thread) {
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(NativeProcessProtocol &process,
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::SendStopReplyPacketForThread(
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::SendStopReplyPacketForThread(
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::SendStopReplyPacketForThread(
&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::HandleInferiorState_Exited(
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::HandleInferiorState_Stopped(
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::HandleInferiorState_Stopped(
// 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::ProcessStateChanged(
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::ProcessStateChanged(
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::DataAvailableCallback() {
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::DataAvailableCallback() {
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::StartSTDIOForwarding() {
// 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::SendProcessOutput() {
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_qGetWorkingDir(
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_C(StringExtractorGDBRemote &packet) {
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_c(StringExtractorGDBRemote &packet) {
// 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_p(StringExtractorGDBRemote &packet) {
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_p(StringExtractorGDBRemote &packet) {
// 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_p(StringExtractorGDBRemote &packet) {
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_P(StringExtractorGDBRemote &packet) {
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_P(StringExtractorGDBRemote &packet) {
// 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_P(StringExtractorGDBRemote &packet) {
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_P(StringExtractorGDBRemote &packet) {
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_H(StringExtractorGDBRemote &packet) {
// 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_H(StringExtractorGDBRemote &packet) {
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_H(StringExtractorGDBRemote &packet) {
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_I(StringExtractorGDBRemote &packet) {
// 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_memory_read(
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_memory_read(
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_memory_read(
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_M(StringExtractorGDBRemote &packet) {
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_qMemoryRegionInfoSupported(
// 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_qMemoryRegionInfo(
// 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_s(StringExtractorGDBRemote &packet) {
// 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_s(StringExtractorGDBRemote &packet) {
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(
"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_D(StringExtractorGDBRemote &packet) {
// 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_D(StringExtractorGDBRemote &packet) {
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_qThreadStopInfo(
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::MaybeCloseInferiorTerminalConnection() {
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 *GDBRemoteCommunicationServerLLGS::GetThreadFromSuffix(
// 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 *GDBRemoteCommunicationServerLLGS::GetThreadFromSuffix(
// 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:"));
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
index 6deb75f2f02..eb6cc6e6b8f 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -104,8 +104,8 @@ Status GDBRemoteCommunicationServerPlatform::LaunchGDBServer(
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::Handle_qLaunchGDBServer(
// 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::Handle_qLaunchGDBServer(
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,
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
index a77e659a55f..2bd0234f63e 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
@@ -206,11 +206,14 @@ bool GDBRemoteRegisterContext::ReadRegisterBytes(const RegisterInfo *reg_info,
} 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::WriteRegisterBytes(const RegisterInfo *reg_info,
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::ReadAllRegisterValues(
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::WriteAllRegisterValues(
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;
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index a6fdd8dd070..ce2073a91f4 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -354,10 +354,10 @@ ProcessGDBRemote::ProcessGDBRemote(lldb::TargetSP target_sp,
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::TargetSP target_sp,
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(Stream *strm,
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(Stream *strm,
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_private::Module *exe_module,
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_private::Module *exe_module,
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_private::Module *exe_module,
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>");
+ 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>");
}
- 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 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_private::Module *exe_module,
}
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_private::Module *exe_module,
}
}
} 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::ConnectToDebugserver(llvm::StringRef connect_url) {
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::ConnectToDebugserver(llvm::StringRef connect_url) {
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(ArchSpec &process_arch) {
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(ArchSpec &process_arch) {
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(ArchSpec &process_arch) {
}
}
- 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::DoAttachToProcessWithID(
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::SetThreadStopInfo(
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 &caused_stop) {
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 keep_stopped) {
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 keep_stopped) {
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::DoAllocateMemory(size_t size,
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::EnableBreakpointSite(BreakpointSite *bp_site) {
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::EnableBreakpointSite(BreakpointSite *bp_site) {
// 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::EnableBreakpointSite(BreakpointSite *bp_site) {
// 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::DisableBreakpointSite(BreakpointSite *bp_site) {
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::DisableBreakpointSite(BreakpointSite *bp_site) {
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::EnableWatchpoint(Watchpoint *wp, bool notify) {
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::DisableWatchpoint(Watchpoint *wp, bool notify) {
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::LaunchAndConnectToDebugserver(
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::MonitorDebugserverProcess(
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::DebuggerInitialize(Debugger &debugger) {
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::AsyncThread(void *arg) {
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::AsyncThread(void *arg) {
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::AsyncThread(void *arg) {
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::AsyncThread(void *arg) {
}
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::NewThreadNotifyBreakpointHit(
// 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::StartNoticingNewThreads() {
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::StartNoticingNewThreads() {
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::StartNoticingNewThreads() {
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(const FileSpec &module_file_spec,
}
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::GetLoadedModuleList(LoadedModuleInfoList &list) {
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::GetLoadedModuleList(LoadedModuleInfoList &list) {
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::GetLoadedModuleList(LoadedModuleInfoList &list) {
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::GetLoadedModuleList(LoadedModuleInfoList &list) {
// 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::GetLoadedModuleList(LoadedModuleInfoList &list) {
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::GetLoadedModuleList(LoadedModuleInfoList &list) {
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::GetLoadedModuleList(LoadedModuleInfoList &list) {
// 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::StringRef packet) {
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::StringRef packet) {
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;
diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
index 6607bce4488..8a6a58c5545 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
@@ -215,8 +215,7 @@ StructuredData::ObjectSP ThreadGDBRemote::FetchThreadExtendedInfo() {
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(StateType resume_state) {
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) {
diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
index 53101ab9fe5..888044218a4 100644
--- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
+++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
@@ -160,10 +160,10 @@ bool ProcessMachCore::GetDynamicLoaderAddress(lldb::addr_t addr) {
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::GetDynamicLoaderAddress(lldb::addr_t addr) {
// 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();
}
}
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 2d2b68ceaaa..e663c92afb9 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -688,19 +688,18 @@ bool ScriptInterpreterPythonImpl::EnterSession(uint16_t on_entry_flags,
// 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::Interrupt() {
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(
diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
index 81a27125c03..d94da5bedf1 100644
--- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
+++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
@@ -1119,26 +1119,26 @@ void StructuredDataDarwinLog::HandleArrivalOfStructuredData(
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::HandleArrivalOfStructuredData(
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(bool enabled) {
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::ModulesDidLoad(Process &process,
{
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::ModulesDidLoad(Process &process,
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::ModulesDidLoad(Process &process,
}
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::InitCompletionHookCallback(
// 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::InitCompletionHookCallback(
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::InitCompletionHookCallback(
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::InitCompletionHookCallback(
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::AddInitCompletionHook(Process &process) {
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::HandleDisplayOfEvent(
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());
}
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index b85ab54a10d..161589e01fb 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1407,12 +1407,11 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
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::ParseTypeFromDWARF(const SymbolContext &sc,
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::CopyUniqueClassMethodTypes(
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::CopyUniqueClassMethodTypes(
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::CopyUniqueClassMethodTypes(
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::CopyUniqueClassMethodTypes(
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::CopyUniqueClassMethodTypes(
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::CopyUniqueClassMethodTypes(
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::CopyUniqueClassMethodTypes(
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);
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
index ccf33e6dc34..c8da2381353 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
@@ -66,8 +66,8 @@ void DWARFDebugAranges::Dump(Log *log) const {
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());
}
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
index 953089fee22..f2d08eacd43 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
@@ -578,25 +578,25 @@ inline bool DWARFDebugLine::Prologue::IsValid() const {
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 *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 default_is_stmt) {
}
// 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
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index e44ff5f2d79..5716e3d7326 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -60,11 +60,11 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(
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)
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
index c97eb98557a..63600b31928 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
@@ -150,23 +150,21 @@ lldb::addr_t AppleGetItemInfoHandler::SetupGetItemInfoFunction(
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::SetupGetItemInfoFunction(
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::SetupGetItemInfoFunction(
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(Thread &thread, uint64_t item,
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(Thread &thread, uint64_t item,
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(Thread &thread, uint64_t item,
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(Thread &thread, uint64_t item,
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(Thread &thread, uint64_t item,
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;
}
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
index 12fad7f561b..ef1ea9bd1e5 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
@@ -154,24 +154,23 @@ lldb::addr_t AppleGetPendingItemsHandler::SetupGetPendingItemsFunction(
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::SetupGetPendingItemsFunction(
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::SetupGetPendingItemsFunction(
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::SetupGetPendingItemsFunction(
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::GetPendingItems(Thread &thread, addr_t queue,
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::GetPendingItems(Thread &thread, addr_t queue,
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::GetPendingItems(Thread &thread, addr_t queue,
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::GetPendingItems(Thread &thread, addr_t queue,
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;
}
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
index e1dabae0d58..c9df48654ba 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
@@ -165,16 +165,16 @@ AppleGetQueuesHandler::SetupGetQueuesFunction(Thread &thread,
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::SetupGetQueuesFunction(Thread &thread,
}
} 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::SetupGetQueuesFunction(Thread &thread,
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::SetupGetQueuesFunction(Thread &thread,
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(Thread &thread, addr_t page_to_free,
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(Thread &thread, addr_t page_to_free,
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(Thread &thread, addr_t page_to_free,
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(Thread &thread, addr_t page_to_free,
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;
}
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
index 7d0cbc0c100..fd4d21d8071 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
@@ -160,18 +160,18 @@ lldb::addr_t AppleGetThreadItemInfoHandler::SetupGetThreadItemInfoFunction(
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 AppleGetThreadItemInfoHandler::SetupGetThreadItemInfoFunction(
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 AppleGetThreadItemInfoHandler::SetupGetThreadItemInfoFunction(
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 AppleGetThreadItemInfoHandler::SetupGetThreadItemInfoFunction(
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::GetThreadItemInfo(Thread &thread,
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::GetThreadItemInfo(Thread &thread,
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::GetThreadItemInfo(Thread &thread,
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::GetThreadItemInfo(Thread &thread,
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;
}
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
index dfcc6acf841..4e384bd6ae5 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
@@ -927,13 +927,13 @@ void SystemRuntimeMacOSX::PopulateQueuesUsingLibBTR(
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));
OpenPOWER on IntegriCloud