diff options
Diffstat (limited to 'lldb/source/Plugins')
3 files changed, 24 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; } //---------------------------------------------------------------------- diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h index d3d36620c9a..d65622cff03 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h @@ -52,6 +52,9 @@ public: DynamicLoaderDarwinKernel (lldb_private::Process *process, lldb::addr_t kernel_addr); + static lldb::addr_t + SearchForDarwinKernel (lldb_private::Process *process); + virtual ~DynamicLoaderDarwinKernel (); diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp index 66f5081fc80..0e19ebe7afd 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -299,6 +299,14 @@ ProcessMachCore::DoLoadCore () if (arch.IsValid()) m_target.SetArchitecture(arch); + if (m_dyld_addr == LLDB_INVALID_ADDRESS) + { + addr_t kernel_load_address = DynamicLoaderDarwinKernel::SearchForDarwinKernel (this); + if (kernel_load_address != LLDB_INVALID_ADDRESS) + { + GetDynamicLoaderAddress (kernel_load_address); + } + } return error; } |

