<div dir="ltr">I made a mistake and was not looking at the latest source.  Looks like this exact issue was already discovered and fixed:<div><a href="https://reviews.llvm.org/D30255">https://reviews.llvm.org/D30255</a></div><div><br></div><div>I'm using 4.0.1, so it appears I need to upgrade.</div><div><br></div><div>Chris<br></div><div><br><div class="gmail_quote"><div dir="ltr">On Wed, Nov 29, 2017 at 5:45 AM Pavel Labath <<a href="mailto:labath@google.com">labath@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 28 November 2017 at 20:54, Christopher Book <<a href="mailto:cbook@google.com" target="_blank">cbook@google.com</a>> wrote:<br>
> Hi Pavel, I think you are on the right track in that it already does seem to<br>
> wait for the gdbserver to be up using a pipe.<br>
><br>
> In StartDebugserverProcess it seems like there is a pipe created to tell<br>
> when the server is running.  Here is a comment:<br>
><br>
>     // socket_pipe is used by debug server to communicate back either<br>
>     // TCP port or domain socket name which it listens on.<br>
>     // The second purpose of the pipe to serve as a synchronization point -<br>
>     // once data is written to the pipe, debug server is up and running.<br>
><br>
> However, it looks like specifying --min-gdbserver-port and<br>
> --max-gdbserver-port cause the pipe to not be used for some reason.<br>
><br>
> Here is the gdbserver invocation when I don't specify the gdb min and max<br>
> port:<br>
>> lldb-server gdbserver tcp://<myip>:0 --native-regs --pipe 6<br>
><br>
> And here is the gdbserver invocation when I do specify the gdb port:<br>
>> lldb-server gdbserver tcp://<myip>:<mygdbport> --native-regs<br>
><br>
> Its not obvious to me from looking at the code why this is being skipped.<br>
> But I will debug further why this argument is not used in this case.<br>
><br>
<br>
Aha, interesting. That would explain why there is a race. We should<br>
add the pipe synchronization even in case we know what is the port<br>
going to be (though I still like the "exec" idea).<br>
</blockquote></div></div></div>