[lldb-dev] Odd error involving python subprocess.Popen and gdb-remote hangup on Windows

Ted Woodward ted.woodward at codeaurora.org
Thu Aug 28 11:53:27 PDT 2014

I have a python script that automatically launches a simulator and connects
to it with gdb-remote. Everything works fine on Linux. But when I issue the
"kill" command on Windows, LLDB crashes.


This only happens if I launch the simulator (or any external program) using
python. I'm using subprocess.Popen, but I've also tried os.spawnl. I've
traced the problem down to reading errno in Error::SetErrorToErrno(). In
this case, errno is 0, so no error is reported, and the -1 that recv returns
is used as a buffer size and LLDB crashes. If I don't launch a program using
Popen, errno is 2, and everything is handled correctly.


Stepping into the errno access, GetLastError() is correctly set to
WSAECONNRESET, but ptd->_terrno, which errno is set to, is 0. This seems
like a Visual Studio 2012 runtime bug.


I think maybe we shouldn't rely on errno on Windows, but call GetLastError()
and convert their error numbers to POSIX error values.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140828/6dc1021f/attachment.html>

More information about the lldb-dev mailing list