From 6ed95945edea5f40fa5aedb3b049bb3d78dcce4e Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Sat, 22 Jan 2011 07:12:45 +0000 Subject: Sped up the shutdown time on MacOSX by quite a bit by making sure any threads that we spawn let us know when they are going away and that we don't timeout waiting for a message from threads that have gone away. We also now don't expect the "k" packet (kill) to send a response. This greatly speeds up debugger shutdown performance. The test suite now runs quite a bit faster. Added a fix to the variable display code that fixes the display of base classes. We were assuming the virtual or normal base class offsets were being given in bit sizes, but they were being given as character sizes, so we needed to multiply the offset by 8. This wasn't affecting the expression parser, but it was affecting the correct display of C++ class base classes and all of their children. llvm-svn: 124024 --- .../Process/gdb-remote/GDBRemoteCommunication.cpp | 40 ++++++++++++++++------ 1 file changed, 29 insertions(+), 11 deletions(-) (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp') diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 92e33b25771..38b823f77aa 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -87,14 +87,23 @@ GDBRemoteCommunication::CalculcateChecksum (const char *payload, size_t payload_ } size_t -GDBRemoteCommunication::SendAck (char ack_char) +GDBRemoteCommunication::SendAck () { - Mutex::Locker locker(m_sequence_mutex); - ProcessGDBRemoteLog::LogIf (GDBR_LOG_PACKETS, "send packet: %c", ack_char); + ProcessGDBRemoteLog::LogIf (GDBR_LOG_PACKETS, "send packet: +"); ConnectionStatus status = eConnectionStatusSuccess; + char ack_char = '+'; return Write (&ack_char, 1, status, NULL) == 1; } +size_t +GDBRemoteCommunication::SendNack () +{ + ProcessGDBRemoteLog::LogIf (GDBR_LOG_PACKETS, "send packet: -"); + ConnectionStatus status = eConnectionStatusSuccess; + char nack_char = '-'; + return Write (&nack_char, 1, status, NULL) == 1; +} + size_t GDBRemoteCommunication::SendPacketAndWaitForResponse ( @@ -141,7 +150,8 @@ GDBRemoteCommunication::SendPacketAndWaitForResponse m_async_packet_predicate.SetValue (true, eBroadcastNever); bool timed_out = false; - if (SendInterrupt(locker, 1, &timed_out)) + bool sent_interrupt = false; + if (SendInterrupt(locker, 1, sent_interrupt, timed_out)) { if (m_async_packet_predicate.WaitForValueEqualTo (false, &timeout_time, &timed_out)) { @@ -443,8 +453,9 @@ GDBRemoteCommunication::SendAsyncSignal (int signo) { m_async_signal = signo; bool timed_out = false; + bool sent_interrupt = false; Mutex::Locker locker; - if (SendInterrupt (locker, 1, &timed_out)) + if (SendInterrupt (locker, 1, sent_interrupt, timed_out)) return true; m_async_signal = -1; return false; @@ -461,10 +472,16 @@ GDBRemoteCommunication::SendAsyncSignal (int signo) // (gdb remote protocol requires this), and do what we need to do, then resume. bool -GDBRemoteCommunication::SendInterrupt (Mutex::Locker& locker, uint32_t seconds_to_wait_for_stop, bool *timed_out) +GDBRemoteCommunication::SendInterrupt +( + Mutex::Locker& locker, + uint32_t seconds_to_wait_for_stop, + bool &sent_interrupt, + bool &timed_out +) { - if (timed_out) - *timed_out = false; + sent_interrupt = false; + timed_out = false; if (IsConnected() && IsRunning()) { @@ -484,8 +501,9 @@ GDBRemoteCommunication::SendInterrupt (Mutex::Locker& locker, uint32_t seconds_t ProcessGDBRemoteLog::LogIf (GDBR_LOG_PACKETS, "send packet: \\x03"); if (Write (&ctrl_c, 1, status, NULL) > 0) { + sent_interrupt = true; if (seconds_to_wait_for_stop) - m_private_is_running.WaitForValueEqualTo (false, &timeout, timed_out); + m_private_is_running.WaitForValueEqualTo (false, &timeout, &timed_out); return true; } } @@ -553,9 +571,9 @@ GDBRemoteCommunication::WaitForPacketNoLock (StringExtractorGDBRemote &response, checksum_error = packet_checksum != actual_checksum; // Send the ack or nack if needed if (checksum_error || !success) - SendAck('-'); + SendNack(); else - SendAck('+'); + SendAck(); } } else -- cgit v1.2.3