This is an archive of the discontinued LLVM Phabricator instance.

[LLDB][Android] Add platform options
AbandonedPublic

Authored by splhack on Dec 5 2022, 7:55 AM.

Details

Reviewers
clayborg
Summary

This is an alternative approach to 'Fix Android serial number handling' https://reviews.llvm.org/D138164 .

As I pointed out in https://reviews.llvm.org/D138164, the platform connect URL does not work to specify TCP/IP-connected Android device.

This diff allows users to use platform connect options in order to specify Android device serial, ADB server port, platform local TCP port, and/or GDB local TCP port.

This is the example to use a TCP/IP-connected Android device with serial [::1]:5556.

(lldb) platform select remote-android
(lldb) platform connect --android-serial [::1]:5556 unix-abstract-connect:///data/local/tmp/debug.sock

help

(lldb) platform select remote-android
  Platform: remote-android
 Connected: no
(lldb) help platform connect
Select the current platform by providing a connection URL.

Syntax: platform connect <connect-url>

Command Options Usage:
  platform connect [-s <cmd-name>] [-p <cmd-name>] [-l <cmd-name>] [-g <cmd-name>] <process-connect-url>

       -g <cmd-name> ( --gdb-local-port <cmd-name> )
            Local TCP port for GDB port forwarding (overrides $ANDROID_PLATFORM_LOCAL_GDB_PORT.)

       -l <cmd-name> ( --platform-local-port <cmd-name> )
            Local TCP port for the platform port forwarding (overrides
            $ANDROID_PLATFORM_LOCAL_PORT.)

       -p <cmd-name> ( --adb-server-port <cmd-name> )
            Local server port to connect ADB (overrides $ANDROID_ADB_SERVER_PORT.)

       -s <cmd-name> ( --android-serial <cmd-name> )
            Android device serial for ADB to use (overrides $ANDROID_SERIAL.)

     This command takes options and free-form arguments.  If your arguments resemble option
     specifiers (i.e., they start with a - or --), you must use ' -- ' between the end of the
     command options and the beginning of the arguments.

Diff Detail