aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.h')
-rw-r--r--contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.h85
1 files changed, 6 insertions, 79 deletions
diff --git a/contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.h b/contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.h
index 85f112b50623..c006fbd34a4b 100644
--- a/contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.h
+++ b/contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.h
@@ -12,6 +12,7 @@
#include <string>
#include <vector>
+#include "lldb/Utility/GDBRemote.h"
#include "lldb/lldb-public.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Support/raw_ostream.h"
@@ -25,46 +26,17 @@ class GDBRemoteCommunicationHistory {
public:
friend llvm::yaml::MappingTraits<GDBRemoteCommunicationHistory>;
- enum PacketType { ePacketTypeInvalid = 0, ePacketTypeSend, ePacketTypeRecv };
-
- /// Entry in the ring buffer containing the packet data, its type, size and
- /// index. Entries can be serialized to file.
- struct Entry {
- Entry()
- : packet(), type(ePacketTypeInvalid), bytes_transmitted(0),
- packet_idx(0), tid(LLDB_INVALID_THREAD_ID) {}
-
- void Clear() {
- packet.data.clear();
- type = ePacketTypeInvalid;
- bytes_transmitted = 0;
- packet_idx = 0;
- tid = LLDB_INVALID_THREAD_ID;
- }
-
- struct BinaryData {
- std::string data;
- };
-
- void Serialize(llvm::raw_ostream &strm) const;
-
- BinaryData packet;
- PacketType type;
- uint32_t bytes_transmitted;
- uint32_t packet_idx;
- lldb::tid_t tid;
- };
-
GDBRemoteCommunicationHistory(uint32_t size = 0);
~GDBRemoteCommunicationHistory();
// 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,
+ void AddPacket(char packet_char, GDBRemotePacket::Type type,
uint32_t bytes_transmitted);
+ void AddPacket(const std::string &src, uint32_t src_len,
+ GDBRemotePacket::Type type, uint32_t bytes_transmitted);
+
void Dump(Stream &strm) const;
void Dump(Log *log) const;
bool DidDumpToLog() const { return m_dumped_to_log; }
@@ -97,7 +69,7 @@ private:
return m_packets.empty() ? 0 : i % m_packets.size();
}
- std::vector<Entry> m_packets;
+ std::vector<GDBRemotePacket> m_packets;
uint32_t m_curr_idx;
uint32_t m_total_packet_count;
mutable bool m_dumped_to_log;
@@ -107,49 +79,4 @@ private:
} // namespace process_gdb_remote
} // namespace lldb_private
-LLVM_YAML_IS_DOCUMENT_LIST_VECTOR(
- lldb_private::process_gdb_remote::GDBRemoteCommunicationHistory::Entry)
-
-namespace llvm {
-namespace yaml {
-
-template <>
-struct ScalarEnumerationTraits<lldb_private::process_gdb_remote::
- GDBRemoteCommunicationHistory::PacketType> {
- static void enumeration(IO &io,
- lldb_private::process_gdb_remote::
- GDBRemoteCommunicationHistory::PacketType &value);
-};
-
-template <>
-struct ScalarTraits<lldb_private::process_gdb_remote::
- GDBRemoteCommunicationHistory::Entry::BinaryData> {
- static void output(const lldb_private::process_gdb_remote::
- GDBRemoteCommunicationHistory::Entry::BinaryData &,
- void *, raw_ostream &);
-
- static StringRef
- input(StringRef, void *,
- lldb_private::process_gdb_remote::GDBRemoteCommunicationHistory::Entry::
- BinaryData &);
-
- static QuotingType mustQuote(StringRef S) { return QuotingType::None; }
-};
-
-template <>
-struct MappingTraits<
- lldb_private::process_gdb_remote::GDBRemoteCommunicationHistory::Entry> {
- static void
- mapping(IO &io,
- lldb_private::process_gdb_remote::GDBRemoteCommunicationHistory::Entry
- &Entry);
-
- static StringRef validate(
- IO &io,
- lldb_private::process_gdb_remote::GDBRemoteCommunicationHistory::Entry &);
-};
-
-} // namespace yaml
-} // namespace llvm
-
#endif // liblldb_GDBRemoteCommunicationHistory_h_