Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 196351
b: refs/heads/master
c: efe2f29
h: refs/heads/master
i:
  196349: 8676dd2
  196347: 5b1c0c3
  196343: 6dabed7
  196335: 4520f81
  196319: d87a947
  196287: 71541a3
  196223: f31a9c2
  196095: fb7d86b
v: v3
  • Loading branch information
Jason Wessel committed May 21, 2010
1 parent 31cbcd4 commit e2fd336
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1cee5e35f15d0893be1ba944f1aec8676e43ab76
refs/heads/master: efe2f29e324fd20e0449bcd6dc6dbe4734c2ba94
14 changes: 14 additions & 0 deletions trunk/drivers/serial/kgdboc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -93,12 +94,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;
kgdb_tty_driver = NULL;

if (kgdboc_register_kbd(&cptr))
Expand All @@ -108,6 +111,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;

Expand Down
3 changes: 3 additions & 0 deletions trunk/include/linux/kgdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,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;
Expand All @@ -256,6 +258,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;
Expand Down
16 changes: 16 additions & 0 deletions trunk/kernel/debug/kdb/kdb_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,14 @@ int kdb_printf(const char *fmt, ...)
if (!dbg_kdb_mode && kgdb_connected) {
gdbstub_msg_write(kdb_buffer, retlen);
} 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, retlen);
touch_nmi_watchdog();
Expand Down Expand Up @@ -719,6 +727,14 @@ int kdb_printf(const char *fmt, ...)
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();
Expand Down

0 comments on commit e2fd336

Please sign in to comment.