jasonmolenda created this revision. jasonmolenda added a project: LLDB. Herald added a subscriber: JDevlieghere. Herald added a project: All. jasonmolenda requested review of this revision. Herald added a subscriber: lldb-commits.
ModuleList::GetSharedModule will call in to the DebugSymbols framework and may be able to find a file on the local system by Spotlight search, or by using the Platform's override of GetSharedModule, and may be faster than calling Symbols::DownloadObjectAndSymbolFile which calls out to an external program and is likely to do a network filesystem or download of the binary/symbol file. A small perf improvement, NFC. This is very much jason code, not really looking for a review of this one. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D157165 Files: lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Index: lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp =================================================================== --- lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -763,20 +763,6 @@ module_spec.GetUUID() = m_uuid; module_spec.GetArchitecture() = target.GetArchitecture(); - // For the kernel, we really do need an on-disk file copy of the binary - // to do anything useful. This will force a call to dsymForUUID if it - // exists, instead of depending on the DebugSymbols preferences being - // set. - if (IsKernel()) { - Status error; - if (Symbols::DownloadObjectAndSymbolFile(module_spec, error, true)) { - if (FileSystem::Instance().Exists(module_spec.GetFileSpec())) { - m_module_sp = std::make_shared<Module>(module_spec.GetFileSpec(), - target.GetArchitecture()); - } - } - } - // If the current platform is PlatformDarwinKernel, create a ModuleSpec // with the filename set to be the bundle ID for this kext, e.g. // "com.apple.filesystems.msdosfs", and ask the platform to find it. @@ -806,6 +792,22 @@ m_module_sp = target.GetOrCreateModule(module_spec, true /* notify */); } + // For the kernel, we really do need an on-disk file copy of the binary + // to do anything useful. This will force a call to dsymForUUID if it + // exists, instead of depending on the DebugSymbols preferences being + // set. + Status kernel_search_error; + if (IsKernel() && + (!m_module_sp || !m_module_sp->GetSymbolFileFileSpec())) { + if (Symbols::DownloadObjectAndSymbolFile(module_spec, + kernel_search_error, true)) { + if (FileSystem::Instance().Exists(module_spec.GetFileSpec())) { + m_module_sp = std::make_shared<Module>(module_spec.GetFileSpec(), + target.GetArchitecture()); + } + } + } + if (IsKernel() && !m_module_sp) { Stream &s = target.GetDebugger().GetOutputStream(); s.Printf("WARNING: Unable to locate kernel binary on the debugger "
Index: lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp =================================================================== --- lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -763,20 +763,6 @@ module_spec.GetUUID() = m_uuid; module_spec.GetArchitecture() = target.GetArchitecture(); - // For the kernel, we really do need an on-disk file copy of the binary - // to do anything useful. This will force a call to dsymForUUID if it - // exists, instead of depending on the DebugSymbols preferences being - // set. - if (IsKernel()) { - Status error; - if (Symbols::DownloadObjectAndSymbolFile(module_spec, error, true)) { - if (FileSystem::Instance().Exists(module_spec.GetFileSpec())) { - m_module_sp = std::make_shared<Module>(module_spec.GetFileSpec(), - target.GetArchitecture()); - } - } - } - // If the current platform is PlatformDarwinKernel, create a ModuleSpec // with the filename set to be the bundle ID for this kext, e.g. // "com.apple.filesystems.msdosfs", and ask the platform to find it. @@ -806,6 +792,22 @@ m_module_sp = target.GetOrCreateModule(module_spec, true /* notify */); } + // For the kernel, we really do need an on-disk file copy of the binary + // to do anything useful. This will force a call to dsymForUUID if it + // exists, instead of depending on the DebugSymbols preferences being + // set. + Status kernel_search_error; + if (IsKernel() && + (!m_module_sp || !m_module_sp->GetSymbolFileFileSpec())) { + if (Symbols::DownloadObjectAndSymbolFile(module_spec, + kernel_search_error, true)) { + if (FileSystem::Instance().Exists(module_spec.GetFileSpec())) { + m_module_sp = std::make_shared<Module>(module_spec.GetFileSpec(), + target.GetArchitecture()); + } + } + } + if (IsKernel() && !m_module_sp) { Stream &s = target.GetDebugger().GetOutputStream(); s.Printf("WARNING: Unable to locate kernel binary on the debugger "
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits