Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

Maetveis
Copy link
Contributor

@Maetveis Maetveis commented Nov 27, 2024

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 on windows 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

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.
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Nov 27, 2024
@llvmbot
Copy link
Member

llvmbot commented Nov 27, 2024

@llvm/pr-subscribers-clang

Author: Mészáros Gergely (Maetveis)

Changes

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 --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);
 

Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Do you have commit access or shall I land this change for you?

@Maetveis
Copy link
Contributor Author

LGTM! Do you have commit access or shall I land this change for you?

Thanks that was extremely quick. I have access, but I'll wait for the CI to finish to be sure.

@Maetveis Maetveis merged commit 8358437 into llvm:main Nov 27, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants