diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-09-12 11:43:47 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-09-12 11:43:47 +0100 |
commit | 8d701af28f2e5777a5cee19346a60859841459c6 (patch) | |
tree | dd908160c9014aa85da77c3fc56326db2c2dd8a5 /xen/common/gdbstub.c | |
parent | fbf6c4db1e48d60e50c856418eda7947b185bc2f (diff) | |
download | xen-8d701af28f2e5777a5cee19346a60859841459c6.tar.gz xen-8d701af28f2e5777a5cee19346a60859841459c6.tar.bz2 xen-8d701af28f2e5777a5cee19346a60859841459c6.zip |
Check the existence of serial port before using
Signed-off-by: Huacai Chen <huacai.chen@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/common/gdbstub.c')
-rw-r--r-- | xen/common/gdbstub.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/xen/common/gdbstub.c b/xen/common/gdbstub.c index 7b8d231903..e578756a74 100644 --- a/xen/common/gdbstub.c +++ b/xen/common/gdbstub.c @@ -65,7 +65,7 @@ static atomic_t gdb_smp_paused_count; static void gdb_smp_pause(void); static void gdb_smp_resume(void); -static char opt_gdb[30] = "none"; +static char opt_gdb[30]; string_param("gdb", opt_gdb); static void gdbstub_console_puts(const char *str); @@ -625,10 +625,19 @@ __trap_to_gdb(struct cpu_user_regs *regs, unsigned long cookie) void __init initialise_gdb(void) { + if ( *opt_gdb == '\0' ) + return; + gdb_ctx->serhnd = serial_parse_handle(opt_gdb); - if ( gdb_ctx->serhnd != -1 ) - printk("GDB stub initialised.\n"); + if ( gdb_ctx->serhnd == -1 ) + { + printk("Bad gdb= option '%s'\n", opt_gdb); + return; + } + serial_start_sync(gdb_ctx->serhnd); + + printk("GDB stub initialised.\n"); } static void gdb_pause_this_cpu(void *unused) |