Page MenuHomePhabricator

Use basename of main executable in POSIX-DYLD on Android.
ClosedPublic

Authored by sas on Jan 26 2015, 1:03 PM.

Details

Summary

The Android dynamic linker reports only the basename of each SO entry, so for
the above check to be successful, we need to compare it to the basename of the
main executable.

This also has a nasty side-effect when working with older version of
Android (verified on platform version 16), and debugging PIE
executables: the dynamic linker has a bug and reports the load address
of the main executable (which is a shared object, because PIE) to be 0.
We then try to update the list of loaded sections for all shared
objects, including the main executable, and set the load address to 0,
which breaks everything that relies on resolving addresses in the main
executable (breakpoints, stepping, etc). This commit also fixes that broken
behavior when debugging on older Androids. This bug doesn't happen on newer
Android versions (verified for Android L).

Diff Detail

Repository
rL LLVM

Event Timeline

sas updated this revision to Diff 18785.Jan 26 2015, 1:03 PM
sas retitled this revision from to Use basename of main executable in POSIX-DYLD on Android..
sas updated this object.
sas edited the test plan for this revision. (Show Details)
sas added reviewers: clayborg, tfiala, richard.mitton.
sas added a subscriber: Unknown Object (MLST).
clayborg accepted this revision.Jan 26 2015, 2:05 PM
clayborg edited edge metadata.

lgtm

This revision is now accepted and ready to land.Jan 26 2015, 2:05 PM
This revision was automatically updated to reflect the committed changes.