[lldb-dev] race condition using gdb-remote over ssh port forwarding

Pavel Labath via lldb-dev lldb-dev at lists.llvm.org
Wed Nov 29 02:44:38 PST 2017


On 28 November 2017 at 20:54, Christopher Book <cbook at google.com> wrote:
> Hi Pavel, I think you are on the right track in that it already does seem to
> wait for the gdbserver to be up using a pipe.
>
> In StartDebugserverProcess it seems like there is a pipe created to tell
> when the server is running.  Here is a comment:
>
>     // socket_pipe is used by debug server to communicate back either
>     // TCP port or domain socket name which it listens on.
>     // The second purpose of the pipe to serve as a synchronization point -
>     // once data is written to the pipe, debug server is up and running.
>
> However, it looks like specifying --min-gdbserver-port and
> --max-gdbserver-port cause the pipe to not be used for some reason.
>
> Here is the gdbserver invocation when I don't specify the gdb min and max
> port:
>> lldb-server gdbserver tcp://<myip>:0 --native-regs --pipe 6
>
> And here is the gdbserver invocation when I do specify the gdb port:
>> lldb-server gdbserver tcp://<myip>:<mygdbport> --native-regs
>
> Its not obvious to me from looking at the code why this is being skipped.
> But I will debug further why this argument is not used in this case.
>

Aha, interesting. That would explain why there is a race. We should
add the pipe synchronization even in case we know what is the port
going to be (though I still like the "exec" idea).


More information about the lldb-dev mailing list