From 936c62422f5dc2d493978f1b99e2218016d8ea13 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Thu, 21 Feb 2019 22:26:16 +0000 Subject: [Reproducers] Initialize reproducers before initializing the debugger. As per the discussion on the mailing list: http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20190218/048007.html This commit implements option (3): > Go back to initializing the reproducer before the rest of the debugger. > The method wouldn't be instrumented and guarantee no other SB methods are > called or SB objects are constructed. The initialization then becomes part > of the replay. Differential revision: https://reviews.llvm.org/D58410 llvm-svn: 354631 --- lldb/source/Initialization/SystemInitializerCommon.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'lldb/source/Initialization/SystemInitializerCommon.cpp') diff --git a/lldb/source/Initialization/SystemInitializerCommon.cpp b/lldb/source/Initialization/SystemInitializerCommon.cpp index 173d48308c6..f69f5b0bf59 100644 --- a/lldb/source/Initialization/SystemInitializerCommon.cpp +++ b/lldb/source/Initialization/SystemInitializerCommon.cpp @@ -41,8 +41,7 @@ SystemInitializerCommon::SystemInitializerCommon() {} SystemInitializerCommon::~SystemInitializerCommon() {} -llvm::Error -SystemInitializerCommon::Initialize(const InitializerOptions &options) { +llvm::Error SystemInitializerCommon::Initialize() { #if defined(_MSC_VER) const char *disable_crash_dialog_var = getenv("LLDB_DISABLE_CRASH_DIALOG"); if (disable_crash_dialog_var && @@ -65,15 +64,12 @@ SystemInitializerCommon::Initialize(const InitializerOptions &options) { } #endif - // Initialize the reproducer. - ReproducerMode mode = ReproducerMode::Off; - if (options.reproducer_capture) - mode = ReproducerMode::Capture; - if (options.reproducer_replay) - mode = ReproducerMode::Replay; - - if (auto e = Reproducer::Initialize(mode, FileSpec(options.reproducer_path))) - return e; + // If the reproducer wasn't initialized before, we can safely assume it's + // off. + if (!Reproducer::Initialized()) { + if (auto e = Reproducer::Initialize(ReproducerMode::Off, llvm::None)) + return e; + } // Initialize the file system. auto &r = repro::Reproducer::Instance(); -- cgit v1.2.3