Right now the raised exception only shows the command and return code.
Printing the output should make the error more clear.
Test: adb root, then in adb shell touch the server and make immutable
touch /data/local/tmp/x86_64-lldb-server
chattr +i /data/local/tmp/x86_64-lldb-server
Then on host lldbclient.py -r test
Fails as expected with with "operation not permitted"
Change-Id: Ie22f41bb90809c2f9bafaee0be6a151d9b017502
The new argument allows the user to pass a JSON of properties to merge
into the generated launch.json config when setting up vscode-lldb
forwarding. This way the user can add pre-build tasks, extra init
commands etc.
Test: atest gdbclient_test
Test: lldbclient.py --setup-forwarding=vscode-lldb
--vscode-launch-props='{"sourceMap": {"test1": "test2"},
"postDebugTask": "Stop LLDB client", "processCreateCommands" :
["test"]}' -r test
Change-Id: I763dd15dde10421e86bc0a6ddfde974156ef1588
Though there are no type hints here, exporting this file will at least
suppress errors from importers and will allow mypy to infer the things
it can.
Bug: None
Test: mypy gdbrunner
Test: mypy ndkgdb.py # in the NDK
Change-Id: Idf4b7fc646b53e10f36900d09ea98feaa64fd794
The normal python package structure and setuptools package are required
for py.typed to be seen by importers, which is needed for callers to
type check use of gdbrunner.
Bug: None
Test: ndk-gdb --help && gdbclient --help
Change-Id: I9a6d65595f9572275e31f08b3678c300a78275d5
We keep duplicating this function all over the place. Factor it out
and modernize it.
Test: all the test commands named in the readme
Bug: None
Change-Id: I8d90a9c101b9cf83d62d02141f40c6c3666bdf94
Apparently these tests are used, they are just defined in
//packages/modules/adb, so atest can't find them here.
Bug: http://b/265846006
Test: ran adb_integration_test_device
Change-Id: If1d82280ab51e80497d235f55582688b78c00f5b
Python is picky about directory structure. Ever since python 3 the tests
have not been able to run because the import won't work. This fixes that
problem.
Bug: None
Test: None
Change-Id: I4a626f130e4ca3cd2c9b69804083dfe6daffb5f7
This code hasn't worked since the python 3 switch, because `unicode`
doesn't exist any more. The problems that this code worked around were
all python 2 problems as well, so it's no longer needed.
Bug: None
Test: ran test.py on windows and mac
Change-Id: Ifacaed5cddc6c9ee9d9d9872c2f2851150ace468
mypy still complains about a few things here, but that looks to be
mostly coming from code that is very, very dead in python 3.
The tests don't run, and haven't since the python 3 switch. Will try to
revive those next, but it likely requires moving files around to fix the
package structure (source needs to go in a subdirectory to make a real
package, as do the tests).
Bug: None
Test: mypy . && pylint .
Change-Id: Ide55a41babecbd6684b73787b17e7f5fdb81c090
Because 'adb push' often misses the executable permission, lldbserver
can fail without any meaningful error messages. This may happen when the
users are on Windows. To fix that, explicitly chmod remote lldbserver
after push.
Bug: 185210505
Test: manual
Change-Id: I88defd4905a9b902424ae8ef4b38a16932b31f02
Push specific licenses down the tree toward the leaf directories.
Remove extra Apache 2.0 license texts--just use Android-Apache-2.0
Test: m nothing
Change-Id: Ibee25f75f5933699d6f43acdc192b2ada6823757
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