diff options
| author | Greg Clayton <gclayton@apple.com> | 2011-07-02 23:21:06 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2011-07-02 23:21:06 +0000 |
| commit | 0c51ac3295ff1864d84c7c3a0096ab0b763354f9 (patch) | |
| tree | 8b29def3d987b2805321fc359dc755c0f96c6a3a /lldb/source/Plugins/Process | |
| parent | a6e593b4ebca3142dbf4c0416e78d991c3f448c7 (diff) | |
| download | bcm5719-llvm-0c51ac3295ff1864d84c7c3a0096ab0b763354f9.tar.gz bcm5719-llvm-0c51ac3295ff1864d84c7c3a0096ab0b763354f9.zip | |
When we use the "fd://%u" for file descriptors, we need to detect if this is
a file or socket. We now make a getsockopt call to check if the fd is a socket.
Also, the previous logic in the GDB communication needs to watch for success
with an error so we can deal with EAGAIN and other normal "retry" error codes.
llvm-svn: 134359
Diffstat (limited to 'lldb/source/Plugins/Process')
| -rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 4525bc8eed2..69f97f14add 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -194,7 +194,8 @@ GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSecondsNoLock (StringExtrac if (CheckForPacket (NULL, 0, packet)) return packet.GetStringRef().size(); - while (IsConnected()) + bool timed_out = false; + while (IsConnected() && !timed_out) { lldb::ConnectionStatus status; size_t bytes_read = Read (buffer, sizeof(buffer), timeout_usec, status, &error); @@ -207,8 +208,11 @@ GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSecondsNoLock (StringExtrac { switch (status) { - case eConnectionStatusSuccess: case eConnectionStatusTimedOut: + timed_out = true; + break; + case eConnectionStatusSuccess: + //printf ("status = success but error = %s\n", error.AsCString("<invalid>")); break; case eConnectionStatusEndOfFile: @@ -218,9 +222,6 @@ GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSecondsNoLock (StringExtrac Disconnect(); break; } - - // Get out of the while loop we we finally timeout without getting any data - break; } } packet.Clear (); @@ -237,10 +238,14 @@ GDBRemoteCommunication::CheckForPacket (const uint8_t *src, size_t src_len, Stri if (src && src_len > 0) { - if (log) + if (log && log->GetVerbose()) { StreamString s; - log->Printf ("GDBRemoteCommunication::%s adding %zu bytes: %s\n",__FUNCTION__, src_len, src); + log->Printf ("GDBRemoteCommunication::%s adding %u bytes: %.*s", + __FUNCTION__, + (uint32_t)src_len, + (uint32_t)src_len, + src); } m_bytes.append ((const char *)src, src_len); } |

