[PATCH] D74324: Tools emit the bug report URL on crash
Owen Reynolds via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 25 04:50:07 PDT 2020
gbreynoo updated this revision to Diff 252539.
gbreynoo added a comment.
Apologies James, this fixes the case issues.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74324/new/
https://reviews.llvm.org/D74324
Files:
clang/lib/Driver/Driver.cpp
clang/tools/driver/driver.cpp
llvm/include/llvm/Support/PrettyStackTrace.h
llvm/lib/Support/PrettyStackTrace.cpp
Index: llvm/lib/Support/PrettyStackTrace.cpp
===================================================================
--- llvm/lib/Support/PrettyStackTrace.cpp
+++ llvm/lib/Support/PrettyStackTrace.cpp
@@ -142,9 +142,17 @@
static CrashHandlerStringStorage crashHandlerStringStorage;
#endif
+static const char *BugReportMsg =
+ "PLEASE submit a bug report to " BUG_REPORT_URL
+ " and include the crash backtrace.\n";
+
+void llvm::setBugReportMsg(const char *Msg) { BugReportMsg = Msg; }
+
/// This callback is run if a fatal signal is delivered to the process, it
/// prints the pretty stack trace.
static void CrashHandler(void *) {
+ errs() << BugReportMsg ;
+
#ifndef __APPLE__
// On non-apple systems, just emit the crash stack trace to stderr.
PrintCurStackTrace(errs());
Index: llvm/include/llvm/Support/PrettyStackTrace.h
===================================================================
--- llvm/include/llvm/Support/PrettyStackTrace.h
+++ llvm/include/llvm/Support/PrettyStackTrace.h
@@ -37,6 +37,10 @@
/// \see PrettyStackTraceEntry
void EnablePrettyStackTraceOnSigInfoForThisThread(bool ShouldEnable = true);
+ /// Replaces the generic bug report message that is output upon
+ /// a crash.
+ void setBugReportMsg(const char *Msg);
+
/// PrettyStackTraceEntry - This class is used to represent a frame of the
/// "pretty" stack trace that is dumped when a program crashes. You can define
/// subclasses of this and declare them on the program stack: when they are
Index: clang/tools/driver/driver.cpp
===================================================================
--- clang/tools/driver/driver.cpp
+++ clang/tools/driver/driver.cpp
@@ -38,6 +38,7 @@
#include "llvm/Support/Host.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/Path.h"
+#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/Program.h"
#include "llvm/Support/Regex.h"
@@ -342,6 +343,9 @@
int main(int argc_, const char **argv_) {
noteBottomOfStack();
llvm::InitLLVM X(argc_, argv_);
+ llvm::setBugReportMsg("PLEASE submit a bug report to " BUG_REPORT_URL
+ " and include the crash backtrace, preprocessed "
+ "source, and associated run script.\n");
SmallVector<const char *, 256> argv(argv_, argv_ + argc_);
if (llvm::sys::Process::FixupStandardFileDescriptors())
Index: clang/lib/Driver/Driver.cpp
===================================================================
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -1267,10 +1267,6 @@
// Print the version of the compiler.
PrintVersion(C, llvm::errs());
- Diag(clang::diag::note_drv_command_failed_diag_msg)
- << "PLEASE submit a bug report to " BUG_REPORT_URL " and include the "
- "crash backtrace, preprocessed source, and associated run script.";
-
// Suppress driver output and emit preprocessor output to temp file.
Mode = CPPMode;
CCGenDiagnostics = true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74324.252539.patch
Type: text/x-patch
Size: 3008 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200325/dd549939/attachment.bin>
More information about the llvm-commits
mailing list