JDevlieghere created this revision.
JDevlieghere added reviewers: aprantl, jingham.
JDevlieghere requested review of this revision.
Use libobjc.A.dylib as a sentinel to detect situations where we're reading
libraries from memory instead of the shared cache.
https://reviews.llvm.org/D117623
Files:
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
Index:
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
===================================================================
---
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -2356,24 +2356,29 @@
}
void AppleObjCRuntimeV2::WarnIfNoExpandedSharedCache() {
- printf("We are checking to warn\n");
+#ifdef __APPLE__
if (!m_objc_module_sp)
return;
- printf("We have a module\n");
ObjectFile* object_file = m_objc_module_sp->GetObjectFile();
if (!object_file)
return;
- printf("We have an object file\n");
if (!object_file->IsInMemory())
return;
- printf("We are not in memory\n");
- Debugger &debugger = GetProcess()->GetTarget().GetDebugger();
+ Target &target = GetProcess()->GetTarget();
+ Debugger &debugger = target.GetDebugger();
if (auto stream = debugger.GetAsyncOutputStream()) {
- stream->PutCString("warning: no expanded shared cache?\n");
+ const char *shared_cache_type = "";
+ if (PlatformSP platform_sp = target.GetPlatform())
+ shared_cache_type = platform_sp->IsHost() ? "host " : "expanded ";
+ stream->Printf(
+ "warning: libobjc.A.dylib is being read from memory instead of the %s"
+ "shared cache. This will likely reduce performance.\n",
+ shared_cache_type);
}
+#endif
}
DeclVendor *AppleObjCRuntimeV2::GetDeclVendor() {
Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
===================================================================
--- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -2356,24 +2356,29 @@
}
void AppleObjCRuntimeV2::WarnIfNoExpandedSharedCache() {
- printf("We are checking to warn\n");
+#ifdef __APPLE__
if (!m_objc_module_sp)
return;
- printf("We have a module\n");
ObjectFile* object_file = m_objc_module_sp->GetObjectFile();
if (!object_file)
return;
- printf("We have an object file\n");
if (!object_file->IsInMemory())
return;
- printf("We are not in memory\n");
- Debugger &debugger = GetProcess()->GetTarget().GetDebugger();
+ Target &target = GetProcess()->GetTarget();
+ Debugger &debugger = target.GetDebugger();
if (auto stream = debugger.GetAsyncOutputStream()) {
- stream->PutCString("warning: no expanded shared cache?\n");
+ const char *shared_cache_type = "";
+ if (PlatformSP platform_sp = target.GetPlatform())
+ shared_cache_type = platform_sp->IsHost() ? "host " : "expanded ";
+ stream->Printf(
+ "warning: libobjc.A.dylib is being read from memory instead of the %s"
+ "shared cache. This will likely reduce performance.\n",
+ shared_cache_type);
}
+#endif
}
DeclVendor *AppleObjCRuntimeV2::GetDeclVendor() {
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits