move printing of stack trace headers from library to user's program

This commit is contained in:
2020-04-25 09:09:55 +04:00
parent 3e72295ee9
commit 1825515ca0
2 changed files with 6 additions and 4 deletions
-2
View File
@@ -165,7 +165,6 @@ bool pst_handler_handle_dwarf(pst_handler* h)
const char* pst_print_pretty(pst_handler* h)
{
h->ctx.clean_print(&h->ctx);
h->ctx.print(&h->ctx, "DWARF-based stack trace information:\n");
uint32_t idx = 0;
for(pst_function* fn = pst_handler_next_function(h, NULL); fn; fn = pst_handler_next_function(h, fn)) {
h->ctx.print(&h->ctx, "[%-2u] ", idx); idx++;
@@ -188,7 +187,6 @@ Dwfl_Callbacks callbacks = {
const char* pst_print_simple(pst_handler* h)
{
h->ctx.clean_print(&h->ctx);
h->ctx.print(&h->ctx, "Simple unwind-based stack trace:\n");
uint32_t idx = 0;
for(pst_function* fn = pst_handler_next_function(h, NULL); fn; fn = pst_handler_next_function(h, fn)) {
h->ctx.print(&h->ctx, "[%-2u] ", idx);
+6 -2
View File
@@ -69,9 +69,13 @@ void FatalSignalHandler(int sig, siginfo_t* info, void* context)
}
if(pst_unwind_simple(handler)) {
printf("\n%s", pst_print_simple(handler));
printf("Simple unwind-based stack trace:\n");
printf("--------------------------------\n");
printf("%s\n", pst_print_simple(handler));
if(pst_unwind_pretty(handler)) {
printf("\n%s", pst_print_pretty(handler));
printf("DWARF-based stack trace information:\n");
printf("------------------------------------\n");
printf("%s", pst_print_pretty(handler));
} else {
printf("Failed to use DWARF for unwind stack trace\n");
}