Skip to content

Commit ec50423

Browse files
committed
Add two more addresses to check for the address of the kernel in debug mode;
also add some logging about where lldb is lookin for a kernel as it connects. <rdar://problem/24454582> llvm-svn: 259865
1 parent 3ab12b1 commit ec50423

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,16 @@ DynamicLoaderDarwinKernel::SearchForKernelWithDebugHints (Process *process)
266266
{
267267
return addr;
268268
}
269+
addr = process->ReadUnsignedIntegerFromMemory (0xfffffff000002010ULL, 8, LLDB_INVALID_ADDRESS, read_err);
270+
if (CheckForKernelImageAtAddress (addr, process).IsValid())
271+
{
272+
return addr;
273+
}
274+
addr = process->ReadUnsignedIntegerFromMemory (0xfffffff000004010ULL, 8, LLDB_INVALID_ADDRESS, read_err);
275+
if (CheckForKernelImageAtAddress (addr, process).IsValid())
276+
{
277+
return addr;
278+
}
269279
}
270280
else
271281
{
@@ -397,9 +407,13 @@ DynamicLoaderDarwinKernel::SearchForKernelViaExhaustiveSearch (Process *process)
397407
lldb_private::UUID
398408
DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress (lldb::addr_t addr, Process *process)
399409
{
410+
Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER));
400411
if (addr == LLDB_INVALID_ADDRESS)
401412
return UUID();
402413

414+
if (log)
415+
log->Printf ("DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress: looking for kernel binary at 0x%" PRIx64, addr);
416+
403417
// First try a quick test -- read the first 4 bytes and see if there is a valid Mach-O magic field there
404418
// (the first field of the mach_header/mach_header_64 struct).
405419

@@ -450,6 +464,8 @@ DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress (lldb::addr_t addr, Proc
450464
{
451465
process->GetTarget().SetArchitecture (kernel_arch);
452466
}
467+
if (log)
468+
log->Printf ("DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress: kernel binary image found at 0x%" PRIx64, addr);
453469
return memory_module_sp->GetUUID();
454470
}
455471
}

0 commit comments

Comments
 (0)