[Lldb-commits] [PATCH] D158205: [lldb] Fix performance regression after adding GNUstep ObjC runtime
Stefan Gränitz via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Aug 18 04:59:11 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGaf2eb838309d: [lldb] Fix performance regression after adding GNUstep ObjC runtime (authored by sgraenitz).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158205/new/
https://reviews.llvm.org/D158205
Files:
lldb/source/Plugins/LanguageRuntime/ObjC/GNUstepObjCRuntime/GNUstepObjCRuntime.cpp
Index: lldb/source/Plugins/LanguageRuntime/ObjC/GNUstepObjCRuntime/GNUstepObjCRuntime.cpp
===================================================================
--- lldb/source/Plugins/LanguageRuntime/ObjC/GNUstepObjCRuntime/GNUstepObjCRuntime.cpp
+++ lldb/source/Plugins/LanguageRuntime/ObjC/GNUstepObjCRuntime/GNUstepObjCRuntime.cpp
@@ -37,6 +37,33 @@
PluginManager::UnregisterPlugin(CreateInstance);
}
+static bool CanModuleBeGNUstepObjCLibrary(const ModuleSP &module_sp,
+ const llvm::Triple &TT) {
+ if (!module_sp)
+ return false;
+ const FileSpec &module_file_spec = module_sp->GetFileSpec();
+ if (!module_file_spec)
+ return false;
+ llvm::StringRef filename = module_file_spec.GetFilename().GetStringRef();
+ if (TT.isOSBinFormatELF())
+ return filename.starts_with("libobjc.so");
+ if (TT.isOSWindows())
+ return filename == "objc.dll";
+ return false;
+}
+
+static bool ScanForGNUstepObjCLibraryCandidate(const ModuleList &modules,
+ const llvm::Triple &TT) {
+ std::lock_guard<std::recursive_mutex> guard(modules.GetMutex());
+ size_t num_modules = modules.GetSize();
+ for (size_t i = 0; i < num_modules; i++) {
+ auto mod = modules.GetModuleAtIndex(i);
+ if (CanModuleBeGNUstepObjCLibrary(mod, TT))
+ return true;
+ }
+ return false;
+}
+
LanguageRuntime *GNUstepObjCRuntime::CreateInstance(Process *process,
LanguageType language) {
if (language != eLanguageTypeObjC)
@@ -50,6 +77,9 @@
return nullptr;
const ModuleList &images = target.GetImages();
+ if (!ScanForGNUstepObjCLibraryCandidate(images, TT))
+ return nullptr;
+
if (TT.isOSBinFormatELF()) {
SymbolContextList eh_pers;
RegularExpression regex("__gnustep_objc[x]*_personality_v[0-9]+");
@@ -176,18 +206,8 @@
}
bool GNUstepObjCRuntime::IsModuleObjCLibrary(const ModuleSP &module_sp) {
- if (!module_sp)
- return false;
- const FileSpec &module_file_spec = module_sp->GetFileSpec();
- if (!module_file_spec)
- return false;
- llvm::StringRef filename = module_file_spec.GetFilename().GetStringRef();
const llvm::Triple &TT = GetTargetRef().GetArchitecture().GetTriple();
- if (TT.isOSBinFormatELF())
- return filename.starts_with("libobjc.so");
- if (TT.isOSWindows())
- return filename == "objc.dll";
- return false;
+ return CanModuleBeGNUstepObjCLibrary(module_sp, TT);
}
bool GNUstepObjCRuntime::ReadObjCLibrary(const ModuleSP &module_sp) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158205.551465.patch
Type: text/x-patch
Size: 2559 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230818/5c678193/attachment-0001.bin>
More information about the lldb-commits
mailing list