diff options
author | Pavel Labath <pavel@labath.sk> | 2021-11-24 09:59:16 +0100 |
---|---|---|
committer | Pavel Labath <pavel@labath.sk> | 2021-11-24 10:00:43 +0100 |
commit | 6f82264dbb02028d4ec4940aeb6d716dded6e879 (patch) | |
tree | 7a9d91ae49df9ca382864f890bfe0895c4f1517a /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp | |
parent | df32a39dd0f68383a1685a4571715edb70664969 (diff) | |
download | llvm-6f82264dbb02028d4ec4940aeb6d716dded6e879.zip llvm-6f82264dbb02028d4ec4940aeb6d716dded6e879.tar.gz llvm-6f82264dbb02028d4ec4940aeb6d716dded6e879.tar.bz2 |
[lldb/gdb-remote] Remove more non-stop mode remnants
The read thread handling is completely dead code now that non-stop mode
no longer exists.
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp | 87 |
1 files changed, 1 insertions, 86 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 4ce79da..5c8dd03 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -81,11 +81,6 @@ GDBRemoteCommunication::~GDBRemoteCommunication() { if (m_decompression_scratch) free (m_decompression_scratch); #endif - - // Stop the communications read thread which is used to parse all incoming - // packets. This function will block until the read thread returns. - if (m_read_thread_enabled) - StopReadThread(); } char GDBRemoteCommunication::CalculcateChecksum(llvm::StringRef payload) { @@ -225,40 +220,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunication::ReadPacket(StringExtractorGDBRemote &response, Timeout<std::micro> timeout, bool sync_on_timeout) { - if (m_read_thread_enabled) - return PopPacketFromQueue(response, timeout); - else - return WaitForPacketNoLock(response, timeout, sync_on_timeout); -} - -// This function is called when a packet is requested. -// A whole packet is popped from the packet queue and returned to the caller. -// Packets are placed into this queue from the communication read thread. See -// GDBRemoteCommunication::AppendBytesToCache. -GDBRemoteCommunication::PacketResult -GDBRemoteCommunication::PopPacketFromQueue(StringExtractorGDBRemote &response, - Timeout<std::micro> timeout) { - auto pred = [&] { return !m_packet_queue.empty() && IsConnected(); }; - // lock down the packet queue - std::unique_lock<std::mutex> lock(m_packet_queue_mutex); - - if (!timeout) - m_condition_queue_not_empty.wait(lock, pred); - else { - if (!m_condition_queue_not_empty.wait_for(lock, *timeout, pred)) - return PacketResult::ErrorReplyTimeout; - if (!IsConnected()) - return PacketResult::ErrorDisconnected; - } - - // get the front element of the queue - response = m_packet_queue.front(); - - // remove the front element - m_packet_queue.pop(); - - // we got a packet - return PacketResult::Success; + return WaitForPacketNoLock(response, timeout, sync_on_timeout); } GDBRemoteCommunication::PacketResult @@ -1287,53 +1249,6 @@ GDBRemoteCommunication::ScopedTimeout::~ScopedTimeout() { m_gdb_comm.SetPacketTimeout(m_saved_timeout); } -// This function is called via the Communications class read thread when bytes -// become available for this connection. This function will consume all -// incoming bytes and try to parse whole packets as they become available. Full -// packets are placed in a queue, so that all packet requests can simply pop -// from this queue. Async notification packets will be dispatched immediately -// to the ProcessGDBRemote Async thread via an event. -void GDBRemoteCommunication::AppendBytesToCache(const uint8_t *bytes, - size_t len, bool broadcast, - lldb::ConnectionStatus status) { - StringExtractorGDBRemote packet; - - while (true) { - PacketType type = CheckForPacket(bytes, len, packet); - - // scrub the data so we do not pass it back to CheckForPacket on future - // passes of the loop - bytes = nullptr; - len = 0; - - // we may have received no packet so lets bail out - if (type == PacketType::Invalid) - break; - - if (type == PacketType::Standard) { - // scope for the mutex - { - // lock down the packet queue - std::lock_guard<std::mutex> guard(m_packet_queue_mutex); - // push a new packet into the queue - m_packet_queue.push(packet); - // Signal condition variable that we have a packet - m_condition_queue_not_empty.notify_one(); - } - } - - if (type == PacketType::Notify) { - // put this packet into an event - const char *pdata = packet.GetStringRef().data(); - - // as the communication class, we are a broadcaster and the async thread - // is tuned to listen to us - BroadcastEvent(eBroadcastBitGdbReadThreadGotNotify, - new EventDataBytes(pdata)); - } - } -} - void llvm::format_provider<GDBRemoteCommunication::PacketResult>::format( const GDBRemoteCommunication::PacketResult &result, raw_ostream &Stream, StringRef Style) { |