From ca1655b01e0f15289f5b8e7b760373c733cbdd83 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Tue, 15 Apr 2008 17:44:32 -0400 Subject: PR6410: unwinder-less architecture tolerance --- runtime/stack-x86_64.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'runtime/stack-x86_64.c') diff --git a/runtime/stack-x86_64.c b/runtime/stack-x86_64.c index 9915c594..c3b171ea 100644 --- a/runtime/stack-x86_64.c +++ b/runtime/stack-x86_64.c @@ -25,6 +25,7 @@ static void _stp_stack_print_fallback(unsigned long stack, int verbose) static void __stp_stack_print(struct pt_regs *regs, int verbose, int levels) { +#ifdef STP_USE_DWARF_UNWINDER // FIXME: large stack allocation struct unwind_frame_info info; arch_unw_init_frame_info(&info, regs); @@ -42,4 +43,7 @@ static void __stp_stack_print(struct pt_regs *regs, int verbose, int levels) _stp_stack_print_fallback(UNW_SP(&info), verbose); break; } +#else /* ! STP_USE_DWARF_UNWINDER */ + _stp_stack_print_fallback(REG_SP(regs), verbose); +#endif } -- cgit From 8a49d1d23c77033bf98fc7b139b37f83e3e0eb49 Mon Sep 17 00:00:00 2001 From: Martin Hunt Date: Tue, 15 Apr 2008 21:46:36 -0400 Subject: Count stack levels printed on x86_64 too. --- runtime/stack-x86_64.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'runtime/stack-x86_64.c') diff --git a/runtime/stack-x86_64.c b/runtime/stack-x86_64.c index c3b171ea..729b8a2a 100644 --- a/runtime/stack-x86_64.c +++ b/runtime/stack-x86_64.c @@ -9,16 +9,16 @@ */ /* DWARF unwinder failed. Just dump intereting addresses on kernel stack. */ -static void _stp_stack_print_fallback(unsigned long stack, int verbose) +static void _stp_stack_print_fallback(unsigned long stack, int verbose, int levels) { unsigned long addr; - while (stack & (THREAD_SIZE - 1) && - !_stp_pbuf_full()) { + while (levels && stack & (THREAD_SIZE - 1)) { if (unlikely(_stp_read_address(addr, (unsigned long *)stack, KERNEL_DS))) { /* cannot access stack. give up. */ return; } - _stp_func_print(addr, verbose, 0); + if (_stp_func_print(addr, verbose, 0)) + levels--; stack++; } } @@ -30,17 +30,18 @@ static void __stp_stack_print(struct pt_regs *regs, int verbose, int levels) struct unwind_frame_info info; arch_unw_init_frame_info(&info, regs); - while (!arch_unw_user_mode(&info)) { + while (levels && !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_func_print(UNW_PC(&info), verbose, 1); + levels--; continue; } /* If an error happened or we hit a kretprobe trampoline, use fallback backtrace */ /* FIXME: is there a way to unwind across kretprobe trampolines? */ if (ret < 0 || (ret > 0 && UNW_PC(&info) == _stp_kretprobe_trampoline)) - _stp_stack_print_fallback(UNW_SP(&info), verbose); + _stp_stack_print_fallback(UNW_SP(&info), verbose, levels); break; } #else /* ! STP_USE_DWARF_UNWINDER */ -- cgit