This patch facilitates the debugging of processes inside a Docker container using an lldb client outside the container.
Depending on how the Docker container is set up, the network IP address that is known inside the container is not visible to the host outside the Docker container. For example, the Docker host may have the IP address 10.1.2.3 but inside the Docker container it may report a host 192.168.4.5. Although processes inside the Docker container believe that they are running locally on 192.168.4.5, that IP address range may not be routable from the Docker host (whose IP address is 10.1.2.3).
Using the lldb-server platform for remote debugging spawns an lldb-server gdbserver child process, in which it hard-codes the address of the machine that the lldb-server is running on. This restricts the child process programmatically to only accept connections from that address.
However, connecting an lldb client from outside the Docker host will have a different source IP address, and therefore the lldb-server gdbserver will reject the connection. Although the command has the ability to allow connections from any host, this isn't exposed from the launching process.
This adds a variable to set whether the spawned lldb-server gdbserver can accept connections from any host, so as to disable this particular check. Since the Docker container itself is running on the local host, and provides the networking firewall necessary to prevent access by other machines, this does not alter the behaviour.
The default is to be backwardly compatible; that is, connections running normally will still behave as before, and only invocations of the program running with the lldb-server platform --allow-all-hosts argument allow the source IP address to be side-stepped. No attempt to automatically detect or set this is used.
This patch has been built and tested against SVN revision 323981 and has been used successfully to permit debugging between a host and a container process.