};
void Serialize(llvm::raw_ostream &strm) const;
+ void Dump(Stream &strm) const;
BinaryData packet;
Type type;
uint32_t bytes_transmitted;
uint32_t packet_idx;
lldb::tid_t tid;
+
+private:
+ llvm::StringRef GetTypeStr() const;
};
} // namespace lldb_private
if (entry.type == GDBRemotePacket::ePacketTypeInvalid ||
entry.packet.data.empty())
break;
- strm.Printf("history[%u] tid=0x%4.4" PRIx64 " <%4u> %s packet: %s\n",
- entry.packet_idx, entry.tid, entry.bytes_transmitted,
- (entry.type == GDBRemotePacket::ePacketTypeSend) ? "send"
- : "read",
- entry.packet.data.c_str());
+ strm.Printf("history[%u] ", entry.packet_idx);
+ entry.Dump(strm);
}
}
strm.flush();
}
+llvm::StringRef GDBRemotePacket::GetTypeStr() const {
+ switch (type) {
+ case GDBRemotePacket::ePacketTypeSend:
+ return "send";
+ case GDBRemotePacket::ePacketTypeRecv:
+ return "read";
+ case GDBRemotePacket::ePacketTypeInvalid:
+ return "invalid";
+ }
+ llvm_unreachable("All enum cases should be handled");
+}
+
+void GDBRemotePacket::Dump(Stream &strm) const {
+ strm.Printf("tid=0x%4.4" PRIx64 " <%4u> %s packet: %s\n", tid,
+ bytes_transmitted, GetTypeStr().data(), packet.data.c_str());
+}
+
void yaml::ScalarEnumerationTraits<GDBRemotePacket::Type>::enumeration(
IO &io, GDBRemotePacket::Type &value) {
io.enumCase(value, "Invalid", GDBRemotePacket::ePacketTypeInvalid);