diff options
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp | 8 | ||||
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 5 |
2 files changed, 7 insertions, 6 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp index eb6cc6e6b8f..677f348dec2 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp @@ -15,6 +15,7 @@ #include <cstring> #include <mutex> #include <sstream> +#include <thread> #include "llvm/Support/FileSystem.h" #include "llvm/Support/Threading.h" @@ -280,10 +281,9 @@ bool GDBRemoteCommunicationServerPlatform::KillSpawnedProcess(lldb::pid_t pid) { return true; } } - usleep(10000); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); } - // check one more time after the final usleep { std::lock_guard<std::recursive_mutex> guard(m_spawned_pids_mutex); if (m_spawned_pids.find(pid) == m_spawned_pids.end()) @@ -302,10 +302,10 @@ bool GDBRemoteCommunicationServerPlatform::KillSpawnedProcess(lldb::pid_t pid) { return true; } } - usleep(10000); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); } - // check one more time after the final usleep Scope for locker + // check one more time after the final sleep { std::lock_guard<std::recursive_mutex> guard(m_spawned_pids_mutex); if (m_spawned_pids.find(pid) == m_spawned_pids.end()) diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 6b07064a78a..3c1c66d9796 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1032,7 +1032,7 @@ Status ProcessGDBRemote::ConnectToDebugserver(llvm::StringRef connect_url) { if (retry_count >= max_retry_count) break; - usleep(100000); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); } } } @@ -3591,7 +3591,8 @@ bool ProcessGDBRemote::MonitorDebugserverProcess( // Sleep for a half a second to make sure our inferior process has time to // set its exit status before we set it incorrectly when both the debugserver // and the inferior process shut down. - usleep(500000); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + // If our process hasn't yet exited, debugserver might have died. If the // process did exit, then we are reaping it. const StateType state = process_sp->GetState(); |