Changeset 6bb136b2 in mainline for uspace/lib/c/generic/stacktrace.c


Ignore:
Timestamp:
2018-07-31T12:32:34Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b79903b, d742db21
Parents:
d4b7b29
git-author:
Jiri Svoboda <jiri@…> (2018-07-30 20:18:16)
git-committer:
Jiri Svoboda <jiri@…> (2018-07-31 12:32:34)
Message:

Limit userspace stack trace depth.

File:
1 edited

Legend:

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

    rd4b7b29 r6bb136b2  
    4141#include <io/kio.h>
    4242
     43#define STACK_FRAMES_MAX 20
     44
    4345static errno_t stacktrace_read_uintptr(void *arg, uintptr_t addr, uintptr_t *data);
    4446
     
    5658    uintptr_t pc)
    5759{
     60        int cnt = 0;
    5861        stacktrace_t st;
    5962        uintptr_t nfp;
     
    6366        st.ops = ops;
    6467
    65         while (stacktrace_fp_valid(&st, fp)) {
     68        while (cnt++ < STACK_FRAMES_MAX && stacktrace_fp_valid(&st, fp)) {
    6669                ops->printf("%p: %p()\n", (void *) fp, (void *) pc);
    6770                rc =  stacktrace_ra_get(&st, fp, &pc);
Note: See TracChangeset for help on using the changeset viewer.