diff options
-rw-r--r-- | lldb/include/lldb/Utility/Reproducer.h | 26 | ||||
-rw-r--r-- | lldb/source/API/SBDebugger.cpp | 2 | ||||
-rw-r--r-- | lldb/source/API/SBReproducer.cpp | 6 | ||||
-rw-r--r-- | lldb/source/API/SBReproducerPrivate.h | 10 | ||||
-rw-r--r-- | lldb/source/Initialization/SystemInitializerCommon.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 19 | ||||
-rw-r--r-- | lldb/source/Utility/Reproducer.cpp | 12 | ||||
-rw-r--r-- | lldb/unittests/Utility/ReproducerTest.cpp | 16 |
8 files changed, 41 insertions, 52 deletions
diff --git a/lldb/include/lldb/Utility/Reproducer.h b/lldb/include/lldb/Utility/Reproducer.h index cc50b26330d..ae424519401 100644 --- a/lldb/include/lldb/Utility/Reproducer.h +++ b/lldb/include/lldb/Utility/Reproducer.h @@ -75,21 +75,19 @@ public: const void *DynamicClassID() const override { return &ThisProviderT::ID; } - llvm::StringRef GetName() const override { return ThisProviderT::info::name; } - llvm::StringRef GetFile() const override { return ThisProviderT::info::file; } + llvm::StringRef GetName() const override { return ThisProviderT::Info::name; } + llvm::StringRef GetFile() const override { return ThisProviderT::Info::file; } protected: using ProviderBase::ProviderBase; // Inherit constructor. }; -struct FileInfo { - static const char *name; - static const char *file; -}; - class FileProvider : public Provider<FileProvider> { public: - typedef FileInfo info; + struct Info { + static const char *name; + static const char *file; + }; FileProvider(const FileSpec &directory) : Provider(directory), @@ -98,7 +96,7 @@ public: FileCollector &GetFileCollector() { return m_collector; } void Keep() override { - auto mapping = GetRoot().CopyByAppendingPathComponent(info::file); + auto mapping = GetRoot().CopyByAppendingPathComponent(Info::file); // Temporary files that are removed during execution can cause copy errors. if (auto ec = m_collector.CopyFiles(/*stop_on_error=*/false)) return; @@ -142,14 +140,12 @@ private: bool m_record; }; -struct CommandInfo { - static const char *name; - static const char *file; -}; - class CommandProvider : public Provider<CommandProvider> { public: - typedef CommandInfo info; + struct Info { + static const char *name; + static const char *file; + }; CommandProvider(const FileSpec &directory) : Provider(directory) {} diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index c60774c9fa7..7af83324e9f 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -67,7 +67,7 @@ public: if (!loader) return {}; - FileSpec file = loader->GetFile<repro::CommandInfo>(); + FileSpec file = loader->GetFile<repro::CommandProvider::Info>(); if (!file) return {}; diff --git a/lldb/source/API/SBReproducer.cpp b/lldb/source/API/SBReproducer.cpp index 5cd7802062b..439ee5a7046 100644 --- a/lldb/source/API/SBReproducer.cpp +++ b/lldb/source/API/SBReproducer.cpp @@ -136,7 +136,7 @@ const char *SBReproducer::Replay(const char *path) { return error.c_str(); } - FileSpec file = loader->GetFile<SBInfo>(); + FileSpec file = loader->GetFile<SBProvider::Info>(); if (!file) { error = "unable to get replay data from reproducer."; return error.c_str(); @@ -149,5 +149,5 @@ const char *SBReproducer::Replay(const char *path) { } char lldb_private::repro::SBProvider::ID = 0; -const char *SBInfo::name = "sbapi"; -const char *SBInfo::file = "sbapi.bin"; +const char *SBProvider::Info::name = "sbapi"; +const char *SBProvider::Info::file = "sbapi.bin"; diff --git a/lldb/source/API/SBReproducerPrivate.h b/lldb/source/API/SBReproducerPrivate.h index cb7c2d8f890..84b6ce967c0 100644 --- a/lldb/source/API/SBReproducerPrivate.h +++ b/lldb/source/API/SBReproducerPrivate.h @@ -30,14 +30,12 @@ public: SBRegistry(); }; -struct SBInfo { - static const char *name; - static const char *file; -}; - class SBProvider : public Provider<SBProvider> { public: - typedef SBInfo info; + struct Info { + static const char *name; + static const char *file; + }; SBProvider(const FileSpec &directory) : Provider(directory), diff --git a/lldb/source/Initialization/SystemInitializerCommon.cpp b/lldb/source/Initialization/SystemInitializerCommon.cpp index 75679560441..d805e0bdaa9 100644 --- a/lldb/source/Initialization/SystemInitializerCommon.cpp +++ b/lldb/source/Initialization/SystemInitializerCommon.cpp @@ -70,7 +70,7 @@ llvm::Error SystemInitializerCommon::Initialize() { // Initialize the file system. auto &r = repro::Reproducer::Instance(); if (repro::Loader *loader = r.GetLoader()) { - FileSpec vfs_mapping = loader->GetFile<FileInfo>(); + FileSpec vfs_mapping = loader->GetFile<FileProvider::Info>(); if (vfs_mapping) { if (llvm::Error e = FileSystem::Initialize(vfs_mapping)) return e; diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 194e79085a0..1c1cecda3b3 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -163,24 +163,19 @@ static const ProcessKDPPropertiesSP &GetGlobalPluginProperties() { return g_settings_sp; } -struct ProcessGDBRemoteInfo { - static const char *name; - static const char *file; -}; - -const char *ProcessGDBRemoteInfo::name = "gdb-remote"; -const char *ProcessGDBRemoteInfo::file = "gdb-remote.yaml"; - class ProcessGDBRemoteProvider : public repro::Provider<ProcessGDBRemoteProvider> { public: - typedef ProcessGDBRemoteInfo info; + struct Info { + static const char *name; + static const char *file; + }; ProcessGDBRemoteProvider(const FileSpec &directory) : Provider(directory) { } raw_ostream *GetHistoryStream() { - FileSpec history_file = GetRoot().CopyByAppendingPathComponent(info::file); + FileSpec history_file = GetRoot().CopyByAppendingPathComponent(Info::file); std::error_code EC; m_stream_up = llvm::make_unique<raw_fd_ostream>(history_file.GetPath(), EC, @@ -204,6 +199,8 @@ private: }; char ProcessGDBRemoteProvider::ID = 0; +const char *ProcessGDBRemoteProvider::Info::name = "gdb-remote"; +const char *ProcessGDBRemoteProvider::Info::file = "gdb-remote.yaml"; } // namespace @@ -3432,7 +3429,7 @@ Status ProcessGDBRemote::ConnectToReplayServer(repro::Loader *loader) { return Status("No loader provided."); // Construct replay history path. - FileSpec history_file = loader->GetFile<ProcessGDBRemoteInfo>(); + FileSpec history_file = loader->GetFile<ProcessGDBRemoteProvider::Info>(); if (!history_file) return Status("No provider for gdb-remote."); diff --git a/lldb/source/Utility/Reproducer.cpp b/lldb/source/Utility/Reproducer.cpp index f5ca39cddc7..6e893c1c95d 100644 --- a/lldb/source/Utility/Reproducer.cpp +++ b/lldb/source/Utility/Reproducer.cpp @@ -231,7 +231,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("-") + + std::string filename = (llvm::Twine(Info::name) + llvm::Twine("-") + llvm::Twine(i) + llvm::Twine(".txt")) .str(); auto recorder_or_error = @@ -252,7 +252,7 @@ void CommandProvider::Keep() { files.push_back(recorder->GetFilename().GetPath()); } - FileSpec file = GetRoot().CopyByAppendingPathComponent(info::file); + FileSpec file = GetRoot().CopyByAppendingPathComponent(Info::file); std::error_code ec; llvm::raw_fd_ostream os(file.GetPath(), ec, llvm::sys::fs::F_Text); if (ec) @@ -267,7 +267,7 @@ void ProviderBase::anchor() {} char ProviderBase::ID = 0; char FileProvider::ID = 0; char CommandProvider::ID = 0; -const char *FileInfo::name = "files"; -const char *FileInfo::file = "files.yaml"; -const char *CommandInfo::name = "command-interpreter"; -const char *CommandInfo::file = "command-interpreter.yaml"; +const char *FileProvider::Info::name = "files"; +const char *FileProvider::Info::file = "files.yaml"; +const char *CommandProvider::Info::name = "command-interpreter"; +const char *CommandProvider::Info::file = "command-interpreter.yaml"; diff --git a/lldb/unittests/Utility/ReproducerTest.cpp b/lldb/unittests/Utility/ReproducerTest.cpp index 027b9ddb28e..a89812a03cb 100644 --- a/lldb/unittests/Utility/ReproducerTest.cpp +++ b/lldb/unittests/Utility/ReproducerTest.cpp @@ -19,23 +19,21 @@ using namespace llvm; using namespace lldb_private; using namespace lldb_private::repro; -struct DummyInfo { - static const char *name; - static const char *file; -}; - -const char *DummyInfo::name = "dummy"; -const char *DummyInfo::file = "dummy.yaml"; - class DummyProvider : public repro::Provider<DummyProvider> { public: - typedef DummyInfo info; + struct Info { + static const char *name; + static const char *file; + }; DummyProvider(const FileSpec &directory) : Provider(directory) {} static char ID; }; +const char *DummyProvider::Info::name = "dummy"; +const char *DummyProvider::Info::file = "dummy.yaml"; + class DummyReproducer : public Reproducer { public: DummyReproducer() : Reproducer(){}; |