Without this, "lldbclient.py -r ls --help" fails, because the lldb/gdb
server handles the "--help" argument rather than passing it through to
the program being started.
Test: lldbclient.py --lldb -r /system/bin/ls --help
Test: gdbclient.py --no-lldb -r /system/bin/ls --help
Change-Id: I76c7e73b535125ea96f5435bbfe99099786956c1
1. Sets up source mapping so that people can run from other directories.
2. Removes PYTHONHOME. It is embedded into the binary.
Change-Id: Ic7a7f1483dc645d890b7e0f3dcbb0ebb169794ac
gdb looks for an executable's dynamic linker using the PT_INTERP setting
from the executable. That value can be various things:
- /system/bin/linker[64]
- /system/bin/linker_asan[64]
- /system/bin/bootstrap/linker[64]
Currently, only the bootstrap linker is available in the sysroot/symbols
directory. The ordinary and ASAN linkers are symlinks on the target and
are missing from the sysroot (aka symbols) directory.
Use the executable's PT_INTERP value to find the symbolized linker binary
and add it to the solib search path. If necessary, copy or pull a linker
binary.
Test: gdbclient.py -r ls
"info sharedlib" shows $OUT/symbols/apex/com.android.runtime.debug/bin/linker64
Test: gdbclient.py -r /data/nativetest64/bionic-unit-tests/bionic-unit-tests
"info sharedlib" shows $OUT/symbols/system/bin/bootstrap/linker64
Test: m asan_test
gdbclient.py -r /data/nativetest64/asan_test/asan_test
"info sharedlib" shows /tmp/gdbclient-linker-HunVs9/linker_asan64
Bug: http://b/134183407
Change-Id: I7f79943dcd9ec762d1aaf21178bb6ab3eff40617
This test actually belongs with the adb python wrapper, since it's not
affected by changes to adb itself.
Bug: http://b/64260633
Test: python test.py
Change-Id: Ia70a5529e30d91ea6232c65c9d50b2dabd07b925
The gdbrunner script executes "ps" to list all running processes and
this needs to be changed to "ps -A" (toybox) for Android O instead of
"ps -w" (busybox) for custom ROMs or "ps" (toolbox) as default.
Test: manual
Change-Id: I99606cdf51b124369e4d0fcfe5917109cefe408c
gdbclient.py -r allows to provide an executable to be run on the target.
Before this patch the absolute path of the executable had to be
provided. This was inconvenient as the user has to first look up for the
exe on the target before debuging it.
With this patch, gdbclient.py will look for the executable on the
target if an absolute path is not provided.
Test: gdbserver -r ls
Change-Id: I610fd0a57b034ba8864874eeb1f7345d4a7daad9
Signed-off-by: Kevin Rocard <krocard@google.com>
Rename it from `user` to `run_as_cmd` to match the use of this method
in handle_switches in scripts/gdbclient.py.
Test: Run scripts/gdbclient.py -p <PID> on suspended process having pid <PID>
Change-Id: I9820858b1f43d5cb25a9a59e9df618ed4e47f3f0
Switch from assuming that "root" meant su to an explicit prepended
argument, to allow things like `gdbclient.py --user shell`.
Test: gdbclient.py --user shell -r /system/bin/ls
Change-Id: I9d02eea7c6d79898ed8b13817e009630b0f9536a
Not sure exactly why this happens, but it keeps cropping up on my JB
nakasi when running the NDK tests.
Change-Id: Ic5c35f9ab01c0a83f98a6d074220c89ec765a812
Previously, to pass a subprocess cmdline args with Unicode characters,
we'd write the command line to a batch file and run it with cmd.exe. The
problem was that the batch file used chcp to get cmd.exe to be able to
read UTF-8 from the batch file, but this had the side-effect of changing
the codepage of the user's console window.
Instead of saving & restoring the codepage (which would always have the
risk of somehow leaving the console in the wrong codepage if a Ctrl-C
handler somehow wasn't called, or if Task Manager was used manually,
etc.), we use Windows PowerShell as the helper instead of cmd.exe.
PowerShell is installed on every version of Windows since Windows 7 and
is a separate free download for Windows XP and Windows Vista, but
realistically Windows XP is no longer supported by Microsoft and
probably no one chooses to run Windows Vista over Windows 7. Plus, this
change only uses PowerShell if Unicode args are passed.
Switching to PowerShell allows us to get rid of the temp file, context
manager, and messy __del__ that caused a variety of problems in the
past.
Change-Id: Ia3df533f7747f7b9b28a093f8ca24117371e5e59
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
After pushing to a Unicode path, use 'adb shell ls' to verify that the
path was created with the right name. This verifies that the UTF-16 to
UTF-8 conversion is done properly.
When pulling to a Unicode path, verify that the local file has been
created with the expected name. This should test UTF-16 to UTF-8
(command line to internal data structures) and UTF-8 to UTF-16 (internal
data structures to CreateFileW()).
Change-Id: I8b80aae731cf0d058cb0c3259e7f58256e86b771
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
The device.py module was incorrectly querying the return code when the
shell_v2 return code isn't available.
This CL fixes it by specifying the return code probe as an argument
list rather than a single string argument. This means that before the
device was executing something like this:
/system/bin/sh getprop '; echo $?'
which didn't do what we wanted. Now it does something like this:
/system/bin/sh getprop ; echo $?
Bug: http://b/25470461
Change-Id: I5e20da31ec7ecc782c6146d8b38d752d52082860