diff options
Diffstat (limited to 'kernel/printk.c')
-rw-r--r-- | kernel/printk.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 75077ad0b537..444b770c9595 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/bootmem.h> | 33 | #include <linux/bootmem.h> |
34 | #include <linux/syscalls.h> | 34 | #include <linux/syscalls.h> |
35 | #include <linux/kexec.h> | 35 | #include <linux/kexec.h> |
36 | #include <linux/kdb.h> | ||
36 | #include <linux/ratelimit.h> | 37 | #include <linux/ratelimit.h> |
37 | #include <linux/kmsg_dump.h> | 38 | #include <linux/kmsg_dump.h> |
38 | #include <linux/syslog.h> | 39 | #include <linux/syslog.h> |
@@ -413,6 +414,22 @@ SYSCALL_DEFINE3(syslog, int, type, char __user *, buf, int, len) | |||
413 | return do_syslog(type, buf, len, SYSLOG_FROM_CALL); | 414 | return do_syslog(type, buf, len, SYSLOG_FROM_CALL); |
414 | } | 415 | } |
415 | 416 | ||
417 | #ifdef CONFIG_KGDB_KDB | ||
418 | /* kdb dmesg command needs access to the syslog buffer. do_syslog() | ||
419 | * uses locks so it cannot be used during debugging. Just tell kdb | ||
420 | * where the start and end of the physical and logical logs are. This | ||
421 | * is equivalent to do_syslog(3). | ||
422 | */ | ||
423 | void kdb_syslog_data(char *syslog_data[4]) | ||
424 | { | ||
425 | syslog_data[0] = log_buf; | ||
426 | syslog_data[1] = log_buf + log_buf_len; | ||
427 | syslog_data[2] = log_buf + log_end - | ||
428 | (logged_chars < log_buf_len ? logged_chars : log_buf_len); | ||
429 | syslog_data[3] = log_buf + log_end; | ||
430 | } | ||
431 | #endif /* CONFIG_KGDB_KDB */ | ||
432 | |||
416 | /* | 433 | /* |
417 | * Call the console drivers on a range of log_buf | 434 | * Call the console drivers on a range of log_buf |
418 | */ | 435 | */ |
@@ -586,6 +603,14 @@ asmlinkage int printk(const char *fmt, ...) | |||
586 | va_list args; | 603 | va_list args; |
587 | int r; | 604 | int r; |
588 | 605 | ||
606 | #ifdef CONFIG_KGDB_KDB | ||
607 | if (unlikely(kdb_trap_printk)) { | ||
608 | va_start(args, fmt); | ||
609 | r = vkdb_printf(fmt, args); | ||
610 | va_end(args); | ||
611 | return r; | ||
612 | } | ||
613 | #endif | ||
589 | va_start(args, fmt); | 614 | va_start(args, fmt); |
590 | r = vprintk(fmt, args); | 615 | r = vprintk(fmt, args); |
591 | va_end(args); | 616 | va_end(args); |