diff options
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/Core/Communication.cpp | 7 | ||||
-rw-r--r-- | lldb/source/Core/ConnectionSharedMemory.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Host/common/Editline.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp | 17 | ||||
-rw-r--r-- | lldb/source/Plugins/Platform/Android/AdbClient.cpp | 9 |
5 files changed, 18 insertions, 21 deletions
diff --git a/lldb/source/Core/Communication.cpp b/lldb/source/Core/Communication.cpp index c82e2fe9368..113a847953d 100644 --- a/lldb/source/Core/Communication.cpp +++ b/lldb/source/Core/Communication.cpp @@ -278,11 +278,8 @@ size_t Communication::ReadFromConnection(void *dst, size_t dst_len, ConnectionStatus &status, Error *error_ptr) { lldb::ConnectionSP connection_sp(m_connection_sp); - if (connection_sp) { - return connection_sp->Read(dst, dst_len, - timeout ? timeout->count() : UINT32_MAX, status, - error_ptr); - } + if (connection_sp) + return connection_sp->Read(dst, dst_len, timeout, status, error_ptr); if (error_ptr) error_ptr->SetErrorString("Invalid connection."); diff --git a/lldb/source/Core/ConnectionSharedMemory.cpp b/lldb/source/Core/ConnectionSharedMemory.cpp index 05dec4856c2..6cc2eb1b219 100644 --- a/lldb/source/Core/ConnectionSharedMemory.cpp +++ b/lldb/source/Core/ConnectionSharedMemory.cpp @@ -79,7 +79,7 @@ ConnectionStatus ConnectionSharedMemory::Disconnect(Error *error_ptr) { } size_t ConnectionSharedMemory::Read(void *dst, size_t dst_len, - uint32_t timeout_usec, + const Timeout<std::micro> &timeout, ConnectionStatus &status, Error *error_ptr) { status = eConnectionStatusSuccess; diff --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp index 6e12bfb8972..a600c61c8e6 100644 --- a/lldb/source/Host/common/Editline.cpp +++ b/lldb/source/Host/common/Editline.cpp @@ -516,11 +516,11 @@ int Editline::GetCharacter(EditLineCharType *c) { // mutex again and // check if we were interrupted. m_output_mutex.unlock(); - int read_count = m_input_connection.Read(&ch, 1, UINT32_MAX, status, NULL); + int read_count = m_input_connection.Read(&ch, 1, llvm::None, status, NULL); m_output_mutex.lock(); if (m_editor_status == EditorStatus::Interrupted) { while (read_count > 0 && status == lldb::eConnectionStatusSuccess) - read_count = m_input_connection.Read(&ch, 1, UINT32_MAX, status, NULL); + read_count = m_input_connection.Read(&ch, 1, llvm::None, status, NULL); lldbassert(status == lldb::eConnectionStatusInterrupted); return 0; } diff --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp index c1a6284ea62..64101fdc426 100644 --- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp +++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp @@ -369,7 +369,7 @@ ConnectionStatus ConnectionFileDescriptor::Disconnect(Error *error_ptr) { } size_t ConnectionFileDescriptor::Read(void *dst, size_t dst_len, - uint32_t timeout_usec, + const Timeout<std::micro> &timeout, ConnectionStatus &status, Error *error_ptr) { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); @@ -392,7 +392,7 @@ size_t ConnectionFileDescriptor::Read(void *dst, size_t dst_len, return 0; } - status = BytesAvailable(timeout_usec, error_ptr); + status = BytesAvailable(timeout, error_ptr); if (status != eConnectionStatusSuccess) return 0; @@ -553,8 +553,9 @@ std::string ConnectionFileDescriptor::GetURI() { return m_uri; } // be used or a new version of ConnectionFileDescriptor::BytesAvailable() // should be written for the system that is running into the limitations. -ConnectionStatus ConnectionFileDescriptor::BytesAvailable(uint32_t timeout_usec, - Error *error_ptr) { +ConnectionStatus +ConnectionFileDescriptor::BytesAvailable(const Timeout<std::micro> &timeout, + Error *error_ptr) { // Don't need to take the mutex here separately since we are only called from // Read. If we // ever get used more generally we will need to lock here as well. @@ -562,8 +563,8 @@ ConnectionStatus ConnectionFileDescriptor::BytesAvailable(uint32_t timeout_usec, Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_CONNECTION)); if (log) log->Printf( - "%p ConnectionFileDescriptor::BytesAvailable (timeout_usec = %u)", - static_cast<void *>(this), timeout_usec); + "%p ConnectionFileDescriptor::BytesAvailable (timeout_usec = %lu)", + static_cast<void *>(this), long(timeout ? timeout->count() : -1)); // Make a copy of the file descriptors to make sure we don't // have another thread change these values out from under us @@ -573,8 +574,8 @@ ConnectionStatus ConnectionFileDescriptor::BytesAvailable(uint32_t timeout_usec, if (handle != IOObject::kInvalidHandleValue) { SelectHelper select_helper; - if (timeout_usec != UINT32_MAX) - select_helper.SetTimeout(std::chrono::microseconds(timeout_usec)); + if (timeout) + select_helper.SetTimeout(*timeout); select_helper.FDSetRead(handle); #if defined(_MSC_VER) diff --git a/lldb/source/Plugins/Platform/Android/AdbClient.cpp b/lldb/source/Plugins/Platform/Android/AdbClient.cpp index 05004406c04..eb684ad0fbc 100644 --- a/lldb/source/Plugins/Platform/Android/AdbClient.cpp +++ b/lldb/source/Plugins/Platform/Android/AdbClient.cpp @@ -74,10 +74,9 @@ Error ReadAllBytes(Connection &conn, void *buffer, size_t size) { const auto deadline = now + kReadTimeout; size_t total_read_bytes = 0; while (total_read_bytes < size && now < deadline) { - uint32_t timeout_usec = duration_cast<microseconds>(deadline - now).count(); auto read_bytes = conn.Read(read_buffer + total_read_bytes, size - total_read_bytes, - timeout_usec, status, &error); + duration_cast<microseconds>(deadline - now), status, &error); if (error.Fail()) return error; total_read_bytes += read_bytes; @@ -276,9 +275,9 @@ Error AdbClient::ReadMessageStream(std::vector<char> &message, if (elapsed >= timeout) return Error("Timed out"); - size_t n = m_conn->Read( - buffer, sizeof(buffer), - duration_cast<microseconds>(timeout - elapsed).count(), status, &error); + size_t n = m_conn->Read(buffer, sizeof(buffer), + duration_cast<microseconds>(timeout - elapsed), + status, &error); if (n > 0) message.insert(message.end(), &buffer[0], &buffer[n]); } |