[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Fix up some issues I found when porting PPC to the new common gdb stub code:
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID ec7802acc8c94a1b886f4dc48ef3035cc3b1b156 # Parent f3661f9a95dd183bd20b05494d99b7bc0e2d27c0 Fix up some issues I found when porting PPC to the new common gdb stub code: - cosmetic changes in the messages printed - 'flags' must always be unsigned long. - explicitly calling initialize_gdb() is not difficult. For x86 and ia64 I placed this call immediately before do_initcalls(), since that's where it's being called from now so we know it's safe. Architecture people can move it earlier as appropriate. - I don't understand all these ASSERT(!local_irq_is_enabled()) statements, sometimes bracketing a single call like receive_command(). How exactly would receive_command() manage to re-enable irqs? Also, a failing ASSERT would just call into the stub again anways... - initialize_gdb() was overcomplicated. serial_parse_handle() already handles the parsing for us, and there's no need to panic there. Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx> diff -r f3661f9a95dd -r ec7802acc8c9 xen/arch/ia64/xen/xensetup.c --- a/xen/arch/ia64/xen/xensetup.c Fri Mar 3 09:46:06 2006 +++ b/xen/arch/ia64/xen/xensetup.c Fri Mar 3 09:53:58 2006 @@ -12,7 +12,7 @@ #include <xen/sched.h> #include <xen/mm.h> #include <public/version.h> -//#include <xen/delay.h> +#include <xen/gdbstub.h> #include <xen/compile.h> #include <xen/console.h> #include <xen/serial.h> @@ -359,6 +359,8 @@ printk("Brought up %ld CPUs\n", (long)num_online_cpus()); smp_cpus_done(max_cpus); #endif + + initialise_gdb(); /* could be moved earlier */ do_initcalls(); printk("About to call sort_main_extable()\n"); diff -r f3661f9a95dd -r ec7802acc8c9 xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c Fri Mar 3 09:46:06 2006 +++ b/xen/arch/x86/setup.c Fri Mar 3 09:53:58 2006 @@ -13,6 +13,7 @@ #include <xen/multiboot.h> #include <xen/domain_page.h> #include <xen/compile.h> +#include <xen/gdbstub.h> #include <public/version.h> #include <asm/bitops.h> #include <asm/smp.h> @@ -479,6 +480,8 @@ printk("Brought up %ld CPUs\n", (long)num_online_cpus()); smp_cpus_done(max_cpus); + initialise_gdb(); /* could be moved earlier */ + do_initcalls(); schedulers_start(); diff -r f3661f9a95dd -r ec7802acc8c9 xen/common/gdbstub.c --- a/xen/common/gdbstub.c Fri Mar 3 09:46:06 2006 +++ b/xen/common/gdbstub.c Fri Mar 3 09:53:58 2006 @@ -376,7 +376,6 @@ break; case 'g': /* Read registers */ gdb_arch_read_reg_array(regs, ctx); - ASSERT(!local_irq_is_enabled()); break; case 'G': /* Write registers */ gdb_arch_write_reg_array(regs, ctx->in_buf + 1, ctx); @@ -395,7 +394,6 @@ return 0; } gdb_cmd_read_mem(addr, length, ctx); - ASSERT(!local_irq_is_enabled()); break; case 'M': /* Write memory */ addr = simple_strtoul(ctx->in_buf + 1, &ptr, 16); @@ -477,7 +475,7 @@ { int resume = 0; int r; - unsigned flags; + unsigned long flags; if ( gdb_ctx->serhnd < 0 ) { @@ -506,7 +504,7 @@ if ( !gdb_ctx->connected ) { - printk("GDB connection activated\n"); + printk("GDB connection activated.\n"); gdb_arch_print_state(regs); gdb_ctx->connected = 1; } @@ -522,7 +520,7 @@ /* Shouldn't really do this, but otherwise we stop for no obvious reason, which is Bad */ - printk("Waiting for GDB to attach to Gdb\n"); + printk("Waiting for GDB to attach...\n"); gdb_arch_enter(regs); gdb_ctx->signum = gdb_arch_signal_num(regs, cookie); @@ -535,9 +533,7 @@ while ( resume == 0 ) { - ASSERT(!local_irq_is_enabled()); r = receive_command(gdb_ctx); - ASSERT(!local_irq_is_enabled()); if ( r < 0 ) { dbg_printk("GDB disappeared, trying to resume Xen...\n"); @@ -545,9 +541,7 @@ } else { - ASSERT(!local_irq_is_enabled()); resume = process_command(regs, gdb_ctx); - ASSERT(!local_irq_is_enabled()); } } @@ -561,27 +555,13 @@ return 0; } -/* - * initialization - * XXX TODO - * This should be an explicit call from architecture code. - * initcall is far too late for some early debugging, and only the - * architecture code knows when this call can be made. - */ -static int -initialize_gdb(void) -{ - if ( !strcmp(opt_gdb, "none") ) - return 0; +void +initialise_gdb(void) +{ gdb_ctx->serhnd = serial_parse_handle(opt_gdb); - if ( gdb_ctx->serhnd == -1 ) - panic("Can't parse %s as GDB serial info.\n", opt_gdb); - - printk("Gdb initialised.\n"); - return 0; -} - -__initcall(initialize_gdb); + if ( gdb_ctx->serhnd != -1 ) + printk("GDB stub initialised.\n"); +} /* * Local variables: diff -r f3661f9a95dd -r ec7802acc8c9 xen/include/xen/gdbstub.h --- a/xen/include/xen/gdbstub.h Fri Mar 3 09:46:06 2006 +++ b/xen/include/xen/gdbstub.h Fri Mar 3 09:53:58 2006 @@ -20,6 +20,8 @@ #ifndef __XEN_GDBSTUB_H__ #define __XEN_GDBSTUB_H__ + +#ifdef CRASH_DEBUG /* value <-> char (de)serialzers for arch specific gdb backends */ char hex2char(unsigned long x); @@ -84,6 +86,14 @@ #define SIGALRM 14 #define SIGTERM 15 +void initialise_gdb(void); + +#else + +#define initialise_gdb() ((void)0) + +#endif + #endif /* __XEN_GDBSTUB_H__ */ /* _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |