[lldb-dev] remote server crash -> lldb waits forever in accept()
Jim Ingham via lldb-dev
lldb-dev at lists.llvm.org
Fri Apr 28 11:06:09 PDT 2017
Seems to me a better UI would be to make ^C interrupt this wait. That seems to me better than putting in some arbitrary timeout.
Jim
> On Apr 28, 2017, at 10:21 AM, Ted Woodward via lldb-dev <lldb-dev at lists.llvm.org> wrote:
>
> Hi Chris, Pavel,
>
> I've got a problem launching the hexagon simulator from lldb. It's launched
> the same way that debugserver/lldb-server is launched, with reverse connect
> on a TCP socket. The user can modify the simulator command line (using
> target.run-args), and can easily give a set of options that the simulator
> can't handle. In this case the simulator quits before connecting to lldb,
> and lldb will wait forever for the connection, since TCPSocket::Accept has
> no timeout.
>
> Currently I have a select call before the accept, to make sure there is
> activity on the socket. This doesn't feel right with the new changes using
> MainLoop, so I wanted to see what the list thinks. I believe it will happen
> any time that debugserver/lldb-server quits or crashes before connecting.
> That should be easy to test.
>
> This is what I use, right before the call to accept_loop.Run in
> TCPSocket::Accept:
>
> NativeSocket accept_socket = -1;
> fd_set readset;
> FD_ZERO(&readset);
> for (auto socket : m_listen_sockets) {
> auto fd = socket.first;
> FD_SET(fd, &readset);
> if (fd > accept_socket)
> accept_socket = fd;
> }
> struct timeval timeout = {10, 0};
> int result = ::select(accept_socket + 1, &readset, NULL, NULL,
> &timeout);
> if (result == 0) {
> printf("error: timeout waiting for remote server to connect!\n");
> error.SetErrorString("timeout waiting for remote server to connect");
> return error;
> } else if (result < 0) {
> printf("error: remote server does not exist!\n");
> SetLastError(error);
> return error;
> }
>
>
> Any thoughts this issue?
>
> Ted
>
> --
> Qualcomm Innovation Center, Inc.
> The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
> Linux Foundation Collaborative Project
>
>
>
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
More information about the lldb-dev
mailing list