This is an archive of the discontinued LLVM Phabricator instance.

[lldb][LocateModuleCallback] Call locate module callback in Platform too
ClosedPublic

Authored by splhack on Jul 23 2023, 2:08 PM.

Details

Summary

This is an enhancement for the locate module callback.
https://discourse.llvm.org/t/rfc-python-callback-for-target-get-module/71580/6

On Android remote platform, module UUID is resolved by
Platform::GetRemoteSharedModule. Which means the current
Target::CallLocateModuleCallbackIfSet() call undesirably is not able to pass the
module UUID to the locate module callback.

This diff moves the CallLocateModuleCallbackIfSet() implementation from Target
to Platform to allows both Target and Platform can call it. One is from the
current Target call site, and second is from Platform after resolving the module
UUID.

As the result of this change, the locate module callback may be called twice
for a same module on remote platforms. And it should be ok.

  • First, without UUID.
    • The locate module callback is able to return a module and/or a symbol if the callback is able to do so without UUID.
    • The locate module callback is allowed to return an error if the callback requires UUID.
  • Second, with UUID, if the first callback call did not return a module.

Diff Detail

Event Timeline

splhack created this revision.Jul 23 2023, 2:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 23 2023, 2:08 PM
splhack requested review of this revision.Jul 23 2023, 2:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 23 2023, 2:08 PM
splhack updated this revision to Diff 543329.Jul 23 2023, 2:14 PM

Remove wrong comment

splhack edited the summary of this revision. (Show Details)Jul 24 2023, 5:02 PM
clayborg accepted this revision.Jul 25 2023, 10:04 AM

lgtm! I like this being in platform better

This revision is now accepted and ready to land.Jul 25 2023, 10:04 AM