diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-11-27 22:11:02 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-11-27 22:11:02 +0000 |
commit | 68ed93d2528f28e04c8b96dde59225d4cc87ff3a (patch) | |
tree | 499ebb8bf3f761095801a427d2572ae8b87b73a3 /lldb/source/Core/Debugger.cpp | |
parent | a116602475314e0b3e7e4e28bd7057df1937b761 (diff) | |
download | bcm5719-llvm-68ed93d2528f28e04c8b96dde59225d4cc87ff3a.tar.gz bcm5719-llvm-68ed93d2528f28e04c8b96dde59225d4cc87ff3a.zip |
[Reproducers] Improve reproducer API and add unit tests.
When I landed the initial reproducer framework I knew there were some
things that needed improvement. Rather than bundling it with a patch
that adds more functionality I split it off into this patch. I also
think the API is stable enough to add unit testing, which is included in
this patch as well.
Other improvements include:
- Refactor how we initialize the loader and generator.
- Improve naming consistency: capture and replay seems the least ambiguous.
- Index providers by name and make sure there's only one of each.
- Add convenience methods for creating and accessing providers.
Differential revision: https://reviews.llvm.org/D54616
llvm-svn: 347716
Diffstat (limited to 'lldb/source/Core/Debugger.cpp')
-rw-r--r-- | lldb/source/Core/Debugger.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 19b476bd1f6..1f12dc4dbd6 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -418,17 +418,22 @@ llvm::StringRef Debugger::GetReproducerPath() const { return r.GetReproducerPath().GetCString(); } -void Debugger::SetReproducerPath(llvm::StringRef p) { - auto &r = repro::Reproducer::Instance(); - if (auto e = r.SetReproducerPath(FileSpec(p))) - llvm::consumeError(std::move(e)); +llvm::Error Debugger::SetReproducerReplay(llvm::StringRef p) { + llvm::Optional<FileSpec> arg = llvm::None; + + if (!p.empty()) + arg = FileSpec(p); + + return repro::Reproducer::Instance().SetReplay(arg); } llvm::Error Debugger::SetReproducerCapture(bool b) { - auto &r = repro::Reproducer::Instance(); - if (auto e = r.SetGenerateReproducer(b)) - return e; - return llvm::Error::success(); + llvm::Optional<FileSpec> arg = llvm::None; + + if (b) + arg = HostInfo::GetReproducerTempDir(); + + return repro::Reproducer::Instance().SetCapture(arg); } const FormatEntity::Entry *Debugger::GetThreadFormat() const { |