From f5fd3c39dcec944feb8aa91808a8cb8d94dd1e04 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Sat, 28 Nov 2009 01:33:39 +0300 Subject: Rename stack-ppc64.c to stack-ppc.c There should be no functional changes in this patch. Signed-off-by: Anton Vorontsov --- runtime/stack-ppc.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 runtime/stack-ppc.c (limited to 'runtime/stack-ppc.c') diff --git a/runtime/stack-ppc.c b/runtime/stack-ppc.c new file mode 100644 index 00000000..3267194e --- /dev/null +++ b/runtime/stack-ppc.c @@ -0,0 +1,62 @@ +/* -*- linux-c -*- + * ppc64 stack tracing functions + * + * This file is part of systemtap, and is free software. You can + * redistribute it and/or modify it under the terms of the GNU General + * Public License (GPL); either version 2, or (at your option) any + * later version. + */ + +static void __stp_stack_print (struct pt_regs *regs, int verbose, int levels, + struct task_struct *tsk) +{ + unsigned long ip, newsp, lr = 0; + int count = 0; + int firstframe = 1; + unsigned long *_sp = (unsigned long *)®_SP(regs); + unsigned long sp = (unsigned long)_sp; + lr = 0; + do { + if (sp < KERNELBASE) + return; + _sp = (unsigned long *) sp; + newsp = _sp[0]; + ip = _sp[2]; + if (!firstframe || ip != lr) { + if (verbose) { + _stp_printf("[0x%016lx] [0x%016lx] ", sp, ip); + _stp_symbol_print(ip); + if (firstframe) + _stp_print(" (unreliable)"); + _stp_print_char('\n'); + } + else + _stp_printf("0x%016lx ", ip); + } + firstframe = 0; + /* + * See if this is an exception frame. + * We look for the "regshere" marker in the current frame. + */ + if ( _sp[12] == 0x7265677368657265ul) { + struct pt_regs *regs = (struct pt_regs *) + (sp + STACK_FRAME_OVERHEAD); + if (verbose) { + _stp_printf("--- Exception: %lx at ",regs->trap); + _stp_symbol_print(regs->nip); + _stp_print_char('\n'); + lr = regs->link; + _stp_print(" LR ="); + _stp_symbol_print(lr); + _stp_print_char('\n'); + firstframe = 1; + } + else { + _stp_printf("0x%016lx ",regs->nip); + _stp_printf("0x%016lx ",regs->link); + } + } + + sp = newsp; + } while (count++ < MAXBACKTRACE); +} -- cgit From 51280c12d044b671b16ce59396658ac5a0f24650 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Sat, 28 Nov 2009 01:33:42 +0300 Subject: stack-ppc: Adjust for ppc32 Get rid of magic numbers, use appropriate defines from ptrace.h. From now on stack-ppc.c should be suitable for ppc32. Signed-off-by: Anton Vorontsov --- runtime/stack-ppc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/stack-ppc.c') diff --git a/runtime/stack-ppc.c b/runtime/stack-ppc.c index 3267194e..df2db15d 100644 --- a/runtime/stack-ppc.c +++ b/runtime/stack-ppc.c @@ -21,7 +21,7 @@ static void __stp_stack_print (struct pt_regs *regs, int verbose, int levels, return; _sp = (unsigned long *) sp; newsp = _sp[0]; - ip = _sp[2]; + ip = _sp[STACK_FRAME_LR_SAVE]; if (!firstframe || ip != lr) { if (verbose) { _stp_printf("[0x%016lx] [0x%016lx] ", sp, ip); @@ -38,7 +38,7 @@ static void __stp_stack_print (struct pt_regs *regs, int verbose, int levels, * See if this is an exception frame. * We look for the "regshere" marker in the current frame. */ - if ( _sp[12] == 0x7265677368657265ul) { + if (_sp[STACK_FRAME_MARKER] == STACK_FRAME_REGS_MARKER) { struct pt_regs *regs = (struct pt_regs *) (sp + STACK_FRAME_OVERHEAD); if (verbose) { -- cgit