[Lldb-commits] [PATCH] D49739: [WIP] Re-implement MI target-select command.

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 26 01:25:42 PDT 2018

labath added inline comments.

Comment at: lit/lit.cfg:59
-debugserver = lit.util.which('debugserver', lldb_tools_dir)
+if platform.system() in ['Darwin']:
+    debugserver = lit.util.which('debugserver', lldb_tools_dir)
apolyakov wrote:
> Do we have `debugserver` only on macOS? On other OS it's called `lldb-server`?
That is correct (well.. some platforms like FreeBSD and Windows have neither).

Comment at: lit/tools/lldb-mi/target/inputs/target-select-so-path.py:8-11
+def get_free_port():
+    s = socket.socket()
+    s.bind(('', 0))
+    return s.getsockname()[1]
This is still racy, because the port can be snatched from under you between the time you get the free port and the time when lldb-server binds to it.  If this was the only test doing it then it might be fine, but since this is going to be running concurrently with other tests, all of which are fetching free ports, the chances of that happening add up.

(Also, binding to the wildcard address will trigger a firewall popup on some machines.)

Comment at: lit/tools/lldb-mi/target/inputs/target-select-so-path.py:25-26
+# Run debugserver, lldb-mi and FileCheck.
+debugserver_proc = subprocess.Popen(debugserver, shell=True)
+lldbmi_proc = subprocess.Popen(lldbmi, stdin=subprocess.PIPE,
+                               stdout=subprocess.PIPE, shell=True)
Another race here: lldb-mi can attempt to connect before lldb-server has had a chance to start listening. (That's another reason to implement the port handshake, as it will serve as an synchronization point -- you get the port number only after lldb-server has successfully started and set up it's socket).


More information about the lldb-commits mailing list