Commit b7f796b8 authored by Josh Gao's avatar Josh Gao
Browse files

[ndk-gdb.py] Copy gdbserver to app directory on M+.

Bug: http://b/23791565
Change-Id: I5312a1813bb7c9cbb601f7fc2bd039c25b6cdc4f
parent 1c64a081
......@@ -706,6 +706,20 @@ The target device is running API level %d!''' % (API_LEVEL))
if retcode:
error('Could not copy prebuilt gdbserver to the device')
if API_LEVEL >= 23:
# Copy gdbserver to the data directory since selinux prevents
# executing binaries in /data/local/tmp on M+, and we can't
# copy directly into the data directory because of permissions.
#
# Don't do this pre-M to avoid a ~100ms adb shell roundtrip.
temp_gdbserver = device_gdbserver
device_gdbserver = '%s/gdbserver' % (DATA_DIR)
args = ['cat', temp_gdbserver, '|', 'run-as', PACKAGE_NAME,
'sh', '-c', "'cat > %s'" % device_gdbserver]
retcode, _ = adb_var_shell2(args)
if retcode:
error('Failed to copy gdbserver to application directory')
# Check if gdbserver is runnable by the application user
retcode, _ = adb_var_shell2(['run-as', PACKAGE_NAME,
device_gdbserver, '--version'])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment