If kdb is open on a serial port that is not actually a console make sure to call the poll routines to emit and receive characters.
Unified · Split
| @@ -16,6 +16,7 @@ · 15 unmodified lines | ||
| 16 | 16 | #include <linux/kgdb.h> |
| 17 | 17 | #include <linux/kdb.h> |
| 18 | 18 | #include <linux/tty.h> |
| 19 | +#include <linux/console.h> | |
| 19 | 20 | |
| 20 | 21 | #define MAX_CONFIG_LEN 40 |
| 21 | 22 | |
| @@ -93,12 +94,14 @@ static int configure_kgdboc(void) · 71 unmodified lines | ||
| 93 | 94 | int tty_line = 0; |
| 94 | 95 | int err; |
| 95 | 96 | char *cptr = config; |
| 97 | + struct console *cons; | |
| 96 | 98 | |
| 97 | 99 | err = kgdboc_option_setup(config); |
| 98 | 100 | if (err || !strlen(config) || isspace(config[0])) |
| 99 | 101 | goto noconfig; |
| 100 | 102 | |
| 101 | 103 | err = -ENODEV; |
| 104 | + kgdboc_io_ops.is_console = 0; | |
| 102 | 105 | kgdb_tty_driver = NULL; |
| 103 | 106 | |
| 104 | 107 | if (kgdboc_register_kbd(&cptr)) |
| @@ -108,6 +111,17 @@ static int configure_kgdboc(void) · 3 unmodified lines | ||
| 108 | 111 | if (!p) |
| 109 | 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 | 125 | kgdb_tty_driver = p; |
| 112 | 126 | kgdb_tty_line = tty_line; |
| 113 | 127 | |
| @@ -247,6 +247,8 @@ struct kgdb_arch { · 246 unmodified lines | ||
| 247 | 247 | * the I/O driver. |
| 248 | 248 | * @post_exception: Pointer to a function that will do any cleanup work |
| 249 | 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 | 253 | struct kgdb_io { |
| 252 | 254 | const char *name; |
| @@ -256,6 +258,7 @@ struct kgdb_io { · 3 unmodified lines | ||
| 256 | 258 | int (*init) (void); |
| 257 | 259 | void (*pre_exception) (void); |
| 258 | 260 | void (*post_exception) (void); |
| 261 | + int is_console; | |
| 259 | 262 | }; |
| 260 | 263 | |
| 261 | 264 | extern struct kgdb_arch arch_kgdb_ops; |
| @@ -673,6 +673,14 @@ kdb_printit: · 672 unmodified lines | ||
| 673 | 673 | if (!dbg_kdb_mode && kgdb_connected) { |
| 674 | 674 | gdbstub_msg_write(kdb_buffer, retlen); |
| 675 | 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 | 684 | while (c) { |
| 677 | 685 | c->write(c, kdb_buffer, retlen); |
| 678 | 686 | touch_nmi_watchdog(); |
| @@ -719,6 +727,14 @@ kdb_printit: · 40 unmodified lines | ||
| 719 | 727 | kdb_input_flush(); |
| 720 | 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 | 738 | while (c) { |
| 723 | 739 | c->write(c, moreprompt, strlen(moreprompt)); |
| 724 | 740 | touch_nmi_watchdog(); |