diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-03-18 12:55:48 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-03-18 14:47:17 +0100 |
commit | 74f4f7a9c7a836c7b2a49bf3d61e7e6303071ee9 (patch) | |
tree | cd0e985590b39166627a1c5b09a6946256162cdc /sal/osl | |
parent | 8b58007fc5a619012b58a1f8d8731a753bc1c40d (diff) |
use our internal backtrace API for signal faults
so we get nice stacktraces with function names and line numbers on
jenkins
Change-Id: Id1bfee014d713ead501e5164e5206d9189ec72a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164967
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal/osl')
-rw-r--r-- | sal/osl/unx/signal.cxx | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sal/osl/unx/signal.cxx b/sal/osl/unx/signal.cxx index 50c260f9d592..0e05b40a656b 100644 --- a/sal/osl/unx/signal.cxx +++ b/sal/osl/unx/signal.cxx @@ -33,6 +33,7 @@ #include <osl/signal.h> #include <sal/log.hxx> #include <sal/macros.h> +#include <sal/backtrace.hxx> #define ACT_IGNORE 1 #define ACT_EXIT 2 @@ -280,8 +281,7 @@ namespace { void printStack(int sig) { - void *buffer[MAX_STACK_FRAMES]; - int size = backtrace( buffer, SAL_N_ELEMENTS(buffer) ); + std::unique_ptr<sal::BacktraceState> bs = sal::backtrace_get(MAX_STACK_FRAMES); fprintf( stderr, "\n\nFatal exception: Signal %d\n", sig ); @@ -289,11 +289,8 @@ void printStack(int sig) fprintf( stderr, "Please turn on Enable Crash Reporting and\nAutomatic Display of Crashlogs in the Console application\n" ); #endif - if ( size > 0 ) - { - fputs( "Stack:\n", stderr ); - backtrace_symbols_fd( buffer, size, fileno(stderr) ); - } + fputs( "Stack:\n", stderr ); + fprintf( stderr, "%s\n", OUStringToOString( sal::backtrace_to_string(bs.get()), RTL_TEXTENCODING_UTF8 ).getStr() ); } void callSystemHandler(int signal, siginfo_t * info, void * context) |