move printing of stack trace headers from library to user's program
This commit is contained in:
@@ -165,7 +165,6 @@ bool pst_handler_handle_dwarf(pst_handler* h)
|
|||||||
const char* pst_print_pretty(pst_handler* h)
|
const char* pst_print_pretty(pst_handler* h)
|
||||||
{
|
{
|
||||||
h->ctx.clean_print(&h->ctx);
|
h->ctx.clean_print(&h->ctx);
|
||||||
h->ctx.print(&h->ctx, "DWARF-based stack trace information:\n");
|
|
||||||
uint32_t idx = 0;
|
uint32_t idx = 0;
|
||||||
for(pst_function* fn = pst_handler_next_function(h, NULL); fn; fn = pst_handler_next_function(h, fn)) {
|
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++;
|
h->ctx.print(&h->ctx, "[%-2u] ", idx); idx++;
|
||||||
@@ -188,7 +187,6 @@ Dwfl_Callbacks callbacks = {
|
|||||||
const char* pst_print_simple(pst_handler* h)
|
const char* pst_print_simple(pst_handler* h)
|
||||||
{
|
{
|
||||||
h->ctx.clean_print(&h->ctx);
|
h->ctx.clean_print(&h->ctx);
|
||||||
h->ctx.print(&h->ctx, "Simple unwind-based stack trace:\n");
|
|
||||||
uint32_t idx = 0;
|
uint32_t idx = 0;
|
||||||
for(pst_function* fn = pst_handler_next_function(h, NULL); fn; fn = pst_handler_next_function(h, fn)) {
|
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);
|
h->ctx.print(&h->ctx, "[%-2u] ", idx);
|
||||||
|
|||||||
+6
-2
@@ -69,9 +69,13 @@ void FatalSignalHandler(int sig, siginfo_t* info, void* context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(pst_unwind_simple(handler)) {
|
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)) {
|
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 {
|
} else {
|
||||||
printf("Failed to use DWARF for unwind stack trace\n");
|
printf("Failed to use DWARF for unwind stack trace\n");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user