diff options
Diffstat (limited to 'source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h')
| -rw-r--r-- | source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h | 98 | 
1 files changed, 15 insertions, 83 deletions
| diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h index 67796e4c61ef2..369eb25b1dfac 100644 --- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h +++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h @@ -10,24 +10,21 @@  #ifndef liblldb_GDBRemoteCommunication_h_  #define liblldb_GDBRemoteCommunication_h_ -// C Includes -// C++ Includes +#include "GDBRemoteCommunicationHistory.h" +  #include <condition_variable>  #include <mutex>  #include <queue>  #include <string>  #include <vector> -// Other libraries and framework includes -// Project includes  #include "lldb/Core/Communication.h" -#include "lldb/Core/Listener.h"  #include "lldb/Host/HostThread.h" -#include "lldb/Host/Predicate.h"  #include "lldb/Utility/Args.h" -#include "lldb/lldb-public.h" - +#include "lldb/Utility/Listener.h" +#include "lldb/Utility/Predicate.h"  #include "lldb/Utility/StringExtractorGDBRemote.h" +#include "lldb/lldb-public.h"  namespace lldb_private {  namespace process_gdb_remote { @@ -140,86 +137,16 @@ public:                           // fork/exec to avoid having to connect/accept    void DumpHistory(Stream &strm); +  void SetHistoryStream(llvm::raw_ostream *strm); -protected: -  class History { -  public: -    enum PacketType { -      ePacketTypeInvalid = 0, -      ePacketTypeSend, -      ePacketTypeRecv -    }; - -    struct Entry { -      Entry() -          : packet(), type(ePacketTypeInvalid), bytes_transmitted(0), -            packet_idx(0), tid(LLDB_INVALID_THREAD_ID) {} - -      void Clear() { -        packet.clear(); -        type = ePacketTypeInvalid; -        bytes_transmitted = 0; -        packet_idx = 0; -        tid = LLDB_INVALID_THREAD_ID; -      } -      std::string packet; -      PacketType type; -      uint32_t bytes_transmitted; -      uint32_t packet_idx; -      lldb::tid_t tid; -    }; - -    History(uint32_t size); - -    ~History(); - -    // For single char packets for ack, nack and /x03 -    void AddPacket(char packet_char, PacketType type, -                   uint32_t bytes_transmitted); - -    void AddPacket(const std::string &src, uint32_t src_len, PacketType type, -                   uint32_t bytes_transmitted); - -    void Dump(Stream &strm) const; - -    void Dump(Log *log) const; - -    bool DidDumpToLog() const { return m_dumped_to_log; } - -  protected: -    uint32_t GetFirstSavedPacketIndex() const { -      if (m_total_packet_count < m_packets.size()) -        return 0; -      else -        return m_curr_idx + 1; -    } - -    uint32_t GetNumPacketsInHistory() const { -      if (m_total_packet_count < m_packets.size()) -        return m_total_packet_count; -      else -        return (uint32_t)m_packets.size(); -    } - -    uint32_t GetNextIndex() { -      ++m_total_packet_count; -      const uint32_t idx = m_curr_idx; -      m_curr_idx = NormalizeIndex(idx + 1); -      return idx; -    } - -    uint32_t NormalizeIndex(uint32_t i) const { return i % m_packets.size(); } - -    std::vector<Entry> m_packets; -    uint32_t m_curr_idx; -    uint32_t m_total_packet_count; -    mutable bool m_dumped_to_log; -  }; +  static llvm::Error ConnectLocally(GDBRemoteCommunication &client, +                                    GDBRemoteCommunication &server); +protected:    std::chrono::seconds m_packet_timeout;    uint32_t m_echo_number;    LazyBool m_supports_qEcho; -  History m_history; +  GDBRemoteCommunicationHistory m_history;    bool m_send_acks;    bool m_is_platform; // Set to true if this class represents a platform,                        // false if this class represents a debug session for @@ -228,6 +155,8 @@ protected:    CompressionType m_compression_type;    PacketResult SendPacketNoLock(llvm::StringRef payload); +  PacketResult SendRawPacketNoLock(llvm::StringRef payload, +                                   bool skip_ack = false);    PacketResult ReadPacket(StringExtractorGDBRemote &response,                            Timeout<std::micro> timeout, bool sync_on_timeout); @@ -289,6 +218,9 @@ private:    HostThread m_listen_thread;    std::string m_listen_url; +  CompressionType m_decompression_scratch_type; +  void *m_decompression_scratch; +    DISALLOW_COPY_AND_ASSIGN(GDBRemoteCommunication);  }; | 
