[Lldb-commits] [lldb] [llvm] [lldb] Add LLDB_BUG_REPORT_URL macro to allow a different URL for lldb bug reporting. (PR #78210)

Zequan Wu via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 15 12:45:33 PST 2024


https://github.com/ZequanWu created https://github.com/llvm/llvm-project/pull/78210

This allows release teams to customize the bug report url for lldb. It also removes unnecessary constructions of `llvm::PrettyStackTraceProgram` as it's already constructed inside `llvm::InitLLVM`.

>From 69623d789b2ef28c9df5ffe327b7fb1f9a1d975c Mon Sep 17 00:00:00 2001
From: Zequan Wu <zequanwu at google.com>
Date: Mon, 15 Jan 2024 15:37:29 -0500
Subject: [PATCH] [lldb] Add LLDB_BUG_REPORT_URL macro to allow a different URL
 for lldb bug reporting.

---
 lldb/include/lldb/Host/Config.h.cmake                   | 2 ++
 lldb/tools/driver/Driver.cpp                            | 3 +++
 lldb/tools/lldb-dap/lldb-dap.cpp                        | 4 +++-
 lldb/tools/lldb-server/lldb-server.cpp                  | 4 +++-
 llvm/CMakeLists.txt                                     | 2 ++
 llvm/utils/gn/secondary/lldb/include/lldb/Host/BUILD.gn | 1 +
 6 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/lldb/include/lldb/Host/Config.h.cmake b/lldb/include/lldb/Host/Config.h.cmake
index 14ce46f6559c8c..3defa454f6d420 100644
--- a/lldb/include/lldb/Host/Config.h.cmake
+++ b/lldb/include/lldb/Host/Config.h.cmake
@@ -55,4 +55,6 @@
 
 #cmakedefine LLDB_GLOBAL_INIT_DIRECTORY R"(${LLDB_GLOBAL_INIT_DIRECTORY})"
 
+#define LLDB_BUG_REPORT_URL "${LLDB_BUG_REPORT_URL}"
+
 #endif // #ifndef LLDB_HOST_CONFIG_H
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index f8058f868d53ff..c63ff0ff597e5c 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -18,6 +18,7 @@
 #include "lldb/API/SBStream.h"
 #include "lldb/API/SBStringList.h"
 #include "lldb/API/SBStructuredData.h"
+#include "lldb/Host/Config.h"
 
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Format.h"
@@ -746,6 +747,8 @@ int main(int argc, char const *argv[]) {
   // Setup LLVM signal handlers and make sure we call llvm_shutdown() on
   // destruction.
   llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
+  llvm::setBugReportMsg("PLEASE submit a bug report to " LLDB_BUG_REPORT_URL
+                        " and include the crash backtrace.\n");
 
   // Parse arguments.
   LLDBOptTable T;
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index e91b4115156b73..8c8e92146e63c0 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -47,6 +47,7 @@
 #include <thread>
 #include <vector>
 
+#include "lldb/Host/Config.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/ScopeExit.h"
@@ -3733,7 +3734,8 @@ int SetupStdoutStderrRedirection() {
 
 int main(int argc, char *argv[]) {
   llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
-  llvm::PrettyStackTraceProgram X(argc, argv);
+  llvm::setBugReportMsg("PLEASE submit a bug report to " LLDB_BUG_REPORT_URL
+                        " and include the crash backtrace.\n");
 
   llvm::SmallString<256> program_path(argv[0]);
   llvm::sys::fs::make_absolute(program_path);
diff --git a/lldb/tools/lldb-server/lldb-server.cpp b/lldb/tools/lldb-server/lldb-server.cpp
index 1808ffc0c97904..e2e6bfcd8645c7 100644
--- a/lldb/tools/lldb-server/lldb-server.cpp
+++ b/lldb/tools/lldb-server/lldb-server.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "SystemInitializerLLGS.h"
+#include "lldb/Host/Config.h"
 #include "lldb/Initialization/SystemLifetimeManager.h"
 #include "lldb/Version/Version.h"
 
@@ -50,7 +51,8 @@ static void terminate_debugger() { g_debugger_lifetime->Terminate(); }
 // main
 int main(int argc, char *argv[]) {
   llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
-  llvm::PrettyStackTraceProgram X(argc, argv);
+  llvm::setBugReportMsg("PLEASE submit a bug report to " LLDB_BUG_REPORT_URL
+                        " and include the crash backtrace.\n");
 
   int option_error = 0;
   const char *progname = argv[0];
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 1ecfb36ab41a3c..61ab69d237470f 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -346,6 +346,8 @@ set(PACKAGE_BUGREPORT "https://github.com/llvm/llvm-project/issues/")
 
 set(BUG_REPORT_URL "${PACKAGE_BUGREPORT}" CACHE STRING
   "Default URL where bug reports are to be submitted.")
+set(LLDB_BUG_REPORT_URL "${BUG_REPORT_URL}" CACHE STRING
+  "Default URL where lldb bug reports are to be submitted.")
 
 # Configure CPack.
 if(NOT DEFINED CPACK_PACKAGE_INSTALL_DIRECTORY)
diff --git a/llvm/utils/gn/secondary/lldb/include/lldb/Host/BUILD.gn b/llvm/utils/gn/secondary/lldb/include/lldb/Host/BUILD.gn
index b4f0f291144350..c46a916373ed01 100644
--- a/llvm/utils/gn/secondary/lldb/include/lldb/Host/BUILD.gn
+++ b/llvm/utils/gn/secondary/lldb/include/lldb/Host/BUILD.gn
@@ -25,6 +25,7 @@ write_cmake_config("Config") {
     "LLDB_GLOBAL_INIT_DIRECTORY=",
 
     "LLDB_PYTHON_HOME=",
+    "LLDB_BUG_REPORT_URL=https://github.com/llvm/llvm-project/issues/",
 
     "HAVE_LIBCOMPRESSION=",
   ]



More information about the lldb-commits mailing list