summaryrefslogtreecommitdiffstats
path: root/lldb/tools/driver/Driver.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-02-06 18:57:42 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-02-06 18:57:42 +0000
commit58947cf854d6c1b18ac10119105e95e4f223af80 (patch)
treebac0c66bb5267239984e2f325c9e9788d11ab738 /lldb/tools/driver/Driver.cpp
parent7c77044a38114847a0e104a93a37bc47ee928a46 (diff)
downloadbcm5719-llvm-58947cf854d6c1b18ac10119105e95e4f223af80.tar.gz
bcm5719-llvm-58947cf854d6c1b18ac10119105e95e4f223af80.zip
[Reproducers] SBReproducer framework: Capture & Replay
This is part two of the reproducer instrumentation framework. It contains the code to capture and replay function calls. The main user of this framework will be the SB API layer. For all the details refer to the RFC on the mailing list: http://lists.llvm.org/pipermail/lldb-dev/2019-January/014530.html Differential revision: https://reviews.llvm.org/D56322 llvm-svn: 353324
Diffstat (limited to 'lldb/tools/driver/Driver.cpp')
-rw-r--r--lldb/tools/driver/Driver.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index 8d7decde776..45effa4e518 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -13,6 +13,7 @@
#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBHostOS.h"
#include "lldb/API/SBLanguageRuntime.h"
+#include "lldb/API/SBReproducer.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBStringList.h"
@@ -888,8 +889,10 @@ main(int argc, char const *argv[])
<< '\n';
}
- SBInitializerOptions options;
+ // Remember if we're in replay mode for later.
+ bool replay = false;
+ SBInitializerOptions options;
if (auto *arg = input_args.getLastArg(OPT_capture)) {
auto arg_value = arg->getValue();
options.SetReproducerPath(arg_value);
@@ -900,6 +903,7 @@ main(int argc, char const *argv[])
auto arg_value = arg->getValue();
options.SetReplayReproducer(true);
options.SetReproducerPath(arg_value);
+ replay = true;
}
SBError error = SBDebugger::Initialize(options);
@@ -909,6 +913,14 @@ main(int argc, char const *argv[])
return 1;
}
+ if (replay) {
+ SBReproducer reproducer;
+ if (!reproducer.Replay()) {
+ WithColor::error() << "something went wrong running the reporducer.\n";
+ }
+ return 0;
+ }
+
SBHostOS::ThreadCreated("<lldb.driver.main-thread>");
signal(SIGINT, sigint_handler);
OpenPOWER on IntegriCloud