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.
Signed-off-by: Jason Wessel <jason.wessel at windriver.com>
---
drivers/serial/kgdboc.c | 14 ++++++++++++++
include/linux/kgdb.h | 3 +++
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 f4066b3..02fbd86 100644
--- a/drivers/serial/kgdboc.c
+++ b/drivers/serial/kgdboc.c
@@ -16,6 +16,7 @@
#include <linux/kgdb.h>
#include <linux/kdb.h>
#include <linux/tty.h>
+#include <linux/console.h>
#define MAX_CONFIG_LEN 40
@@ -72,12 +73,14 @@ static int configure_kgdboc(void)
int tty_line = 0;
int err;
char *cptr = config;
+ struct console *cons;
err = kgdboc_option_setup(config);
if (err || !strlen(config) || isspace(config[0]))
goto noconfig;
err = -ENODEV;
+ kgdboc_io_ops.is_console = 0;
#ifdef CONFIG_KDB_KEYBOARD
kgdb_tty_driver = NULL;
@@ -98,6 +101,17 @@ static int configure_kgdboc(void)
if (!p)
goto noconfig;
+ cons = console_drivers;
+ while (cons) {
+ int idx;
+ if (cons->device && cons->device(cons, &idx) == p &&
+ idx == tty_line) {
+ kgdboc_io_ops.is_console = 1;
+ break;
+ }
+ cons = cons->next;
+ }
+
kgdb_tty_driver = p;
kgdb_tty_line = tty_line;
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index b5de457..619019a 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -234,6 +234,8 @@ struct kgdb_arch {
* the I/O driver.
* @post_exception: Pointer to a function that will do any cleanup work
* for the I/O driver.
+ * @is_console: 1 if the end device is a console 0 if the I/O device is
+ * not a console
*/
struct kgdb_io {
const char *name;
@@ -243,6 +245,7 @@ struct kgdb_io {
int (*init) (void);
void (*pre_exception) (void);
void (*post_exception) (void);
+ int is_console;
};
extern struct kgdb_arch arch_kgdb_ops;
diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c
index b7b4c4a..17aa1f2 100644
--- a/kernel/debug/kdb/kdb_io.c
+++ b/kernel/debug/kdb/kdb_io.c
@@ -671,6 +671,14 @@ kdb_printit:
if (!dbg_kdb_mode && kgdb_connected) {
gdbstub_msg_write(kdb_buffer, strlen(kdb_buffer));
} else {
+ if (!dbg_io_ops->is_console) {
+ len = strlen(kdb_buffer);
+ cp = kdb_buffer;
+ while (len--) {
+ dbg_io_ops->write_char(*cp);
+ cp++;
+ }
+ }
while (c) {
c->write(c, kdb_buffer, strlen(kdb_buffer));
touch_nmi_watchdog();
@@ -717,6 +725,14 @@ kdb_printit:
kdb_input_flush();
c = console_drivers;
+ if (!dbg_io_ops->is_console) {
+ len = strlen(moreprompt);
+ cp = moreprompt;
+ while (len--) {
+ dbg_io_ops->write_char(*cp);
+ cp++;
+ }
+ }
while (c) {
c->write(c, moreprompt, strlen(moreprompt));
touch_nmi_watchdog();
--
1.6.4.rc1
- References:
- [PATCH 0/37] kgdb, kdb and atomic kernel modesetting series
- [PATCH 01/37] softlockup: add sched_clock_tick() to avoid kernel warning on kgdb resume
- [PATCH 02/37] x86, hw_breakpoint, kgdb: kgdb to use hw_breakpoint API
- [PATCH 03/37] Move kernel/kgdb.c to kernel/debug/debug_core.c
- [PATCH 04/37] Separate the gdbstub from the debug core
- [PATCH 05/37] kdb: core for kgdb back end
- [PATCH 06/37] kgdb: eliminate kgdb_wait(), all cpus enter the same way
- [PATCH 07/37] kgdb,sparc: Add in kgdb_arch_set_pc for sparc
- [PATCH 08/37] kgdb, sh: update superh kgdb exception handling
- [PATCH 09/37] kgdb, blackfin: Add in kgdb_arch_set_pc for blackfin
- [PATCH 10/37] kgdb: Make mem access function weak in kgdb.c and kgdb.h
- [PATCH 11/37] kgdb: Fix kernel-doc format error in kgdb.h
- [PATCH 12/37] kgdb: core changes to support kdb
- [PATCH 13/37] kgdb, 8250, pl011: Return immediately from console poll
- [PATCH 14/37] sh, sh-sci: Use NO_POLL_CHAR in the SCIF polled console code
- [PATCH 15/37] sparc, sunzilog: Add console polling support for sunzilog serial driver
- [PATCH 16/37] kgdb: gdb "monitor" -> kdb passthrough
- [PATCH 17/37] kgdboc, keyboard: Keyboard driver for kdb with kgdb
- [PATCH 18/37] kgdb: remove post_primary_code references
- [PATCH 19/37] x86,kgdb: Add low level debug hook
- [PATCH 20/37] arm, kgdb: Add hook to catch an oops with debugger
- [PATCH 21/37] powerpc, kgdb: Introduce low level trap catching
- [PATCH 22/37] mips, kgdb: kdb low level trap catch and stack trace
- [PATCH 23/37] kgdb: Add the ability to schedule a breakpoint via a tasklet
[Linux USB Devel]
[Video for Linux]
[Linux Audio Users]
[Photo]
[Yosemite News]
[Yosemite Photos]
[Free Online Dating]
[Linux Kernel]
[Linux SCSI]
[XFree86]