summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-09-16 23:31:06 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-09-16 23:31:06 +0000
commit8fc8d3fe0108479ce22234ec829fc7ee2b8f0bd2 (patch)
treee29d9480eced3fc99767c24d30589d0400bd67da
parent3cabfb344b820586bb7c43212340f64246cde8eb (diff)
downloadbcm5719-llvm-8fc8d3fe0108479ce22234ec829fc7ee2b8f0bd2.tar.gz
bcm5719-llvm-8fc8d3fe0108479ce22234ec829fc7ee2b8f0bd2.zip
[Reproducer] Implement dumping packets.
This patch completes the dump functionality by adding support for dumping a reproducer's GDB remote packets. Differential revision: https://reviews.llvm.org/D67636 llvm-svn: 372046
-rw-r--r--lldb/lit/Reproducer/TestDump.test4
-rw-r--r--lldb/source/Commands/CommandObjectReproducer.cpp24
2 files changed, 25 insertions, 3 deletions
diff --git a/lldb/lit/Reproducer/TestDump.test b/lldb/lit/Reproducer/TestDump.test
index 472c563d7f2..e378043f9c1 100644
--- a/lldb/lit/Reproducer/TestDump.test
+++ b/lldb/lit/Reproducer/TestDump.test
@@ -18,4 +18,8 @@
# COMMANDS: target create
# COMMANDS: command source
+# RUN: %lldb -b -o 'reproducer dump -p gdb -f %t.repro' | FileCheck %s --check-prefix GDB
+# GDB: send packet: $QStartNoAckMode#b0
+# GDB: read packet: $OK#9a
+
# RUN: %lldb --replay %t.repro | FileCheck %s --check-prefix FILES
diff --git a/lldb/source/Commands/CommandObjectReproducer.cpp b/lldb/source/Commands/CommandObjectReproducer.cpp
index fcfeb58751e..404702d3640 100644
--- a/lldb/source/Commands/CommandObjectReproducer.cpp
+++ b/lldb/source/Commands/CommandObjectReproducer.cpp
@@ -10,6 +10,7 @@
#include "lldb/Host/OptionParser.h"
#include "lldb/Utility/Reproducer.h"
+#include "lldb/Utility/GDBRemote.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
@@ -310,9 +311,26 @@ protected:
return true;
}
case eReproducerProviderGDB: {
- // FIXME: Dumping the GDB remote packets means moving the
- // (de)serialization code out of the GDB-remote plugin.
- result.AppendMessage("Dumping GDB remote packets isn't implemented yet.");
+ FileSpec gdb_file = loader->GetFile<ProcessGDBRemoteProvider::Info>();
+ auto error_or_file = MemoryBuffer::getFile(gdb_file.GetPath());
+ if (auto err = error_or_file.getError()) {
+ SetError(result, errorCodeToError(err));
+ return false;
+ }
+
+ std::vector<GDBRemotePacket> packets;
+ yaml::Input yin((*error_or_file)->getBuffer());
+ yin >> packets;
+
+ if (auto err = yin.error()) {
+ SetError(result, errorCodeToError(err));
+ return false;
+ }
+
+ for (GDBRemotePacket& packet : packets) {
+ packet.Dump(result.GetOutputStream());
+ }
+
result.SetStatus(eReturnStatusSuccessFinishResult);
return true;
}
OpenPOWER on IntegriCloud