introduce separate print functions for 'simple' and 'pretty' variands of

unwinding
This commit is contained in:
2020-04-05 13:33:19 +04:00
parent 3adc8eb1ef
commit e2e7535149
6 changed files with 124 additions and 125 deletions
+8 -4
View File
@@ -62,15 +62,19 @@ void FatalSignalHandler(int sig, siginfo_t* info, void* context)
printf("%s signal handled\n", strsignal(sig));
if((context != 0) && (sig == SIGSEGV || sig == SIGABRT || sig == SIGBUS || sig == SIGFPE))
{
pst_handler* handler = pst_lib_init((ucontext_t*)context);
pst_handler* handler = pst_lib_init((ucontext_t*)context, NULL, 0);
if(!handler) {
printf("Failed to allocate pst handler\n");
return;
}
int ret = pst_unwind_simple_fd(handler, stdout);
if(!ret) {
pst_unwind_pretty_fd(handler, stdout);
if(pst_unwind_simple(handler)) {
printf("%s", pst_print_simple(handler));
if(pst_unwind_pretty(handler)) {
printf("%s", pst_print_pretty(handler));
} else {
printf("Failed to use DWARF for unwind stack trace\n");
}
} else {
printf("No stack trace obtained\n");
}