diff options
| author | Karel Klic <kklic@redhat.com> | 2009-11-20 17:54:17 +0100 |
|---|---|---|
| committer | Karel Klic <kklic@redhat.com> | 2009-11-20 17:54:17 +0100 |
| commit | b8da7620a417ef835869da692db140b75e8b7a93 (patch) | |
| tree | 9afa3edca4663fde9118550ca839b7021f4b0eb0 /src/Backtrace/backtrace.c | |
| parent | 10ca6da1cc2d89ba5c45179d452720d916bc4698 (diff) | |
| download | abrt-b8da7620a417ef835869da692db140b75e8b7a93.tar.gz abrt-b8da7620a417ef835869da692db140b75e8b7a93.tar.xz abrt-b8da7620a417ef835869da692db140b75e8b7a93.zip | |
Backtrace parser improvements
Diffstat (limited to 'src/Backtrace/backtrace.c')
| -rw-r--r-- | src/Backtrace/backtrace.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/Backtrace/backtrace.c b/src/Backtrace/backtrace.c index b2a1e6d..6090298 100644 --- a/src/Backtrace/backtrace.c +++ b/src/Backtrace/backtrace.c @@ -60,6 +60,21 @@ struct frame *frame_add_sibling(struct frame *a, struct frame *b) return a; } +static void frame_print_tree(struct frame *frame) +{ + printf(" #%d", frame->number); + if (frame->function) + printf(" %s", frame->function); + if (frame->sourcefile) + { + if (frame->function) + printf(" at"); + printf(" %s", frame->sourcefile); + } + + puts(""); /* newline */ +} + struct thread *thread_new() { struct thread *t = malloc(sizeof(struct thread)); @@ -96,8 +111,28 @@ struct thread *thread_add_sibling(struct thread *a, struct thread *b) return a; } +static int thread_get_frame_count(struct thread *thread) +{ + struct frame *f = thread->frames; + int count = 0; + while (f) + { + f = f->next; + ++count; + } + return count; +} + static void thread_print_tree(struct thread *thread) { + int framecount = thread_get_frame_count(thread); + printf("Thread no. %d (%d frames)\n", thread->number, framecount); + struct frame *frame = thread->frames; + while (frame) + { + frame_print_tree(frame); + frame = frame->next; + } } struct backtrace *backtrace_new() |
