ia64/xen-unstable

view xen/include/asm-powerpc/debugger.h @ 12916:2a10ce87327c

[XEN][POWERPC] Be a little smarter with unimplemented()
Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Jimi Xenidis <jimix@watson.ibm.com>
date Fri Sep 22 11:51:56 2006 -0400 (2006-09-22)
parents 4da585fb62f9
children 5b0e0c93a5bf
line source
1 /*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15 *
16 * Copyright (C) IBM Corp. 2005
17 *
18 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
19 */
21 #ifndef _ASM_DEBUGGER_H_
22 #define _ASM_DEBUGGER_H_
24 extern void show_backtrace_regs(struct cpu_user_regs *);
25 extern void show_backtrace(ulong sp, ulong lr, ulong pc);
27 static inline void dump_execution_state(void)
28 {
29 ulong sp;
30 ulong lr;
32 sp = (ulong)__builtin_frame_address(0);
33 lr = (ulong)__builtin_return_address(0);
35 show_backtrace(sp, lr, lr);
36 }
38 static inline void debugger_trap_immediate(void)
39 {
40 dump_execution_state();
41 __builtin_trap();
42 }
44 static inline void unimplemented(void)
45 {
46 #ifdef VERBOSE
47 dump_execution_state();
48 #endif
49 }
51 static inline void show_execution_state(struct cpu_user_regs *regs)
52 {
53 show_registers(regs);
54 }
56 extern void __warn(char *file, int line);
57 #define WARN() __warn(__FILE__, __LINE__)
58 #define WARN_ON(_p) do { if (_p) WARN(); } while ( 0 )
60 #define FORCE_CRASH() debugger_trap_immediate()
62 #ifdef CRASH_DEBUG
64 #include <xen/gdbstub.h>
66 static inline int debugger_trap_fatal(
67 unsigned int vector, struct cpu_user_regs *regs)
68 {
69 (void)__trap_to_gdb(regs, vector);
70 return vector;
71 }
73 #else /* CRASH_DEBUG */
75 static inline int debugger_trap_fatal(
76 unsigned int vector, struct cpu_user_regs *regs)
77 {
78 show_backtrace(regs->gprs[1], regs->lr, regs->pc);
79 return vector;
80 }
82 #endif /* CRASH_DEBUG */
84 #endif