This is an archive of the discontinued LLVM Phabricator instance.

[lldb][Android] Fix adb shell cat
AbandonedPublic

Authored by splhack on Jun 8 2023, 9:49 PM.

Details

Summary

When LLDB failed to pull a module file due to the security constraint,
it uses "adb shell cat" as a fallback for getting the file.
However when "adb pull path" fails, "adb shell cat path" also fails
with the same security reason.

Introduce ANDROID_PLATFORM_RUN_AS to grant permission to read the file
with "adb shell run-as package cat path" command line.
https://android.googlesource.com/platform/system/core.git/+/refs/heads/master/run-as/run-as.cpp#39

Diff Detail

Event Timeline

splhack created this revision.Jun 8 2023, 9:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2023, 9:49 PM
Herald added a subscriber: danielkiss. · View Herald Transcript
splhack edited the summary of this revision. (Show Details)Jun 8 2023, 9:49 PM
splhack published this revision for review.Jun 8 2023, 9:57 PM
splhack added reviewers: labath, lanza.
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2023, 9:58 PM
lanza accepted this revision.Jun 12 2023, 12:52 PM

LGTM

This revision is now accepted and ready to land.Jun 12 2023, 12:52 PM

An environment variable isn't the worst thing in the world, but what would be better is an lldb setting so we can change it at runtime instead of needing to restart the debugging session. That may happen if you make a typo or make a mistake. Something like plugin.platform.android.platform-run-as.

splhack abandoned this revision.Jun 14 2023, 9:21 AM

@bulbazord thanks for the suggestion! property works well. D152933 supersedes this.