diff options
author | Tamas Berghammer <tberghammer@google.com> | 2015-02-24 10:23:39 +0000 |
---|---|---|
committer | Tamas Berghammer <tberghammer@google.com> | 2015-02-24 10:23:39 +0000 |
commit | 912800c4006eb0caa6407fd8278f7292f617d378 (patch) | |
tree | ce1985ec30c7cd0b293102d2f58f4c56d2ce0a29 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp | |
parent | 987bf0400d27d4ef51f9f4abe3842b1cf758a623 (diff) | |
download | bcm5719-llvm-912800c4006eb0caa6407fd8278f7292f617d378.tar.gz bcm5719-llvm-912800c4006eb0caa6407fd8278f7292f617d378.zip |
Create ScopedTimeout class for GDBRemoteCommunication
This new class makes it easier to change the timeout of a
GDBRemoteCommunication instance for a short time and then restore it to
its original value.
Differential revision: http://reviews.llvm.org/D7826
llvm-svn: 230319
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index c1951e42694..f5cf2a52574 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -234,13 +234,10 @@ GDBRemoteCommunicationClient::QueryNoAckModeSupported () const uint32_t minimum_timeout = 6; uint32_t old_timeout = GetPacketTimeoutInMicroSeconds() / lldb_private::TimeValue::MicroSecPerSec; - SetPacketTimeout (std::max (old_timeout, minimum_timeout)); + GDBRemoteCommunication::ScopedTimeout timeout (*this, std::max (old_timeout, minimum_timeout)); StringExtractorGDBRemote response; - PacketResult packet_send_result = SendPacketAndWaitForResponse("QStartNoAckMode", response, false); - SetPacketTimeout (old_timeout); - - if (packet_send_result == PacketResult::Success) + if (SendPacketAndWaitForResponse("QStartNoAckMode", response, false) == PacketResult::Success) { if (response.IsOKResponse()) { @@ -2869,10 +2866,9 @@ GDBRemoteCommunicationClient::LaunchGDBserverAndGetPort (lldb::pid_t &pid, const int packet_len = stream.GetSize(); // give the process a few seconds to startup - const uint32_t old_packet_timeout = SetPacketTimeout (10); - auto result = SendPacketAndWaitForResponse(packet, packet_len, response, false); - SetPacketTimeout (old_packet_timeout); - if (result == PacketResult::Success) + GDBRemoteCommunication::ScopedTimeout timeout (*this, 10); + + if (SendPacketAndWaitForResponse(packet, packet_len, response, false) == PacketResult::Success) { std::string name; std::string value; |