Skip to content

Commit 1617c8d

Browse files
authored
[lldb] Add LLDB_BUG_REPORT_URL macro to allow a different URL for lldb bug reporting. (llvm#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`.
1 parent 9a402d6 commit 1617c8d

File tree

6 files changed

+14
-2
lines changed

6 files changed

+14
-2
lines changed

lldb/include/lldb/Host/Config.h.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,6 @@
5555

5656
#cmakedefine LLDB_GLOBAL_INIT_DIRECTORY R"(${LLDB_GLOBAL_INIT_DIRECTORY})"
5757

58+
#define LLDB_BUG_REPORT_URL "${LLDB_BUG_REPORT_URL}"
59+
5860
#endif // #ifndef LLDB_HOST_CONFIG_H

lldb/tools/driver/Driver.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "lldb/API/SBStream.h"
1919
#include "lldb/API/SBStringList.h"
2020
#include "lldb/API/SBStructuredData.h"
21+
#include "lldb/Host/Config.h"
2122

2223
#include "llvm/ADT/StringRef.h"
2324
#include "llvm/Support/Format.h"
@@ -746,6 +747,8 @@ int main(int argc, char const *argv[]) {
746747
// Setup LLVM signal handlers and make sure we call llvm_shutdown() on
747748
// destruction.
748749
llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
750+
llvm::setBugReportMsg("PLEASE submit a bug report to " LLDB_BUG_REPORT_URL
751+
" and include the crash backtrace.\n");
749752

750753
// Parse arguments.
751754
LLDBOptTable T;

lldb/tools/lldb-dap/lldb-dap.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include <thread>
4848
#include <vector>
4949

50+
#include "lldb/Host/Config.h"
5051
#include "llvm/ADT/ArrayRef.h"
5152
#include "llvm/ADT/DenseMap.h"
5253
#include "llvm/ADT/ScopeExit.h"
@@ -3733,7 +3734,8 @@ int SetupStdoutStderrRedirection() {
37333734

37343735
int main(int argc, char *argv[]) {
37353736
llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
3736-
llvm::PrettyStackTraceProgram X(argc, argv);
3737+
llvm::setBugReportMsg("PLEASE submit a bug report to " LLDB_BUG_REPORT_URL
3738+
" and include the crash backtrace.\n");
37373739

37383740
llvm::SmallString<256> program_path(argv[0]);
37393741
llvm::sys::fs::make_absolute(program_path);

lldb/tools/lldb-server/lldb-server.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "SystemInitializerLLGS.h"
10+
#include "lldb/Host/Config.h"
1011
#include "lldb/Initialization/SystemLifetimeManager.h"
1112
#include "lldb/Version/Version.h"
1213

@@ -50,7 +51,8 @@ static void terminate_debugger() { g_debugger_lifetime->Terminate(); }
5051
// main
5152
int main(int argc, char *argv[]) {
5253
llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
53-
llvm::PrettyStackTraceProgram X(argc, argv);
54+
llvm::setBugReportMsg("PLEASE submit a bug report to " LLDB_BUG_REPORT_URL
55+
" and include the crash backtrace.\n");
5456

5557
int option_error = 0;
5658
const char *progname = argv[0];

llvm/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,8 @@ set(PACKAGE_BUGREPORT "https://github.com/llvm/llvm-project/issues/")
346346

347347
set(BUG_REPORT_URL "${PACKAGE_BUGREPORT}" CACHE STRING
348348
"Default URL where bug reports are to be submitted.")
349+
set(LLDB_BUG_REPORT_URL "${BUG_REPORT_URL}" CACHE STRING
350+
"Default URL where lldb bug reports are to be submitted.")
349351

350352
# Configure CPack.
351353
if(NOT DEFINED CPACK_PACKAGE_INSTALL_DIRECTORY)

llvm/utils/gn/secondary/lldb/include/lldb/Host/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ write_cmake_config("Config") {
2525
"LLDB_GLOBAL_INIT_DIRECTORY=",
2626

2727
"LLDB_PYTHON_HOME=",
28+
"LLDB_BUG_REPORT_URL=https://github.com/llvm/llvm-project/issues/",
2829

2930
"HAVE_LIBCOMPRESSION=",
3031
]

0 commit comments

Comments
 (0)