[Lldb-commits] [PATCH] D90987: [lldb] Avoid confusing crashes during reproducer replay when initialization failed

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 9 08:50:19 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGb31d78794998: [lldb] Avoid confusing reproducer crashes when initialization failed (authored by JDevlieghere).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D90987?vs=303581&id=303893#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90987/new/

https://reviews.llvm.org/D90987

Files:
  lldb/source/API/SystemInitializerFull.cpp


Index: lldb/source/API/SystemInitializerFull.cpp
===================================================================
--- lldb/source/API/SystemInitializerFull.cpp
+++ 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;
 
 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();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90987.303893.patch
Type: text/x-patch
Size: 1228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201109/1511e02c/attachment-0001.bin>


More information about the lldb-commits mailing list