[Lldb-commits] [lldb] b31d787 - [lldb] Avoid confusing reproducer crashes when initialization failed
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Mon Nov 9 08:50:19 PST 2020
Author: Jonas Devlieghere
Date: 2020-11-09T08:50:10-08:00
New Revision: b31d78794998d313efe80472670602d0388fdbfa
URL: https://github.com/llvm/llvm-project/commit/b31d78794998d313efe80472670602d0388fdbfa
DIFF: https://github.com/llvm/llvm-project/commit/b31d78794998d313efe80472670602d0388fdbfa.diff
LOG: [lldb] Avoid confusing reproducer crashes when initialization failed
During active replay, the ::Initialize call is replayed like any other
SB API call and the return value is ignored. Since we can't intercept
this, we terminate here before the uninitialized debugger inevitably
crashes.
Differential revision: https://reviews.llvm.org/D90987
Added:
Modified:
lldb/source/API/SystemInitializerFull.cpp
Removed:
################################################################################
diff --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp
index a9723f7547b9..cd5b464db04e 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -15,6 +15,7 @@
#include "lldb/Initialization/SystemInitializerCommon.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Target/ProcessTrace.h"
+#include "lldb/Utility/Reproducer.h"
#include "lldb/Utility/Timer.h"
#include "llvm/Support/TargetSelect.h"
@@ -34,8 +35,16 @@ SystemInitializerFull::SystemInitializerFull() = default;
SystemInitializerFull::~SystemInitializerFull() = default;
llvm::Error SystemInitializerFull::Initialize() {
- if (auto e = SystemInitializerCommon::Initialize())
- return e;
+ llvm::Error error = SystemInitializerCommon::Initialize();
+ if (error) {
+ // During active replay, the ::Initialize call is replayed like any other
+ // SB API call and the return value is ignored. Since we can't intercept
+ // this, we terminate here before the uninitialized debugger inevitably
+ // crashes.
+ if (repro::Reproducer::Instance().IsReplaying())
+ llvm::report_fatal_error("system initialization failed");
+ return error;
+ }
// Initialize LLVM and Clang
llvm::InitializeAllTargets();
More information about the lldb-commits
mailing list