This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Print an error message when we're reading libobjc.A.dylib from memory
ClosedPublic

Authored by JDevlieghere on Jan 18 2022, 4:05 PM.

Details

Summary

Use libobjc.A.dylib as a sentinel to detect situations where we're reading libraries from memory instead of the shared cache.

Diff Detail

Event Timeline

JDevlieghere requested review of this revision.Jan 18 2022, 4:05 PM
JDevlieghere created this revision.
JDevlieghere added inline comments.
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
2361–2362

Let's bikeshed about the wording!

Unbotch the patch

aprantl added inline comments.Jan 18 2022, 4:25 PM
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
2377

Here's my take:

libobjc.A.dylib is being read from process memory. This indicates that LLDB could not find the the on-disk %s shared cache for this device. This will likely reduce debugging performance.
aprantl accepted this revision.Jan 18 2022, 4:26 PM
This revision is now accepted and ready to land.Jan 18 2022, 4:26 PM

Update warning message

aprantl added inline comments.Jan 18 2022, 4:50 PM
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
2379

I would replace we with LLDB. Users might see this in their IDE's console and not even know who we is.

jingham added inline comments.Jan 18 2022, 5:06 PM
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
2359

Why is this code #ifdef APPLE?

If you were debugging from a Linux machine to a macOS system, wouldn't you also want to at least see the warning so you would know why their session was slow?

JDevlieghere added inline comments.Jan 18 2022, 5:07 PM
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
2379

Good point!

JDevlieghere marked an inline comment as done.Jan 18 2022, 5:09 PM
JDevlieghere added inline comments.
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
2359

My reasoning was that the error wouldn't be actionable so I'd rather not show it all. I don't feel strongly about it though.

jingham added inline comments.Jan 18 2022, 5:13 PM
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
2359

It would save people wasting time to try to figure out why this seemed slow, which is worth something on its own. And the Linux user could expand the cache on the Mac, copy it over and lldb should be able to use it - with "target modules add" by hand if nothing more automatic works.

JDevlieghere marked 4 inline comments as done.Jan 18 2022, 5:23 PM
JDevlieghere added inline comments.
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
2359

Fair enough!

Herald added a project: Restricted Project. · View Herald TranscriptJan 18 2022, 5:23 PM