Modify "platform connect" to connect to processes as well
The standard remote debugging workflow with gdb is to start the
application on the remote host under gdbserver (e.g.: gdbserver :5039
a.out) and then connect to it with gdb.
The same workflow is supported by debugserver/lldb-gdbserver with a very
similar syntax but to access all features of lldb we need to be
connected also to an lldb-platform instance running on the target.
Before this change this had to be done manually with starting a separate
lldb-platform on the target machine and then connecting to it with lldb
before connecting to the process.
This change modifies the behavior of "platform connect" with
automatically connecting to the process instance if it was started by
the remote platform. With this command replacing gdbserver in a gdb
based worflow is usually as simple as replacing the command to execute
gdbserver with executing lldb-platform.
Example for the new workflow:
- On the target: lldb-server platform --listen localhost:5432 -- a.out arg1 arg2
- On the host: (lldb) platform select remote-android (lldb) platform connect connect://localhost:5432
- As a result we will be connected to the remote platform and also connected to a process of a.out on the remote target what is stopped at the entry point (the executable file and all of its dependency will be downloaded by the platform to the module cache)