Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset c1b979a in mainline for uspace/lib/c/generic/stacktrace.c


Ignore:
Timestamp:
2014-07-11T23:06:30Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
78192cc7
Parents:
8e4a408
Message:

Taskdump printing of fibril stacktraces.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/stacktrace.c

    r8e4a408 rc1b979a  
    4242static int stacktrace_read_uintptr(void *arg, uintptr_t addr, uintptr_t *data);
    4343
    44 void stacktrace_print_fp_pc(uintptr_t fp, uintptr_t pc)
     44static stacktrace_ops_t basic_ops = {
     45        .read_uintptr = stacktrace_read_uintptr
     46};
     47
     48void stacktrace_print_generic(stacktrace_ops_t *ops, void *arg, uintptr_t fp,
     49    uintptr_t pc)
    4550{
    4651        stacktrace_t st;
    4752        uintptr_t nfp;
     53        int rc;
    4854
    49         st.op_arg = NULL;
    50         st.read_uintptr = stacktrace_read_uintptr;
     55        st.op_arg = arg;
     56        st.ops = ops;
    5157
    5258        while (stacktrace_fp_valid(&st, fp)) {
    5359                printf("%p: %p()\n", (void *) fp, (void *) pc);
    54                 (void) stacktrace_ra_get(&st, fp, &pc);
    55                 (void) stacktrace_fp_prev(&st, fp, &nfp);
     60                rc =  stacktrace_ra_get(&st, fp, &pc);
     61                if (rc != EOK)
     62                        break;
     63                rc = stacktrace_fp_prev(&st, fp, &nfp);
     64                if (rc != EOK)
     65                        break;
    5666                fp = nfp;
    5767        }
     68}
     69
     70void stacktrace_print_fp_pc(uintptr_t fp, uintptr_t pc)
     71{
     72        stacktrace_print_generic(&basic_ops, NULL, fp, pc);
    5873}
    5974
Note: See TracChangeset for help on using the changeset viewer.