This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Adjust for changes in objc runtime
ClosedPublic

Authored by bulbazord on Jun 22 2023, 4:42 PM.

Details

Summary

The Objective-C runtime and the shared cache has changed slightly.
Given a class_ro_t, the baseMethods ivar is now a pointer union and may
either be a method_list_t pointer or a pointer to a relative list of
lists. The entries of this relative list of lists are indexes that refer
to a specific image in the shared cache in addition to a pointer offset
to find the accompanying method_list_t. We have to go over each of these
entries, parse it, and then if the relevant image is loaded in the
process, we add those methods to the relevant clang Decl.

In order to determine if an image is loaded, the Objective-C runtime
exposes a symbol that lets us determine if a particular image is loaded.
We maintain a data structure SharedCacheImageHeaders to keep track of
that information.

There is a known issue where if an image is loaded after we create a
Decl for a class, the Decl will not have the relevant methods from that
image (i.e. for Categories).

rdar://107957209

Diff Detail

Event Timeline

bulbazord created this revision.Jun 22 2023, 4:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2023, 4:42 PM
bulbazord requested review of this revision.Jun 22 2023, 4:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2023, 4:42 PM
JDevlieghere accepted this revision.Jun 22 2023, 4:48 PM

LGTM. This has been previously reviewed internally.

This revision is now accepted and ready to land.Jun 22 2023, 4:48 PM
This revision was automatically updated to reflect the committed changes.