[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [XEN] gdbstub return value is used to determine whether or not
# HG changeset patch # User kfraser@xxxxxxxxxxxxxxxxxxxxx # Node ID d78b31dd07e8d46032546dea2d68da229bf812c5 # Parent ed8f53f81e6ede2f866648ab84eb8128aeff6c07 [XEN] gdbstub return value is used to determine whether or not to continue execution. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> --- xen/common/gdbstub.c | 30 +++++++++++----------------- xen/include/asm-x86/debugger.h | 43 ++++++----------------------------------- 2 files changed, 19 insertions(+), 54 deletions(-) diff -r ed8f53f81e6e -r d78b31dd07e8 xen/common/gdbstub.c --- a/xen/common/gdbstub.c Wed Sep 27 14:01:30 2006 +0100 +++ b/xen/common/gdbstub.c Wed Sep 27 14:28:26 2006 +0100 @@ -506,14 +506,13 @@ int int __trap_to_gdb(struct cpu_user_regs *regs, unsigned long cookie) { - int resume = 0; - int r; + int rc = 0; unsigned long flags; if ( gdb_ctx->serhnd < 0 ) { dbg_printk("Debugger not ready yet.\n"); - return 0; + return -EBUSY; } /* We rely on our caller to ensure we're only on one processor @@ -532,7 +531,7 @@ __trap_to_gdb(struct cpu_user_regs *regs { printk("WARNING WARNING WARNING: Avoiding recursive gdb.\n"); atomic_inc(&gdb_ctx->running); - return 0; + return -EBUSY; } if ( !gdb_ctx->connected ) @@ -565,19 +564,14 @@ __trap_to_gdb(struct cpu_user_regs *regs gdb_cmd_signum(gdb_ctx); } - while ( resume == 0 ) - { - r = receive_command(gdb_ctx); - if ( r < 0 ) - { - dbg_printk("GDB disappeared, trying to resume Xen...\n"); - resume = 1; - } - else - { - resume = process_command(regs, gdb_ctx); - } - } + do { + if ( receive_command(gdb_ctx) < 0 ) + { + dbg_printk("Error in GDB session...\n"); + rc = -EIO; + break; + } + } while ( process_command(regs, gdb_ctx) == 0 ); gdb_arch_exit(regs); console_end_sync(); @@ -586,7 +580,7 @@ __trap_to_gdb(struct cpu_user_regs *regs local_irq_restore(flags); - return 0; + return rc; } void diff -r ed8f53f81e6e -r d78b31dd07e8 xen/include/asm-x86/debugger.h --- a/xen/include/asm-x86/debugger.h Wed Sep 27 14:01:30 2006 +0100 +++ b/xen/include/asm-x86/debugger.h Wed Sep 27 14:28:26 2006 +0100 @@ -15,14 +15,13 @@ * 2. debugger_trap_fatal(): * Called when Xen is about to give up and crash. Typically you will use this * hook to drop into a debug session. It can also be used to hook off - * deliberately caused traps (which you then handle and return non-zero) - * but really these should be hooked off 'debugger_trap_entry'. + * deliberately caused traps (which you then handle and return non-zero). * * 3. debugger_trap_immediate(): * Called if we want to drop into a debugger now. This is essentially the * same as debugger_trap_fatal, except that we use the current register state * rather than the state which was in effect when we took the trap. - * Essentially, if we're dying because of an unhandled exception, we call + * For example: if we're dying because of an unhandled exception, we call * debugger_trap_fatal; if we're dying because of a panic() we call * debugger_trap_immediate(). */ @@ -44,42 +43,19 @@ #include <xen/gdbstub.h> -#define __debugger_trap_entry(_v, _r) (0) - -static inline int __debugger_trap_fatal( +static inline int debugger_trap_fatal( unsigned int vector, struct cpu_user_regs *regs) { - (void)__trap_to_gdb(regs, vector); - return (vector == TRAP_int3); /* int3 is harmless */ + return (__trap_to_gdb(regs, vector) == 0); } /* Int3 is a trivial way to gather cpu_user_regs context. */ #define debugger_trap_immediate() __asm__ __volatile__ ( "int3" ); -#elif 0 - -extern int kdb_trap(int, int, struct cpu_user_regs *); - -static inline int __debugger_trap_entry( - unsigned int vector, struct cpu_user_regs *regs) -{ - return 0; -} - -static inline int __debugger_trap_fatal( - unsigned int vector, struct cpu_user_regs *regs) -{ - return kdb_trap(vector, 0, regs); -} - -/* Int3 is a trivial way to gather cpu_user_regs context. */ -#define debugger_trap_immediate() __asm__ __volatile__ ( "int3" ) - #else -#define __debugger_trap_entry(_v, _r) (0) -#define __debugger_trap_fatal(_v, _r) (0) -#define __debugger_trap_immediate() ((void)0) +#define debugger_trap_fatal(v, r) (0) +#define debugger_trap_immediate() ((void)0) #endif @@ -96,12 +72,7 @@ static inline int debugger_trap_entry( return 1; } - return __debugger_trap_entry(vector, regs); + return 0; } -#define debugger_trap_fatal(v, r) (__debugger_trap_fatal(v, r)) -#ifndef debugger_trap_immediate -#define debugger_trap_immediate() (__debugger_trap_immediate()) -#endif - #endif /* __X86_DEBUGGER_H__ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |