]>
sourceware.org Git - systemtap.git/blob - runtime/stack-x86_64.c
2 * x86_64 stack tracing functions
3 * Copyright (C) 2005, 2006, 2007 Red Hat Inc.
5 * This file is part of systemtap, and is free software. You can
6 * redistribute it and/or modify it under the terms of the GNU General
7 * Public License (GPL); either version 2, or (at your option) any
10 #ifdef CONFIG_STACK_UNWIND
11 #include <linux/unwind.h>
13 static inline int _stp_valid_stack_ptr(struct unwind_frame_info
*info
)
15 unsigned long context
= (unsigned long)UNW_SP(info
) & ~(THREAD_SIZE
- 1);
16 unsigned long p
= UNW_PC(info
);
17 return p
> context
&& p
< context
+ THREAD_SIZE
- 3;
20 static int _stp_show_trace_unwind(struct unwind_frame_info
*info
, int verbose
)
24 while (unwind(info
) == 0 && UNW_PC(info
)) {
25 if (_stp_valid_stack_ptr(info
))
30 _stp_symbol_print (UNW_PC(info
));
31 _stp_print_char('\n');
33 _stp_printf ("%p ", UNW_PC(info
));
34 if (arch_unw_user_mode(info
))
39 #endif /* CONFIG_STACK_UNWIND */
41 static void __stp_stack_print (struct pt_regs
*regs
, int verbose
, int levels
)
43 unsigned long *stack
= (unsigned long *)®_SP(regs
);
47 #ifdef CONFIG_STACK_UNWIND
48 struct unwind_frame_info info
;
49 if (unwind_init_frame_info(&info
, current
, regs
) == 0)
50 uw_ret
= _stp_show_trace_unwind(&info
, verbose
);
51 stack
= (void *)UNW_SP(&info
);
55 _stp_print("Inexact backtrace:\n");
57 while ((long)stack
& (THREAD_SIZE
-1)) {
63 _stp_print("Leftover inexact backtrace:\n");
66 _stp_symbol_print(addr
);
67 _stp_print_char('\n');
69 _stp_printf("%p ", (void *)addr
);
This page took 0.041005 seconds and 6 git commands to generate.