[Lldb-commits] [lldb] [lldb] Don't warn that libobjc was read from memory in corefile (PR #127138)

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 13 14:35:25 PST 2025


https://github.com/jasonmolenda created https://github.com/llvm/llvm-project/pull/127138

AppleObjCRuntimeV2 prints a warning when we read libobjc.A.dylib from memory, as a canary to detect that we are reading system binaries out of memory (which is slow, and we try hard to avoid). But with a corefile, reading out of "memory" is fine, and may be the only way we can find the correct binary.

rdar://144322688

>From 3d2befdb4dc42e08e50865faca4d2ef4ab94a300 Mon Sep 17 00:00:00 2001
From: Jason Molenda <jmolenda at apple.com>
Date: Thu, 13 Feb 2025 14:30:48 -0800
Subject: [PATCH] [lldb] Don't warn that libobjc was read from memory in
 corefile

AppleObjCRuntimeV2 prints a warning when we read libobjc.A.dylib
from memory, as a canary to detect that we are reading system
binaries out of memory (which is slow, and we try hard to avoid).
But with a corefile, reading out of "memory" is fine, and may be
the only way we can find the correct binary.

rdar://144322688
---
 .../ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp               | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index a57099f3df454..ff17028e6662a 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -2666,6 +2666,9 @@ void AppleObjCRuntimeV2::WarnIfNoExpandedSharedCache() {
   if (!object_file->IsInMemory())
     return;
 
+  if (!GetProcess()->IsLiveDebugSession())
+    return;
+
   Target &target = GetProcess()->GetTarget();
   Debugger &debugger = target.GetDebugger();
 



More information about the lldb-commits mailing list