diff options
author | askeshav <askeshav> | 2005-10-28 22:49:28 +0000 |
---|---|---|
committer | askeshav <askeshav> | 2005-10-28 22:49:28 +0000 |
commit | 1c9db4fdf66fe88a731319b99942872fa567d742 (patch) | |
tree | 33a86507a7fcf9a9c771cf9a1801c8f81c566cf8 /runtime/stack.c | |
parent | 063b69fe3f1109ec81b5e4c1f1333a442ccb3734 (diff) | |
download | systemtap-steved-1c9db4fdf66fe88a731319b99942872fa567d742.tar.gz systemtap-steved-1c9db4fdf66fe88a731319b99942872fa567d742.tar.xz systemtap-steved-1c9db4fdf66fe88a731319b99942872fa567d742.zip |
IA64 Runtime support patches. With this in place
Systemtap should now be able to build on Ia64.
Includes supports for - function probes, return probes,
function parameter access and dumping stack backtrace.
Added by Anil S Keshavamurthy <Anil.s.keshavamurthy@intel.com>
Diffstat (limited to 'runtime/stack.c')
-rw-r--r-- | runtime/stack.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/runtime/stack.c b/runtime/stack.c index bc9630dc..c09b8171 100644 --- a/runtime/stack.c +++ b/runtime/stack.c @@ -1,3 +1,13 @@ +/* Stack tracing functions + * Copyright (C) 2005 Red Hat Inc. + * Copyright (C) 2005 Intel Corporation. + * + * 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. + */ + #ifndef _STACK_C_ /* -*- linux-c -*- */ #define _STACK_C_ @@ -38,6 +48,62 @@ static void __stp_stack_sprint (String str, unsigned long *stack, int verbose, i } } +#elif defined (__ia64__) +struct dump_para{ + unsigned long *sp; + String str; +}; + +static void __stp_show_stack_sym(struct unw_frame_info *info, void *arg) +{ + unsigned long ip, skip=1; + String str = ((struct dump_para*)arg)->str; + struct pt_regs *regs = container_of(((struct dump_para*)arg)->sp, struct pt_regs, r12); + + do { + unw_get_ip(info, &ip); + if (ip == 0) break; + if (skip){ + if (ip == REG_IP(regs)) + skip = 0; + else continue; + } + _stp_string_cat(str, " "); + _stp_symbol_sprint(str, ip); + _stp_string_cat (str, "\n"); + } while (unw_unwind(info) >= 0); +} + +static void __stp_show_stack_addr(struct unw_frame_info *info, void *arg) +{ + unsigned long ip, skip=1; + String str = ((struct dump_para*)arg)->str; + struct pt_regs *regs = container_of(((struct dump_para*)arg)->sp, struct pt_regs, r12); + + do { + unw_get_ip(info, &ip); + if (ip == 0) break; + if (skip){ + if (ip == REG_IP(regs)) + skip = 0; + continue; + } + _stp_sprintf (str, "%lx ", ip); + } while (unw_unwind(info) >= 0); +} + +static void __stp_stack_sprint (String str, unsigned long *stack, int verbose, int levels) +{ + struct dump_para para; + + para.str = str; + para.sp = stack; + if (verbose) + unw_init_running(__stp_show_stack_sym, ¶); + else + unw_init_running(__stp_show_stack_addr, ¶); +} + #elif defined (__i386__) static inline int valid_stack_ptr(struct thread_info *tinfo, void *p) |