diff options
| -rw-r--r-- | drivers/serial/kgdboc.c | 14 | ||||
| -rw-r--r-- | include/linux/kgdb.h | 3 | ||||
| -rw-r--r-- | kernel/debug/kdb/kdb_io.c | 16 |
3 files changed, 33 insertions, 0 deletions
diff --git a/drivers/serial/kgdboc.c b/drivers/serial/kgdboc.c index ecef6e1a599a..b765ab48dfe7 100644 --- a/drivers/serial/kgdboc.c +++ b/drivers/serial/kgdboc.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/kgdb.h> | 16 | #include <linux/kgdb.h> |
| 17 | #include <linux/kdb.h> | 17 | #include <linux/kdb.h> |
| 18 | #include <linux/tty.h> | 18 | #include <linux/tty.h> |
| 19 | #include <linux/console.h> | ||
| 19 | 20 | ||
| 20 | #define MAX_CONFIG_LEN 40 | 21 | #define MAX_CONFIG_LEN 40 |
| 21 | 22 | ||
| @@ -93,12 +94,14 @@ static int configure_kgdboc(void) | |||
| 93 | int tty_line = 0; | 94 | int tty_line = 0; |
| 94 | int err; | 95 | int err; |
| 95 | char *cptr = config; | 96 | char *cptr = config; |
| 97 | struct console *cons; | ||
| 96 | 98 | ||
| 97 | err = kgdboc_option_setup(config); | 99 | err = kgdboc_option_setup(config); |
| 98 | if (err || !strlen(config) || isspace(config[0])) | 100 | if (err || !strlen(config) || isspace(config[0])) |
| 99 | goto noconfig; | 101 | goto noconfig; |
| 100 | 102 | ||
| 101 | err = -ENODEV; | 103 | err = -ENODEV; |
| 104 | kgdboc_io_ops.is_console = 0; | ||
| 102 | kgdb_tty_driver = NULL; | 105 | kgdb_tty_driver = NULL; |
| 103 | 106 | ||
| 104 | if (kgdboc_register_kbd(&cptr)) | 107 | if (kgdboc_register_kbd(&cptr)) |
| @@ -108,6 +111,17 @@ static int configure_kgdboc(void) | |||
| 108 | if (!p) | 111 | if (!p) |
| 109 | goto noconfig; | 112 | goto noconfig; |
| 110 | 113 | ||
| 114 | cons = console_drivers; | ||
| 115 | while (cons) { | ||
| 116 | int idx; | ||
| 117 | if (cons->device && cons->device(cons, &idx) == p && | ||
| 118 | idx == tty_line) { | ||
| 119 | kgdboc_io_ops.is_console = 1; | ||
| 120 | break; | ||
| 121 | } | ||
| 122 | cons = cons->next; | ||
| 123 | } | ||
| 124 | |||
| 111 | kgdb_tty_driver = p; | 125 | kgdb_tty_driver = p; |
| 112 | kgdb_tty_line = tty_line; | 126 | kgdb_tty_line = tty_line; |
| 113 | 127 | ||
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h index ee007ea341b8..6c784ab6856a 100644 --- a/include/linux/kgdb.h +++ b/include/linux/kgdb.h | |||
| @@ -247,6 +247,8 @@ struct kgdb_arch { | |||
| 247 | * the I/O driver. | 247 | * the I/O driver. |
| 248 | * @post_exception: Pointer to a function that will do any cleanup work | 248 | * @post_exception: Pointer to a function that will do any cleanup work |
| 249 | * for the I/O driver. | 249 | * for the I/O driver. |
| 250 | * @is_console: 1 if the end device is a console 0 if the I/O device is | ||
| 251 | * not a console | ||
| 250 | */ | 252 | */ |
| 251 | struct kgdb_io { | 253 | struct kgdb_io { |
| 252 | const char *name; | 254 | const char *name; |
| @@ -256,6 +258,7 @@ struct kgdb_io { | |||
| 256 | int (*init) (void); | 258 | int (*init) (void); |
| 257 | void (*pre_exception) (void); | 259 | void (*pre_exception) (void); |
| 258 | void (*post_exception) (void); | 260 | void (*post_exception) (void); |
| 261 | int is_console; | ||
| 259 | }; | 262 | }; |
| 260 | 263 | ||
| 261 | extern struct kgdb_arch arch_kgdb_ops; | 264 | extern struct kgdb_arch arch_kgdb_ops; |
diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c index 8339b291e8bc..58be7e9c9e95 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c | |||
| @@ -673,6 +673,14 @@ kdb_printit: | |||
| 673 | if (!dbg_kdb_mode && kgdb_connected) { | 673 | if (!dbg_kdb_mode && kgdb_connected) { |
| 674 | gdbstub_msg_write(kdb_buffer, retlen); | 674 | gdbstub_msg_write(kdb_buffer, retlen); |
| 675 | } else { | 675 | } else { |
| 676 | if (!dbg_io_ops->is_console) { | ||
| 677 | len = strlen(kdb_buffer); | ||
| 678 | cp = kdb_buffer; | ||
| 679 | while (len--) { | ||
| 680 | dbg_io_ops->write_char(*cp); | ||
| 681 | cp++; | ||
| 682 | } | ||
| 683 | } | ||
| 676 | while (c) { | 684 | while (c) { |
| 677 | c->write(c, kdb_buffer, retlen); | 685 | c->write(c, kdb_buffer, retlen); |
| 678 | touch_nmi_watchdog(); | 686 | touch_nmi_watchdog(); |
| @@ -719,6 +727,14 @@ kdb_printit: | |||
| 719 | kdb_input_flush(); | 727 | kdb_input_flush(); |
| 720 | c = console_drivers; | 728 | c = console_drivers; |
| 721 | 729 | ||
| 730 | if (!dbg_io_ops->is_console) { | ||
| 731 | len = strlen(moreprompt); | ||
| 732 | cp = moreprompt; | ||
| 733 | while (len--) { | ||
| 734 | dbg_io_ops->write_char(*cp); | ||
| 735 | cp++; | ||
| 736 | } | ||
| 737 | } | ||
| 722 | while (c) { | 738 | while (c) { |
| 723 | c->write(c, moreprompt, strlen(moreprompt)); | 739 | c->write(c, moreprompt, strlen(moreprompt)); |
| 724 | touch_nmi_watchdog(); | 740 | touch_nmi_watchdog(); |
