[Lldb-commits] [PATCH] D136465: Make remote-android local ports configurable
Luka Markušić via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Oct 24 22:42:21 PDT 2022
mark2185 added a comment.
In D136465#3880809 <https://reviews.llvm.org/D136465#3880809>, @clayborg wrote:
> Is there any way to test this?
Through the test suite? I couldn't find //any// `android platform` related tests, and this would require `adb` to be running in the background, so I'm not sure how to approach it.
As for manually testing, three shells are needed (one for `lldb-server`, one for `lldb`, and one to check the ports).
(shell-1) $> adb push /path/to/correct/cpu/arch/lldb-server /data/local/tmp # (android studio comes with prebuilt servers)
(shell-1) $> adb shell /data/local/tmp/lldb-server platform --listen "*:5555"
(shell-2) $> ANDROID_PLATFORM_LOCAL_PORT=8888 lldb
(lldb) $> platform select remote-android
(lldb) $> platform connect connect://localhost:5555
(shell-3) $> adb forward --list
<phone-serial-ID> tcp:8888 tcp:5555
If one were to omit the `ANDROID_PLATFORM_LOCAL_PORT` variable, the forwarded port will be random.
As for testing the `ANDROID_PLATFORM_LOCAL_GDB_PORT`, one would need to:
- install an app on the device
- run the `lldb-server` as that app ( `adb shell run-as com.full.package.App ./lldb-server platform...` ) so it can attach to its `PID`
- after `platform connect` run `attach <PID>`
- `adb forward --list` will now show two forwarded ports
- the `ANDROID_PLATFORM_LOCAL_PORT` from before
- the `ANDROID_PLATFORM_LOCAL_GDB_PORT`, forwarded to some port on the device (that destination port is also random, unless `lldb-server` is started with the `--gdbserver-port` argument, or `--min-gdbserver-port` and `--max-gdbserver-port` that limit its possible range)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136465/new/
https://reviews.llvm.org/D136465
More information about the lldb-commits
mailing list