From 6d6dbe278ad5fab5d33273b38c1ad137380a3e1e Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 10 Apr 2009 22:55:26 +0200 Subject: Fix unwind _stp_mod_sec_lookup. * runtime/unwind.c (unwind): Pass current to _stp_mod_sec_lookup(). --- runtime/unwind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/unwind.c') diff --git a/runtime/unwind.c b/runtime/unwind.c index 9c704e28..f7b19def 100644 --- a/runtime/unwind.c +++ b/runtime/unwind.c @@ -581,7 +581,7 @@ static int unwind(struct unwind_frame_info *frame) if (UNW_PC(frame) == 0) return -EINVAL; - m = _stp_mod_sec_lookup (pc, &s); + m = _stp_mod_sec_lookup (pc, current, &s); if (unlikely(m == NULL)) { dbug_unwind(1, "No module found for pc=%lx", pc); return -EINVAL; -- cgit From 9afe68eda6c01ca07a4f6010104f524a337d2050 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 16 Apr 2009 15:07:42 -0700 Subject: Privatize MAX_STACK_DEPTH The kernel-tip tree also has a MAX_STACK_DEPTH defined in perf_counter.h, so we need to separate our definition. I've changed the definition in our unwinder to STP_MAX_STACK_DEPTH. --- runtime/unwind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/unwind.c') diff --git a/runtime/unwind.c b/runtime/unwind.c index f7b19def..41af72a7 100644 --- a/runtime/unwind.c +++ b/runtime/unwind.c @@ -345,7 +345,7 @@ static int processCFI(const u8 *start, const u8 *end, unsigned long targetLoc, s state->label = NULL; return 1; } - if (state->stackDepth >= MAX_STACK_DEPTH) + if (state->stackDepth >= STP_MAX_STACK_DEPTH) return 0; state->stack[state->stackDepth++] = ptr.p8; break; -- cgit From 15bdc138573610dbc40be680480af1d63bd0ae5d Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 19 Apr 2009 16:38:41 +0200 Subject: Handle .absolute and .dynamic (user space) addresses in adjustStartLoc. * runtime/unwind.c (adjustStartLoc): .absolute sections don't need adjustment, .dynamic sections need the section addr to be added. --- runtime/unwind.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'runtime/unwind.c') diff --git a/runtime/unwind.c b/runtime/unwind.c index 41af72a7..7914c77d 100644 --- a/runtime/unwind.c +++ b/runtime/unwind.c @@ -435,12 +435,18 @@ adjustStartLoc (unsigned long startLoc, struct _stp_module *m, struct _stp_section *s) { - if (startLoc && (strcmp (m->name, "kernel") != 0)) - { - startLoc = _stp_module_relocate (m->name, s->name, - startLoc); - startLoc -= m->dwarf_module_base; - } + /* XXX - some, or all, of this should really be done by + _stp_module_relocate. */ + if (startLoc == 0 + || strcmp (m->name, "kernel") == 0 + || strcmp (s->name, ".absolute") == 0) + return startLoc; + + if (strcmp (s->name, ".dynamic") == 0) + return startLoc + s->addr; + + startLoc = _stp_module_relocate (m->name, s->name, startLoc); + startLoc -= m->dwarf_module_base; return startLoc; } -- cgit From 47a2a2303c9b261e88a4333bf2964b4291a22a12 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 20 Apr 2009 22:43:37 +0200 Subject: Pass task from tapset, through stack and unwind functions for lookup. * runtime/stack-arm.c (__stp_stack_print): Take struct task_struct *. * runtime/stack-ia64.c (__stp_stack_print): Likewise. * runtime/stack-ppc64.c (__stp_stack_print): Likewise. * runtime/stack-s390.c (__stp_stack_print): Likewise. * runtime/stack-i386.c (__stp_stack_print): Likewise. And add check and pass to unwind() and _stp_func_print(). * runtime/stack-x86_64.c: Likewise. * runtime/stack.c *_stp_stack_print): Take and pass on task_struct. (_stp_stack_snprint): Likewise. * runtime/unwind.c (unwind): Take and use task_struct for _stp_mod_sec_lookup(). * tapset/context-unwind.stp (print_backtrace): Pass NULL to _stp_stack_print(). (backtrace): Pass NULL to _stp_stack_snprint(). --- runtime/unwind.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/unwind.c') diff --git a/runtime/unwind.c b/runtime/unwind.c index 7914c77d..aacd56f1 100644 --- a/runtime/unwind.c +++ b/runtime/unwind.c @@ -568,7 +568,7 @@ static char *_stp_eh_enc_name(signed type) /* Unwind to previous to frame. Returns 0 if successful, negative * number in case of an error. A positive return means unwinding is finished; * don't try to fallback to dumping addresses on the stack. */ -static int unwind(struct unwind_frame_info *frame) +static int unwind(struct unwind_frame_info *frame, struct task_struct *tsk) { #define FRAME_REG(r, t) (((t *)frame)[reg_info[r].offs]) const u32 *fde, *cie = NULL; @@ -587,7 +587,7 @@ static int unwind(struct unwind_frame_info *frame) if (UNW_PC(frame) == 0) return -EINVAL; - m = _stp_mod_sec_lookup (pc, current, &s); + m = _stp_mod_sec_lookup (pc, tsk, &s); if (unlikely(m == NULL)) { dbug_unwind(1, "No module found for pc=%lx", pc); return -EINVAL; -- cgit