Author: Jason Molenda Date: 2022-12-05T15:11:43-08:00 New Revision: fe3103fa485f67b15efffd11d592a3341eb7bd57
URL: https://github.com/llvm/llvm-project/commit/fe3103fa485f67b15efffd11d592a3341eb7bd57 DIFF: https://github.com/llvm/llvm-project/commit/fe3103fa485f67b15efffd11d592a3341eb7bd57.diff LOG: Increase search for kernel image from 32MB to 128MB DynamicLoaderDarwinKernel::SearchForKernelNearPC() searches for a Darwin kernel mach-o header starting at $pc and working backwards, stopping on the first memory read error encountered. The kernel, and the kexts linked in to the kernel, have grown over the years and the original 32MB scan limit is giving a high chance of failing to find the kernel if we're in a random kext. In non-kernel environments, firmware and bare board typically, we will hit a memory read error on an unmapped page quickly so this doesn't add a lot of random memory read requests in those environments. We only check at one megabyte boundaries, so worst case this is 128 reads at the start of a gdb-remote connection. The check for a memory read error & stopping was a more recent addition (a few years ago), so I kept the scan region a bit small. Added: Modified: lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Removed: ################################################################################ diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index f1b30477b89c3..09dd94d9186d3 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -321,8 +321,8 @@ DynamicLoaderDarwinKernel::SearchForKernelNearPC(Process *process) { // Round the current pc down to the nearest page boundary. addr_t addr = pc & ~(pagesize - 1ULL); - // Search backwards for 32 megabytes, or first memory read error. - while (pc - addr < 32 * 0x100000) { + // Search backwards for 128 megabytes, or first memory read error. + while (pc - addr < 128 * 0x100000) { bool read_error; if (CheckForKernelImageAtAddress(addr, process, &read_error).IsValid()) return addr; _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits