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

Christopher Book via lldb-dev lldb-dev at lists.llvm.org
Wed Nov 29 06:53:17 PST 2017

I made a mistake and was not looking at the latest source.  Looks like this
exact issue was already discovered and fixed:

I'm using 4.0.1, so it appears I need to upgrade.


On Wed, Nov 29, 2017 at 5:45 AM Pavel Labath <labath at google.com> wrote:

> 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).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20171129/96338623/attachment.html>

More information about the lldb-dev mailing list