diff options
Diffstat (limited to 'lldb/source/API')
-rw-r--r-- | lldb/source/API/SBReproducer.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lldb/source/API/SBReproducer.cpp b/lldb/source/API/SBReproducer.cpp index d50d95ebb54..1107161a419 100644 --- a/lldb/source/API/SBReproducer.cpp +++ b/lldb/source/API/SBReproducer.cpp @@ -22,8 +22,8 @@ #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBHostOS.h" #include "lldb/API/SBReproducer.h" - #include "lldb/Host/FileSystem.h" +#include "lldb/lldb-private.h" using namespace lldb; using namespace lldb_private; @@ -124,7 +124,7 @@ const char *SBReproducer::Capture(const char *path) { return nullptr; } -const char *SBReproducer::Replay(const char *path) { +const char *SBReproducer::Replay(const char *path, bool skip_version_check) { static std::string error; if (auto e = Reproducer::Initialize(ReproducerMode::Replay, FileSpec(path))) { error = llvm::toString(std::move(e)); @@ -137,6 +137,22 @@ const char *SBReproducer::Replay(const char *path) { return error.c_str(); } + if (!skip_version_check) { + llvm::Expected<std::string> version = loader->LoadBuffer<VersionProvider>(); + if (!version) { + error = llvm::toString(version.takeError()); + return error.c_str(); + } + if (lldb_private::GetVersion() != llvm::StringRef(*version).rtrim()) { + error = "reproducer capture and replay version don't match:\n"; + error.append("reproducer captured with:\n"); + error.append(*version); + error.append("reproducer replayed with:\n"); + error.append(lldb_private::GetVersion()); + return error.c_str(); + } + } + FileSpec file = loader->GetFile<SBProvider::Info>(); if (!file) { error = "unable to get replay data from reproducer."; |