diff options
author | Noel Grandin <noel@peralex.com> | 2021-08-02 12:29:57 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-02 13:52:15 +0200 |
commit | 0e883d6dbee8d72257f77605ae0c8a1d5bfbf044 (patch) | |
tree | 1caeb4f70ab0caabb35bf9bf9c587dc53caf4a35 /sal/cppunittester | |
parent | 914762f837cd4c1ff3a2d55284fdd631993e5e92 (diff) |
display stack trace on assert for windows jenkins builds
Change-Id: I1c23fda56c013eeeaf4ad1099c164d6d1146f68b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119851
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal/cppunittester')
-rw-r--r-- | sal/cppunittester/cppunittester.cxx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx index d2727f1cd98e..f5f34c802c83 100644 --- a/sal/cppunittester/cppunittester.cxx +++ b/sal/cppunittester/cppunittester.cxx @@ -25,6 +25,8 @@ #endif #if defined(_WIN32) && defined(_DEBUG) #include "dbghelp.h" +#include <sal/backtrace.hxx> +#include <signal.h> #endif #ifdef UNX @@ -576,8 +578,19 @@ LONG WINAPI ExpFilter(EXCEPTION_POINTERS* ex) return EXCEPTION_EXECUTE_HANDLER; } +void AbortSignalHandler(int signal) +{ + if (signal == SIGABRT) { + std::unique_ptr<sal::BacktraceState> bs = sal::backtrace_get(50); + SAL_WARN("sal", "CAUGHT SIGABRT:\n" << sal::backtrace_to_string(bs.get())); + } +} + SAL_IMPLEMENT_MAIN() { + // catch the kind of signal that is thrown when an assert fails, and log a stacktrace + signal(SIGABRT, AbortSignalHandler); + bool ok = false; // This magic kind of Windows-specific exception handling has to be in its own function // because it cannot be in a function that has objects with destructors. |