check status of unw_getcontext() and unw_init_local() in qt_print_backtrace()

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2020-01-23 18:14:18 +00:00
parent b870968b33
commit c6a58b86dd

View file

@ -1258,8 +1258,15 @@ static void qt_print_backtrace()
unw_cursor_t cursor; unw_cursor_t cursor;
unw_context_t context; unw_context_t context;
unw_getcontext(&context); if (unw_getcontext(&context) != 0) {
unw_init_local(&cursor, &context); ::fprintf(stderr, "qt_print_backtrace: unable to get context\n");
return;
}
if (unw_init_local(&cursor, &context) != 0) {
::fprintf(stderr, "qt_print_backtrace: unable to initialize\n");
return;
}
while (unw_step(&cursor) > 0) { while (unw_step(&cursor) > 0) {
unw_word_t offset; unw_word_t offset;
@ -1274,7 +1281,7 @@ static void qt_print_backtrace()
printf(" %s\n", sym); printf(" %s\n", sym);
} }
} else { } else {
printf("qt_print_backtrace: unable to obtain symbol name for this frame\n"); ::fprintf(stderr, "qt_print_backtrace: unable to obtain symbol name for this frame\n");
} }
} }
} }