diff options
author | Martin Hunt <hunt@monkey.(none)> | 2008-03-26 10:06:19 -0400 |
---|---|---|
committer | Martin Hunt <hunt@monkey.(none)> | 2008-03-26 10:06:19 -0400 |
commit | fd2ef8221625866219d6fc8e99ac36520ac6017b (patch) | |
tree | 9b4c4850024f04dd1ba03af250f749eebe8473e1 /runtime | |
parent | 5280c736a9466cd97f56ebb508be2371aacb1d53 (diff) | |
download | systemtap-steved-fd2ef8221625866219d6fc8e99ac36520ac6017b.tar.gz systemtap-steved-fd2ef8221625866219d6fc8e99ac36520ac6017b.tar.xz systemtap-steved-fd2ef8221625866219d6fc8e99ac36520ac6017b.zip |
i386 fixes.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/ChangeLog | 7 | ||||
-rw-r--r-- | runtime/stack-i386.c | 71 | ||||
-rw-r--r-- | runtime/unwind.c | 2 | ||||
-rw-r--r-- | runtime/unwind/i386.h | 12 | ||||
-rw-r--r-- | runtime/unwind/x86_64.h | 5 |
5 files changed, 57 insertions, 40 deletions
diff --git a/runtime/ChangeLog b/runtime/ChangeLog index bea8b3a3..e56fa729 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,10 @@ +2008-03-26 Martin Hunt <hunt@redhat.com> + Fixes to get i386 working. + * unwind.c (unwind): Fix types in debug print. + * stack-i386.c (_stp_stack_print_fallback): New function. + (__stp_stack_print): Call _stp_stack_print_fallback() if unwinder + appears to fail. + 2008-03-25 Martin Hunt <hunt@redhat.com> * unwind.c (unwind): Return a positive number to indicate diff --git a/runtime/stack-i386.c b/runtime/stack-i386.c index b46ff06b..a86f94be 100644 --- a/runtime/stack-i386.c +++ b/runtime/stack-i386.c @@ -8,40 +8,65 @@ * later version. */ -static inline int _stp_valid_stack_ptr(unsigned long context, unsigned long p) +static int _stp_valid_stack_ptr(unsigned long context, unsigned long p) { return p > context && p < context + THREAD_SIZE - 3; } +/* DWARF unwinder failed. Just dump intereting addresses on kernel stack. */ +static void _stp_stack_print_fallback(unsigned long context, unsigned long stack, int verbose) +{ + unsigned long addr; + while (_stp_valid_stack_ptr(context, stack)) { + if (unlikely(__stp_get_user(addr, (unsigned long *)stack))) { + /* cannot access stack. give up. */ + return; + } + _stp_func_print(addr, verbose, 0); + stack++; + } +} + static void __stp_stack_print (struct pt_regs *regs, int verbose, int levels) { unsigned long *stack = (unsigned long *)®_SP(regs); unsigned long context = (unsigned long)stack & ~(THREAD_SIZE - 1); - unsigned long addr; #ifdef CONFIG_FRAME_POINTER - { - #ifdef STAPCONF_X86_UNIREGS - unsigned long ebp = regs->bp; - #else - unsigned long ebp = regs->ebp; - #endif - - while (_stp_valid_stack_ptr(context, (unsigned long)ebp)) { - addr = *(unsigned long *)(ebp + 4); - if (verbose) { - _stp_print_char(' '); - _stp_symbol_print (addr); - _stp_print_char('\n'); - } else - _stp_printf ("0x%08lx ", addr); - ebp = *(unsigned long *)ebp; - } + /* FIXME: need to use _stp_func_print() and safe copy */ + unsigned long addr; + +#ifdef STAPCONF_X86_UNIREGS + unsigned long ebp = regs->bp; +#else + unsigned long ebp = regs->ebp; +#endif /* STAPCONF_X86_UNIREGS */ + + while (_stp_valid_stack_ptr(context, (unsigned long)ebp)) { + addr = *(unsigned long *)(ebp + 4); + if (verbose) { + _stp_print_char(' '); + _stp_symbol_print (addr); + _stp_print_char('\n'); + } else + _stp_printf ("0x%08lx ", addr); + ebp = *(unsigned long *)ebp; } #else - while (_stp_valid_stack_ptr(context, (unsigned long)stack)) { - addr = *stack++; - _stp_func_print(addr, verbose, 1); + struct unwind_frame_info info; + arch_unw_init_frame_info(&info, regs); + while (!arch_unw_user_mode(&info)) { + int ret = unwind(&info); + dbug_unwind(1, "ret=%d PC=%lx SP=%lx\n", ret, UNW_PC(&info), UNW_SP(&info)); + if (ret < 0) { + _stp_stack_print_fallback(context, UNW_SP(&info), verbose); + break; + } + if (ret) + break; + _stp_func_print(UNW_PC(&info), verbose, 1); } -#endif +// _stp_printf("***********************\n"); +// _stp_stack_print_fallback(context, (unsigned long)stack, verbose); +#endif /* CONFIG_FRAME_POINTER */ } diff --git a/runtime/unwind.c b/runtime/unwind.c index b6c9fd75..483c9345 100644 --- a/runtime/unwind.c +++ b/runtime/unwind.c @@ -804,7 +804,7 @@ int unwind(struct unwind_frame_info *frame) #else # define CASES CASE(8); CASE(16); CASE(32); CASE(64) #endif - dbug_unwind(1, "cie=%p fde=%p\n", (u64)cie, (u64)fde); + dbug_unwind(1, "cie=%lx fde=%lx\n", cie, fde); for (i = 0; i < ARRAY_SIZE(state.regs); ++i) { if (REG_INVALID(i)) { if (state.regs[i].where == Nowhere) diff --git a/runtime/unwind/i386.h b/runtime/unwind/i386.h index 1a6b678b..cb2efab7 100644 --- a/runtime/unwind/i386.h +++ b/runtime/unwind/i386.h @@ -12,13 +12,6 @@ #ifndef _STP_I386_UNWIND_H #define _STP_I386_UNWIND_H -/* - * Copyright (C) 2002-2006 Novell, Inc. - * Jan Beulich <jbeulich@novell.com> - * This code is released under version 2 of the GNU GPL. - */ - - #include <linux/sched.h> #include <asm/fixmap.h> #include <asm/ptrace.h> @@ -73,6 +66,7 @@ static inline void arch_unw_init_frame_info(struct unwind_frame_info *info, info->regs.esp = (unsigned long)®s->esp; info->regs.xss = __KERNEL_DS; } + info->call_frame = 1; } static inline void arch_unw_init_blocked(struct unwind_frame_info *info) @@ -87,10 +81,6 @@ static inline void arch_unw_init_blocked(struct unwind_frame_info *info) info->regs.xes = __USER_DS; } -extern asmlinkage int arch_unwind_init_running(struct unwind_frame_info *, - asmlinkage int (*callback)(struct unwind_frame_info *, - void *arg), - void *arg); static inline int arch_unw_user_mode(const struct unwind_frame_info *info) { diff --git a/runtime/unwind/x86_64.h b/runtime/unwind/x86_64.h index 3c4a97be..6e6e521f 100644 --- a/runtime/unwind/x86_64.h +++ b/runtime/unwind/x86_64.h @@ -93,11 +93,6 @@ static inline void arch_unw_init_blocked(struct unwind_frame_info *info) info->regs.ss = __KERNEL_DS; } -extern int arch_unwind_init_running(struct unwind_frame_info *, - int (*callback)(struct unwind_frame_info *, - void *arg), - void *arg); - static inline int arch_unw_user_mode(const struct unwind_frame_info *info) { #if 0 /* This can only work when selector register saves/restores |