aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
diff options
context:
space:
mode:
authorMichał Górny <mgorny@moritz.systems>2022-09-03 10:25:42 +0200
committerMichał Górny <mgorny@moritz.systems>2022-09-06 13:09:42 +0200
commit9823d42557eb1da3ecf2f771ea2cbc84a988ef92 (patch)
tree4d736af8d8602582b8a0a759259bef59784f0221 /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
parent83552e8c72b8c41d7a07fbd4bf859ece3eb55099 (diff)
downloadllvm-9823d42557eb1da3ecf2f771ea2cbc84a988ef92.zip
llvm-9823d42557eb1da3ecf2f771ea2cbc84a988ef92.tar.gz
llvm-9823d42557eb1da3ecf2f771ea2cbc84a988ef92.tar.bz2
[lldb] [Core] Split read thread support into ThreadedCommunication
Split the read thread support from Communication into a dedicated ThreadedCommunication subclass. The read thread support is used only by a subset of Communication consumers, and it adds a lot of complexity to the base class. Furthermore, having a dedicated subclass makes it clear whether a particular consumer needs to account for the possibility of read thread being running or not. The modules currently calling `StartReadThread()` are updated to use `ThreadedCommunication`. The remaining modules use the simplified `Communication` class. `SBCommunication` is changed to use `ThreadedCommunication` in order to avoid changing the public API. `CommunicationKDP` is updated in order to (hopefully) compile with the new code. However, I do not have a Darwin box to test it, so I've limited the changes to the bare minimum. `GDBRemoteCommunication` is updated to become a `Broadcaster` directly. Since it does not inherit from `ThreadedCommunication`, its event support no longer collides with the one used for read thread and can be implemented cleanly. The support for `eBroadcastBitReadThreadDidExit` is removed from the code -- since the read thread was not used, this event was never reported. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.llvm.org/D133251
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp23
1 files changed, 0 insertions, 23 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 37272d3..c0765dc 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -285,14 +285,6 @@ ProcessGDBRemote::ProcessGDBRemote(lldb::TargetSP target_sp,
__FUNCTION__);
}
- const uint32_t gdb_event_mask = Communication::eBroadcastBitReadThreadDidExit;
- if (m_async_listener_sp->StartListeningForEvents(
- &m_gdb_comm, gdb_event_mask) != gdb_event_mask) {
- LLDB_LOGF(log,
- "ProcessGDBRemote::%s failed to listen for m_gdb_comm events",
- __FUNCTION__);
- }
-
const uint64_t timeout_seconds =
GetGlobalPluginProperties().GetPacketTimeout();
if (timeout_seconds > 0)
@@ -3575,21 +3567,6 @@ thread_result_t ProcessGDBRemote::AsyncThread() {
done = true;
break;
}
- } else if (event_sp->BroadcasterIs(&m_gdb_comm)) {
- switch (event_type) {
- case Communication::eBroadcastBitReadThreadDidExit:
- SetExitStatus(-1, "lost connection");
- done = true;
- break;
-
- default:
- LLDB_LOGF(log,
- "ProcessGDBRemote::%s(pid = %" PRIu64
- ") got unknown event 0x%8.8x",
- __FUNCTION__, GetID(), event_type);
- done = true;
- break;
- }
}
} else {
LLDB_LOGF(log,