summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/DynamicLoader
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-07-24 17:56:10 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-07-24 17:56:10 +0000
commit63e5fb76ecfed3434252868d8cf07d676f979f2f (patch)
tree349d6bd303f53aa57b988dee284c7f264404a8fc /lldb/source/Plugins/DynamicLoader
parent2bf871be4c35d70db080dde789cf9bb334c04057 (diff)
downloadbcm5719-llvm-63e5fb76ecfed3434252868d8cf07d676f979f2f.tar.gz
bcm5719-llvm-63e5fb76ecfed3434252868d8cf07d676f979f2f.zip
[Logging] Replace Log::Printf with LLDB_LOG macro (NFC)
This patch replaces explicit calls to log::Printf with the new LLDB_LOGF macro. The macro is similar to LLDB_LOG but supports printf-style format strings, instead of formatv-style format strings. So instead of writing: if (log) log->Printf("%s\n", str); You'd write: LLDB_LOG(log, "%s\n", str); This change was done mechanically with the command below. I replaced the spurious if-checks with vim, since I know how to do multi-line replacements with it. find . -type f -name '*.cpp' -exec \ sed -i '' -E 's/log->Printf\(/LLDB_LOGF\(log, /g' "{}" + Differential revision: https://reviews.llvm.org/D65128 llvm-svn: 366936
Diffstat (limited to 'lldb/source/Plugins/DynamicLoader')
-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
9 files changed, 300 insertions, 324 deletions
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())
OpenPOWER on IntegriCloud