diff options
| author | Jason Molenda <jmolenda@apple.com> | 2016-02-04 23:45:17 +0000 |
|---|---|---|
| committer | Jason Molenda <jmolenda@apple.com> | 2016-02-04 23:45:17 +0000 |
| commit | aa3c37ae79805d6ef52fee0814a11c68dea5de83 (patch) | |
| tree | 6f7ab5db630d637444b4165ed05f4341979187bb | |
| parent | 812293ae1d44855bd09b90bcef94113855606d80 (diff) | |
| download | bcm5719-llvm-aa3c37ae79805d6ef52fee0814a11c68dea5de83.tar.gz bcm5719-llvm-aa3c37ae79805d6ef52fee0814a11c68dea5de83.zip | |
Add a little logging to ProcessMachCore so it is easier to tell when a user process dyld
or mach kernel binary are found, and if there are multiples of them found within a single
corefile.
<rdar://problem/24446112>
llvm-svn: 259850
| -rw-r--r-- | lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp index b199ec60636..713b262c650 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -19,6 +19,7 @@ #include "lldb/Core/DataBuffer.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/PluginManager.h" +#include "lldb/Core/Log.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleSpec.h" #include "lldb/Core/Section.h" @@ -163,6 +164,7 @@ ProcessMachCore::GetPluginVersion() bool ProcessMachCore::GetDynamicLoaderAddress (lldb::addr_t addr) { + Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_PROCESS)); llvm::MachO::mach_header header; Error error; if (DoReadMemory (addr, &header, sizeof(header), error) != sizeof(header)) @@ -194,6 +196,8 @@ 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); m_dyld_addr = addr; return true; @@ -203,6 +207,8 @@ ProcessMachCore::GetDynamicLoaderAddress (lldb::addr_t addr) // 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); // Address of the mach kernel "struct mach_header" in the core file. m_mach_kernel_addr = addr; return true; @@ -219,6 +225,7 @@ ProcessMachCore::GetDynamicLoaderAddress (lldb::addr_t addr) Error ProcessMachCore::DoLoadCore () { + Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_PROCESS)); Error error; if (!m_core_module_sp) { @@ -314,9 +321,7 @@ ProcessMachCore::DoLoadCore () // later if both are present. const size_t num_core_aranges = m_core_aranges.GetSize(); - for (size_t i = 0; - i < num_core_aranges && (m_dyld_addr == LLDB_INVALID_ADDRESS || m_mach_kernel_addr == LLDB_INVALID_ADDRESS); - ++i) + for (size_t i = 0; i < num_core_aranges; ++i) { const VMRangeToFileOffset::Entry *entry = m_core_aranges.GetEntryAtIndex(i); lldb::addr_t section_vm_addr_start = entry->GetRangeBase(); @@ -336,10 +341,14 @@ ProcessMachCore::DoLoadCore () { 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); 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); m_dyld_plugin_name = DynamicLoaderMacOSXDYLD::GetPluginNameStatic(); } } @@ -347,10 +356,14 @@ ProcessMachCore::DoLoadCore () { if (m_dyld_addr != LLDB_INVALID_ADDRESS) { + if (log) + log->Printf ("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); m_dyld_plugin_name = DynamicLoaderDarwinKernel::GetPluginNameStatic(); } } |

