summaryrefslogtreecommitdiffstats
path: root/lldb/source/Utility/GDBRemote.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-09-16 20:02:57 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-09-16 20:02:57 +0000
commit4e053ff1d188bae61f6f7d20c591a462b32a9992 (patch)
tree3a2841efa6c6e99971ba852ad55a19d9ca6f7f2d /lldb/source/Utility/GDBRemote.cpp
parenta7e9059967c4bff83ae6c3b595828bbbc8aaf82e (diff)
downloadbcm5719-llvm-4e053ff1d188bae61f6f7d20c591a462b32a9992.tar.gz
bcm5719-llvm-4e053ff1d188bae61f6f7d20c591a462b32a9992.zip
[NFC] Move dumping into GDBRemotePacket
This moves the dumping logic from the GDBRemoteCommunicationHistory class into the GDBRemotePacket so that it can be reused from the reproducer command object. llvm-svn: 372028
Diffstat (limited to 'lldb/source/Utility/GDBRemote.cpp')
-rw-r--r--lldb/source/Utility/GDBRemote.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lldb/source/Utility/GDBRemote.cpp b/lldb/source/Utility/GDBRemote.cpp
index f0982922a89..85c4bc69a8d 100644
--- a/lldb/source/Utility/GDBRemote.cpp
+++ b/lldb/source/Utility/GDBRemote.cpp
@@ -51,6 +51,23 @@ void GDBRemotePacket::Serialize(raw_ostream &strm) const {
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);
OpenPOWER on IntegriCloud