[clang] [clang-repl]: Print stack-trace on crash (PR #117896)

via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 27 07:43:07 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Mészáros Gergely (Maetveis)

<details>
<summary>Changes</summary>

Call `llvm::sys::PrintStackTraceOnErrorSignal` at the start of main to
1. Print a strack trace on crash
2. Disable the assertion failed popup in Windows Debug Builds

Other tools (for example clang-check or clang-query) already do this.

This fixes debug build bots hanging (waiting for the popup to be dismissed) and ultimately getting terminated due to timeout. See https://lab.llvm.org/buildbot/#/builders/81/builds/2646/steps/6/logs/stdio for an example of the hang

---
Full diff: https://github.com/llvm/llvm-project/pull/117896.diff


1 Files Affected:

- (modified) clang/tools/clang-repl/ClangRepl.cpp (+2) 


``````````diff
diff --git a/clang/tools/clang-repl/ClangRepl.cpp b/clang/tools/clang-repl/ClangRepl.cpp
index 08c54e6cafa901..7af8e4f25d99e7 100644
--- a/clang/tools/clang-repl/ClangRepl.cpp
+++ b/clang/tools/clang-repl/ClangRepl.cpp
@@ -139,6 +139,8 @@ ReplListCompleter::operator()(llvm::StringRef Buffer, size_t Pos,
 
 llvm::ExitOnError ExitOnErr;
 int main(int argc, const char **argv) {
+  llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
+
   ExitOnErr.setBanner("clang-repl: ");
   llvm::cl::ParseCommandLineOptions(argc, argv);
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/117896


More information about the cfe-commits mailing list