This is an archive of the discontinued LLVM Phabricator instance.

Change oat symbolization code for android to work on non-rooted devices
ClosedPublic

Authored by tberghammer on Sep 25 2015, 5:31 AM.

Details

Summary

Change oat symbolization code for android to work on non-rooted devices

On android when debugging an apk we run lldb-server as application user
because the sell user (on non-rooted device) can't attach to an
application. The problem is that "adb pull" will run as a shell user
what can't access to files created by lldb-server because they will be
owned by the application user. This CL changes the oat symbolization
code to run "oatdump --symbolize" to generate an output what is owned
by the shell user.

Diff Detail

Repository
rL LLVM

Event Timeline

tberghammer retitled this revision from to Change oat symbolization code for android to work on non-rooted devices.
tberghammer updated this object.
tberghammer added a reviewer: ovyalov.
tberghammer added a subscriber: lldb-commits.
ovyalov accepted this revision.Sep 25 2015, 2:13 PM
ovyalov edited edge metadata.

Minor comments

source/Plugins/Platform/Android/AdbClient.cpp
231 ↗(On Diff #35716)

Could you add checks for error and that n > 0?

source/Plugins/Platform/Android/PlatformAndroid.cpp
340 ↗(On Diff #35716)

Could you reuse adb variable defined before - e.g., wrap with shared_ptr?

361 ↗(On Diff #35716)

s/&output/nullptr ?

This revision is now accepted and ready to land.Sep 25 2015, 2:13 PM
tberghammer marked 3 inline comments as done.Sep 29 2015, 3:59 AM
tberghammer added inline comments.
source/Plugins/Platform/Android/PlatformAndroid.cpp
340 ↗(On Diff #35716)

Fixed with capturing adb from the parent scope by reference. The destructor of the unique_ptr will be called earlier then the destructor of the AdbClient so no need for a shared_ptr

This revision was automatically updated to reflect the committed changes.
tberghammer marked an inline comment as done.
ovyalov added inline comments.Sep 29 2015, 4:49 PM
source/Plugins/Platform/Android/PlatformAndroid.cpp
341 ↗(On Diff #35716)

I tried this CL on my device and it's failing to download a symbol file - "Failed to pull file: No such file or directory". As I can see tmpdir isn't fully cleared from tail symbols, like \r\n

I haven't managed to reproduce the issue you reported (what OS and Android
version do you use?), but based on the description this change (not
committed in yet) might fix the issue: http://reviews.llvm.org/D13293. Can
you take a look?

Thanks,
Tamas

I tried Nexus 5 and 6P with Android M. Thanks for the new patch - it's fixing the problem.