[Lldb-commits] [lldb] a201ae3 - Handle the case where the ISA we find when looking up a method implementation has masked bits (#206864)

via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 1 10:59:48 PDT 2026


Author: jimingham
Date: 2026-07-01T10:59:44-07:00
New Revision: a201ae3addcef5580c1228c9b7c7538cfac690a3

URL: https://github.com/llvm/llvm-project/commit/a201ae3addcef5580c1228c9b7c7538cfac690a3
DIFF: https://github.com/llvm/llvm-project/commit/a201ae3addcef5580c1228c9b7c7538cfac690a3.diff

LOG: Handle the case where the ISA we find when looking up a method implementation has masked bits (#206864)

We need to canonicalize these since we look them up, and the PointerISA
is the right thing to use since it actually points at the class.

I can't write a test for this because ObjC mostly uses the masks for
swift/objc interop. I will add a test on the swift fork.

Added: 
    

Modified: 
    lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
    lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
    lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
index 0580d49920c47..78e8c1167828d 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
@@ -418,7 +418,7 @@ class AppleObjCRuntimeV2 : public AppleObjCRuntime {
 
   AppleObjCRuntimeV2(Process *process, const lldb::ModuleSP &objc_module_sp);
 
-  ObjCISA GetPointerISA(ObjCISA isa);
+  ObjCISA GetPointerISA(ObjCISA isa) override;
 
   lldb::addr_t GetISAHashTablePointer();
 

diff  --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
index 0de03894fdfea..9e0ebf2090b62 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
@@ -977,6 +977,10 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
       ObjCLanguageRuntime *objc_runtime =
           ObjCLanguageRuntime::Get(*thread.GetProcess());
       assert(objc_runtime != nullptr);
+      // We have the address in the ISA pointer of our object, but it might
+      // be a masked value, so we need to get the Pointer ISA:
+      isa_addr = objc_runtime->GetPointerISA(isa_addr);
+
       LLDB_LOG(log, "Resolving call for class - {0} and selector - {1}",
                isa_addr, sel_addr);
       impl_addr = objc_runtime->LookupInMethodCache(isa_addr, sel_addr);

diff  --git a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
index 4e8210c23e0d4..4552fe341ed99 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
@@ -307,6 +307,8 @@ class ObjCLanguageRuntime : public LanguageRuntime {
 
   virtual ObjCISA GetParentClass(ObjCISA isa);
 
+  virtual ObjCISA GetPointerISA(ObjCISA isa) { return isa; };
+
   // Finds the byte offset of the child_type ivar in parent_type.  If it can't
   // find the offset, returns LLDB_INVALID_IVAR_OFFSET.
 


        


More information about the lldb-commits mailing list