diff options
| author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-12-07 15:28:30 -0800 |
|---|---|---|
| committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-12-10 11:16:52 -0800 |
| commit | e81268d03e73aef4f9c7bd8ece8ad02f5b017dcf (patch) | |
| tree | cd875ff5d4d81e0f45178c3dfc1e32a7e3950de0 /lldb/source/Utility/Reproducer.cpp | |
| parent | 21b43885b81a6180e7231e575b5433202582f2fb (diff) | |
| download | llvm-e81268d03e73aef4f9c7bd8ece8ad02f5b017dcf.tar.gz llvm-e81268d03e73aef4f9c7bd8ece8ad02f5b017dcf.tar.bz2 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/Utility/Reproducer.cpp')
| -rw-r--r-- | lldb/source/Utility/Reproducer.cpp | 48 |
1 files changed, 1 insertions, 47 deletions
diff --git a/lldb/source/Utility/Reproducer.cpp b/lldb/source/Utility/Reproducer.cpp index 8a28e9b13675..b11e1a577ed2 100644 --- a/lldb/source/Utility/Reproducer.cpp +++ b/lldb/source/Utility/Reproducer.cpp @@ -255,7 +255,7 @@ DataRecorder::Create(const FileSpec &filename) { DataRecorder *CommandProvider::GetNewDataRecorder() { std::size_t i = m_data_recorders.size() + 1; std::string filename = (llvm::Twine(Info::name) + llvm::Twine("-") + - llvm::Twine(i) + llvm::Twine(".txt")) + llvm::Twine(i) + llvm::Twine(".yaml")) .str(); auto recorder_or_error = DataRecorder::Create(GetRoot().CopyByAppendingPathComponent(filename)); @@ -304,53 +304,9 @@ void WorkingDirectoryProvider::Keep() { os << m_cwd << "\n"; } -llvm::raw_ostream *ProcessGDBRemoteProvider::GetHistoryStream() { - FileSpec history_file = GetRoot().CopyByAppendingPathComponent(Info::file); - - std::error_code EC; - m_stream_up = std::make_unique<raw_fd_ostream>(history_file.GetPath(), EC, - sys::fs::OpenFlags::OF_Text); - return m_stream_up.get(); -} - -std::unique_ptr<CommandLoader> CommandLoader::Create(Loader *loader) { - if (!loader) - return {}; - - FileSpec file = loader->GetFile<repro::CommandProvider::Info>(); - if (!file) - return {}; - - auto error_or_file = llvm::MemoryBuffer::getFile(file.GetPath()); - if (auto err = error_or_file.getError()) - return {}; - - std::vector<std::string> files; - llvm::yaml::Input yin((*error_or_file)->getBuffer()); - yin >> files; - - if (auto err = yin.error()) - return {}; - - for (auto &file : files) { - FileSpec absolute_path = - loader->GetRoot().CopyByAppendingPathComponent(file); - file = absolute_path.GetPath(); - } - - return std::make_unique<CommandLoader>(std::move(files)); -} - -llvm::Optional<std::string> CommandLoader::GetNextFile() { - if (m_index >= m_files.size()) - return {}; - return m_files[m_index++]; -} - void ProviderBase::anchor() {} char CommandProvider::ID = 0; char FileProvider::ID = 0; -char ProcessGDBRemoteProvider::ID = 0; char ProviderBase::ID = 0; char VersionProvider::ID = 0; char WorkingDirectoryProvider::ID = 0; @@ -358,8 +314,6 @@ const char *CommandProvider::Info::file = "command-interpreter.yaml"; const char *CommandProvider::Info::name = "command-interpreter"; const char *FileProvider::Info::file = "files.yaml"; const char *FileProvider::Info::name = "files"; -const char *ProcessGDBRemoteProvider::Info::file = "gdb-remote.yaml"; -const char *ProcessGDBRemoteProvider::Info::name = "gdb-remote"; const char *VersionProvider::Info::file = "version.txt"; const char *VersionProvider::Info::name = "version"; const char *WorkingDirectoryProvider::Info::file = "cwd.txt"; |
