summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectReproducer.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-12-07 15:28:30 -0800
committerJonas Devlieghere <jonas@devlieghere.com>2019-12-10 11:16:52 -0800
commite81268d03e73aef4f9c7bd8ece8ad02f5b017dcf (patch)
treecd875ff5d4d81e0f45178c3dfc1e32a7e3950de0 /lldb/source/Commands/CommandObjectReproducer.cpp
parent21b43885b81a6180e7231e575b5433202582f2fb (diff)
downloadbcm5719-llvm-e81268d03e73aef4f9c7bd8ece8ad02f5b017dcf.tar.gz
bcm5719-llvm-e81268d03e73aef4f9c7bd8ece8ad02f5b017dcf.zip
[lldb/Reproducers] Support multiple GDB remotes
When running the test suite with always capture on, a handful of tests are failing because they have multiple targets and therefore multiple GDB remote connections. The current reproducer infrastructure is capable of dealing with that. This patch reworks the GDB remote provider to support multiple GDB remote connections, similar to how the reproducers support shadowing multiple command interpreter inputs. The provider now keeps a list of packet recorders which deal with a single GDB remote connection. During replay we rely on the order of creation to match the number of packets to the GDB remote connection. Differential revision: https://reviews.llvm.org/D71105
Diffstat (limited to 'lldb/source/Commands/CommandObjectReproducer.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectReproducer.cpp47
1 files changed, 25 insertions, 22 deletions
diff --git a/lldb/source/Commands/CommandObjectReproducer.cpp b/lldb/source/Commands/CommandObjectReproducer.cpp
index a4c69db492d..0f05c564a0d 100644
--- a/lldb/source/Commands/CommandObjectReproducer.cpp
+++ b/lldb/source/Commands/CommandObjectReproducer.cpp
@@ -407,10 +407,9 @@ protected:
return true;
}
case eReproducerProviderCommands: {
- // Create a new command loader.
- std::unique_ptr<repro::CommandLoader> command_loader =
- repro::CommandLoader::Create(loader);
- if (!command_loader) {
+ std::unique_ptr<repro::MultiLoader<repro::CommandProvider>> multi_loader =
+ repro::MultiLoader<repro::CommandProvider>::Create(loader);
+ if (!multi_loader) {
SetError(result,
make_error<StringError>(llvm::inconvertibleErrorCode(),
"Unable to create command loader."));
@@ -418,9 +417,8 @@ protected:
}
// Iterate over the command files and dump them.
- while (true) {
- llvm::Optional<std::string> command_file =
- command_loader->GetNextFile();
+ llvm::Optional<std::string> command_file;
+ while ((command_file = multi_loader->GetNextFile())) {
if (!command_file)
break;
@@ -436,24 +434,29 @@ protected:
return true;
}
case eReproducerProviderGDB: {
- 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::unique_ptr<repro::MultiLoader<repro::GDBRemoteProvider>>
+ multi_loader =
+ repro::MultiLoader<repro::GDBRemoteProvider>::Create(loader);
+ llvm::Optional<std::string> gdb_file;
+ while ((gdb_file = multi_loader->GetNextFile())) {
+ auto error_or_file = MemoryBuffer::getFile(*gdb_file);
+ 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;
+ std::vector<GDBRemotePacket> packets;
+ yaml::Input yin((*error_or_file)->getBuffer());
+ yin >> packets;
- if (auto err = yin.error()) {
- SetError(result, errorCodeToError(err));
- return false;
- }
+ if (auto err = yin.error()) {
+ SetError(result, errorCodeToError(err));
+ return false;
+ }
- for (GDBRemotePacket &packet : packets) {
- packet.Dump(result.GetOutputStream());
+ for (GDBRemotePacket &packet : packets) {
+ packet.Dump(result.GetOutputStream());
+ }
}
result.SetStatus(eReturnStatusSuccessFinishResult);
OpenPOWER on IntegriCloud