This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Add a test for user-defined objc_copyRealizedClassList_nolock
ClosedPublic

Authored by teemperor on Aug 9 2021, 11:58 AM.

Details

Summary

LLDB evaluates some utility expression to update the Objective-C class list that ends up
calling function such as free or objc_copyRealizedClassList_nolock. This adds a test that
just tries to define our own bogus version of objc_copyRealizedClassList_nolock. It just
tests that LLDB doesn't crash as we currently don't have a way to tell LLDB to look for
the function in a specific library.

Diff Detail

Event Timeline

teemperor requested review of this revision.Aug 9 2021, 11:58 AM
teemperor created this revision.
JDevlieghere added inline comments.Aug 9 2021, 1:42 PM
lldb/test/API/lang/objc/conflicting-class-list-function-from-user/main.m
22–23

The description says "we currently don't have a way to tell LLDB to look for
the function in a specific library", so what guarantees we call the right one? We check if the symbol exists in libobjc (and fallback to the realized class list struct if not), but there's nothing in the source code that could tell the expression evaluator where the symbol should come from.

teemperor added inline comments.Aug 9 2021, 2:09 PM
lldb/test/API/lang/objc/conflicting-class-list-function-from-user/main.m
22–23

Everything you're saying is right, that's why the test is XFAIL'd. The test is just testing that LLDB doesn't crash or anything like that. The "we currently don't have a way to tell LLDB to look for the function in a specific library" comment is just there to point out that this is the missing functionality to make this test actually pass.

JDevlieghere accepted this revision.Aug 9 2021, 3:53 PM

LGTM

lldb/test/API/lang/objc/conflicting-class-list-function-from-user/main.m
22–23

Ah, I missed that part, thanks for pointing that out! If we really wanted to, we could look up the symbol (which we already do to make sure it's available) and call it through that instead of relying on the expression parser, but that seems unlikely enough to happen.

This revision is now accepted and ready to land.Aug 9 2021, 3:53 PM
This revision was landed with ongoing or failed builds.Aug 10 2021, 5:55 AM
This revision was automatically updated to reflect the committed changes.