summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2013-03-02 07:19:32 +0000
committerJason Molenda <jmolenda@apple.com>2013-03-02 07:19:32 +0000
commit503d018111155a7ac2a64fb84e2d9be6461b940f (patch)
tree40d302ba24292d9a9260dd41e426502c24dcf73d /lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
parentfe7a3486149938e043e615926de40516ab05ff60 (diff)
downloadbcm5719-llvm-503d018111155a7ac2a64fb84e2d9be6461b940f.tar.gz
bcm5719-llvm-503d018111155a7ac2a64fb84e2d9be6461b940f.zip
ProcessMachCore had (until 2013-01-29) some simple checks to find a kernel
in a core file if it didn't start at the beginning of a memory segment. I added more sophisticated kernel location code to DynamicLoaderDarwinKernel and removed the simple one in ProcessMachCore. Unfortunately the kernel DynamicLoader doesn't get a chance to search around in memory unless there's a hint that this might be a kernel debug session. It was easy ot make the kernel location code static in DynamicLoaderDarwinKernel and call it from ProcessMachCore on the start of the session, so that's what I did. <rdar://problem/13326647> llvm-svn: 176405
Diffstat (limited to 'lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp')
-rw-r--r--lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
index afa81cb66d8..2e865c1847b 100644
--- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -177,6 +177,18 @@ DynamicLoaderDarwinKernel::CreateInstance (Process* process, bool force)
// At this point if there is an ExecutableModule, it is a kernel and the Target is some variant of an Apple system.
// If the Process hasn't provided the kernel load address, we need to look around in memory to find it.
+ addr_t kernel_load_address = SearchForDarwinKernel (process);
+ if (kernel_load_address != LLDB_INVALID_ADDRESS)
+ {
+ process->SetCanJIT(false);
+ return new DynamicLoaderDarwinKernel (process, kernel_load_address);
+ }
+ return NULL;
+}
+
+lldb::addr_t
+DynamicLoaderDarwinKernel::SearchForDarwinKernel (Process *process)
+{
addr_t kernel_load_address = process->GetImageInfoAddress();
if (kernel_load_address == LLDB_INVALID_ADDRESS)
{
@@ -194,13 +206,7 @@ DynamicLoaderDarwinKernel::CreateInstance (Process* process, bool force)
}
}
}
-
- if (kernel_load_address != LLDB_INVALID_ADDRESS)
- {
- process->SetCanJIT(false);
- return new DynamicLoaderDarwinKernel (process, kernel_load_address);
- }
- return NULL;
+ return kernel_load_address;
}
//----------------------------------------------------------------------
OpenPOWER on IntegriCloud