aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2022-02-21 11:07:38 +0100
committerPavel Labath <pavel@labath.sk>2022-02-23 14:25:59 +0100
commitd0810779b1f310d99176467d5d5b5aa4e26d7eb5 (patch)
tree65650a935786a316c13763f0aba49092273f3eae /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
parent40f908195807953f19322a8d1a193d243dc5bfb6 (diff)
downloadllvm-d0810779b1f310d99176467d5d5b5aa4e26d7eb5.zip
llvm-d0810779b1f310d99176467d5d5b5aa4e26d7eb5.tar.gz
llvm-d0810779b1f310d99176467d5d5b5aa4e26d7eb5.tar.bz2
[lldb] Modernize ThreadLauncher
Accept a function object instead of a raw pointer. This avoids a bunch of boilerplate typically needed to pass arguments to the thread functions. Differential Revision: https://reviews.llvm.org/D120321
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 38d9e40..d660a4d 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -843,7 +843,7 @@ Status GDBRemoteCommunication::StartListenThread(const char *hostname,
m_listen_url = listen_url;
SetConnection(std::make_unique<ConnectionFileDescriptor>());
llvm::Expected<HostThread> listen_thread = ThreadLauncher::LaunchThread(
- listen_url, GDBRemoteCommunication::ListenThread, this);
+ listen_url, [this] { return GDBRemoteCommunication::ListenThread(); });
if (!listen_thread)
return Status(listen_thread.takeError());
m_listen_thread = *listen_thread;
@@ -857,23 +857,22 @@ bool GDBRemoteCommunication::JoinListenThread() {
return true;
}
-lldb::thread_result_t
-GDBRemoteCommunication::ListenThread(lldb::thread_arg_t arg) {
- GDBRemoteCommunication *comm = (GDBRemoteCommunication *)arg;
+lldb::thread_result_t GDBRemoteCommunication::ListenThread() {
Status error;
ConnectionFileDescriptor *connection =
- (ConnectionFileDescriptor *)comm->GetConnection();
+ (ConnectionFileDescriptor *)GetConnection();
if (connection) {
// Do the listen on another thread so we can continue on...
if (connection->Connect(
- comm->m_listen_url.c_str(), [comm](llvm::StringRef port_str) {
+ m_listen_url.c_str(),
+ [this](llvm::StringRef port_str) {
uint16_t port = 0;
llvm::to_integer(port_str, port, 10);
- comm->m_port_promise.set_value(port);
+ m_port_promise.set_value(port);
},
&error) != eConnectionStatusSuccess)
- comm->SetConnection(nullptr);
+ SetConnection(nullptr);
}
return {};
}