diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-03-03 10:53:58 +0100 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-03-03 10:53:58 +0100 |
commit | 7cca11754fb68f1f35468092442d7b1485d2633e (patch) | |
tree | 1603dd14952f931625a6b4dbe2f21568abc61018 /xen/common/gdbstub.c | |
parent | b8d1d84a4f6938350faf24f1516015f17a547a14 (diff) | |
download | xen-7cca11754fb68f1f35468092442d7b1485d2633e.tar.gz xen-7cca11754fb68f1f35468092442d7b1485d2633e.tar.bz2 xen-7cca11754fb68f1f35468092442d7b1485d2633e.zip |
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@us.ibm.com>
Diffstat (limited to 'xen/common/gdbstub.c')
-rw-r--r-- | xen/common/gdbstub.c | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/xen/common/gdbstub.c b/xen/common/gdbstub.c index 48c1b0a41f..5f5beb690a 100644 --- a/xen/common/gdbstub.c +++ b/xen/common/gdbstub.c @@ -376,7 +376,6 @@ process_command(struct cpu_user_regs *regs, struct gdb_context *ctx) 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 @@ process_command(struct cpu_user_regs *regs, struct gdb_context *ctx) 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 @@ __trap_to_gdb(struct cpu_user_regs *regs, unsigned long cookie) { int resume = 0; int r; - unsigned flags; + unsigned long flags; if ( gdb_ctx->serhnd < 0 ) { @@ -506,7 +504,7 @@ __trap_to_gdb(struct cpu_user_regs *regs, unsigned long cookie) 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 @@ __trap_to_gdb(struct cpu_user_regs *regs, unsigned long cookie) /* 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 @@ __trap_to_gdb(struct cpu_user_regs *regs, unsigned long cookie) 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 @@ __trap_to_gdb(struct cpu_user_regs *regs, unsigned long cookie) } else { - ASSERT(!local_irq_is_enabled()); resume = process_command(regs, gdb_ctx); - ASSERT(!local_irq_is_enabled()); } } @@ -561,28 +555,14 @@ __trap_to_gdb(struct cpu_user_regs *regs, unsigned long cookie) 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) +void +initialise_gdb(void) { - if ( !strcmp(opt_gdb, "none") ) - return 0; 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; + if ( gdb_ctx->serhnd != -1 ) + printk("GDB stub initialised.\n"); } -__initcall(initialize_gdb); - /* * Local variables: * mode: C |