Add some additional logging to

DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress to debug
corefiles that may not be correctly formed.

<rdar://problem/28884846> 

llvm-svn: 284900
This commit is contained in:
Jason Molenda 2016-10-21 23:45:07 +00:00
parent c8c9415644
commit bc22c8d8d8
1 changed files with 20 additions and 5 deletions

View File

@ -415,8 +415,14 @@ DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress(lldb::addr_t addr,
return UUID();
ObjectFile *exe_objfile = memory_module_sp->GetObjectFile();
if (exe_objfile == NULL)
if (exe_objfile == NULL) {
if (log)
log->Printf("DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress "
"found a binary at 0x%" PRIx64
" but could not create an object file from memory",
addr);
return UUID();
}
if (exe_objfile->GetType() == ObjectFile::eTypeExecutable &&
exe_objfile->GetStrata() == ObjectFile::eStrataKernel) {
@ -425,10 +431,19 @@ DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress(lldb::addr_t addr,
kernel_arch)) {
process->GetTarget().SetArchitecture(kernel_arch);
}
if (log)
log->Printf("DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress: "
"kernel binary image found at 0x%" PRIx64,
addr);
if (log) {
std::string uuid_str;
if (memory_module_sp->GetUUID().IsValid()) {
uuid_str = "with UUID ";
uuid_str += memory_module_sp->GetUUID().GetAsString();
} else {
uuid_str = "and no LC_UUID found in load commands ";
}
log->Printf(
"DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress: "
"kernel binary image found at 0x%" PRIx64 " with arch '%s' %s",
addr, kernel_arch.GetTriple().str().c_str(), uuid_str.c_str());
}
return memory_module_sp->GetUUID();
}
}