@@ -18,12 +18,6 @@ using namespace lldb;
18
18
using namespace lldb_private ;
19
19
using namespace lldb_private ::process_gdb_remote;
20
20
21
- void GDBRemoteCommunicationHistory::Entry::Serialize (raw_ostream &strm) const {
22
- yaml::Output yout (strm);
23
- yout << const_cast <GDBRemoteCommunicationHistory::Entry &>(*this );
24
- strm.flush ();
25
- }
26
-
27
21
GDBRemoteCommunicationHistory::GDBRemoteCommunicationHistory (uint32_t size)
28
22
: m_packets(), m_curr_idx(0 ), m_total_packet_count(0 ),
29
23
m_dumped_to_log(false ) {
@@ -33,7 +27,8 @@ GDBRemoteCommunicationHistory::GDBRemoteCommunicationHistory(uint32_t size)
33
27
34
28
GDBRemoteCommunicationHistory::~GDBRemoteCommunicationHistory () {}
35
29
36
- void GDBRemoteCommunicationHistory::AddPacket (char packet_char, PacketType type,
30
+ void GDBRemoteCommunicationHistory::AddPacket (char packet_char,
31
+ GDBRemotePacket::Type type,
37
32
uint32_t bytes_transmitted) {
38
33
const size_t size = m_packets.size ();
39
34
if (size == 0 )
@@ -50,7 +45,8 @@ void GDBRemoteCommunicationHistory::AddPacket(char packet_char, PacketType type,
50
45
}
51
46
52
47
void GDBRemoteCommunicationHistory::AddPacket (const std::string &src,
53
- uint32_t src_len, PacketType type,
48
+ uint32_t src_len,
49
+ GDBRemotePacket::Type type,
54
50
uint32_t bytes_transmitted) {
55
51
const size_t size = m_packets.size ();
56
52
if (size == 0 )
@@ -72,12 +68,14 @@ void GDBRemoteCommunicationHistory::Dump(Stream &strm) const {
72
68
const uint32_t stop_idx = m_curr_idx + size;
73
69
for (uint32_t i = first_idx; i < stop_idx; ++i) {
74
70
const uint32_t idx = NormalizeIndex (i);
75
- const Entry &entry = m_packets[idx];
76
- if (entry.type == ePacketTypeInvalid || entry.packet .data .empty ())
71
+ const GDBRemotePacket &entry = m_packets[idx];
72
+ if (entry.type == GDBRemotePacket::ePacketTypeInvalid ||
73
+ entry.packet .data .empty ())
77
74
break ;
78
75
strm.Printf (" history[%u] tid=0x%4.4" PRIx64 " <%4u> %s packet: %s\n " ,
79
76
entry.packet_idx , entry.tid , entry.bytes_transmitted ,
80
- (entry.type == ePacketTypeSend) ? " send" : " read" ,
77
+ (entry.type == GDBRemotePacket::ePacketTypeSend) ? " send"
78
+ : " read" ,
81
79
entry.packet .data .c_str ());
82
80
}
83
81
}
@@ -92,51 +90,15 @@ void GDBRemoteCommunicationHistory::Dump(Log *log) const {
92
90
const uint32_t stop_idx = m_curr_idx + size;
93
91
for (uint32_t i = first_idx; i < stop_idx; ++i) {
94
92
const uint32_t idx = NormalizeIndex (i);
95
- const Entry &entry = m_packets[idx];
96
- if (entry.type == ePacketTypeInvalid || entry.packet .data .empty ())
93
+ const GDBRemotePacket &entry = m_packets[idx];
94
+ if (entry.type == GDBRemotePacket::ePacketTypeInvalid ||
95
+ entry.packet .data .empty ())
97
96
break ;
98
97
LLDB_LOGF (log , " history[%u] tid=0x%4.4" PRIx64 " <%4u> %s packet: %s" ,
99
98
entry.packet_idx , entry.tid , entry.bytes_transmitted ,
100
- (entry.type == ePacketTypeSend) ? " send" : " read" ,
99
+ (entry.type == GDBRemotePacket::ePacketTypeSend) ? " send"
100
+ : " read" ,
101
101
entry.packet .data .c_str ());
102
102
}
103
103
}
104
104
105
- void yaml::ScalarEnumerationTraits<GDBRemoteCommunicationHistory::PacketType>::
106
- enumeration (IO &io, GDBRemoteCommunicationHistory::PacketType &value) {
107
- io.enumCase (value, " Invalid" ,
108
- GDBRemoteCommunicationHistory::ePacketTypeInvalid);
109
- io.enumCase (value, " Send" , GDBRemoteCommunicationHistory::ePacketTypeSend);
110
- io.enumCase (value, " Recv" , GDBRemoteCommunicationHistory::ePacketTypeRecv);
111
- }
112
-
113
- void yaml::ScalarTraits<GDBRemoteCommunicationHistory::Entry::BinaryData>::
114
- output (const GDBRemoteCommunicationHistory::Entry::BinaryData &Val, void *,
115
- raw_ostream &Out) {
116
- Out << toHex (Val.data );
117
- }
118
-
119
- StringRef
120
- yaml::ScalarTraits<GDBRemoteCommunicationHistory::Entry::BinaryData>::input(
121
- StringRef Scalar, void *,
122
- GDBRemoteCommunicationHistory::Entry::BinaryData &Val) {
123
- Val.data = fromHex (Scalar);
124
- return {};
125
- }
126
-
127
- void yaml::MappingTraits<GDBRemoteCommunicationHistory::Entry>::mapping(
128
- IO &io, GDBRemoteCommunicationHistory::Entry &Entry) {
129
- io.mapRequired (" packet" , Entry.packet );
130
- io.mapRequired (" type" , Entry.type );
131
- io.mapRequired (" bytes" , Entry.bytes_transmitted );
132
- io.mapRequired (" index" , Entry.packet_idx );
133
- io.mapRequired (" tid" , Entry.tid );
134
- }
135
-
136
- StringRef yaml::MappingTraits<GDBRemoteCommunicationHistory::Entry>::validate(
137
- IO &io, GDBRemoteCommunicationHistory::Entry &Entry) {
138
- if (Entry.bytes_transmitted != Entry.packet .data .size ())
139
- return " BinaryData size doesn't match bytes transmitted" ;
140
-
141
- return {};
142
- }
0 commit comments