This revision was automatically updated to reflect the committed changes. Closed by commit rL372046: [Reproducer] Implement dumping packets. (authored by JDevlieghere, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D67636?vs=220395&id=220403#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67636/new/ https://reviews.llvm.org/D67636 Files: lldb/trunk/lit/Reproducer/TestDump.test lldb/trunk/source/Commands/CommandObjectReproducer.cpp Index: lldb/trunk/source/Commands/CommandObjectReproducer.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectReproducer.cpp +++ lldb/trunk/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 @@ 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; } Index: lldb/trunk/lit/Reproducer/TestDump.test =================================================================== --- lldb/trunk/lit/Reproducer/TestDump.test +++ lldb/trunk/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
Index: lldb/trunk/source/Commands/CommandObjectReproducer.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectReproducer.cpp +++ lldb/trunk/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 @@ 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; } Index: lldb/trunk/lit/Reproducer/TestDump.test =================================================================== --- lldb/trunk/lit/Reproducer/TestDump.test +++ lldb/trunk/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
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits