diff options
Diffstat (limited to 'lldb/source/Commands/CommandObjectReproducer.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectReproducer.cpp | 47 |
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); |