diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-20 18:13:29 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-20 18:13:29 -0500 |
| commit | 4fbd0a81a0059f22d06780de96e73f9ddbccd8a4 (patch) | |
| tree | da867d35f345180234e2243df833eb6237c12d73 | |
| parent | 7bad2227f639723230dbc40fe32e16101321b5b7 (diff) | |
| parent | dd8f30cc0550f36861ddfa42c27cc5c580b0bf8c (diff) | |
Merge tag 'for_linux-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb
Pull kgdb/kdb updates from Jason Wessel:
"KGDB/KDB New:
- KDB: improved searching
- No longer enter debug core on panic if panic timeout is set
KGDB/KDB regressions / cleanups
- fix pdf doc build errors
- prevent junk characters on kdb console from printk levels"
* tag 'for_linux-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb:
kgdb, docs: Fix <para> pdfdocs build errors
debug: prevent entering debug mode on panic/exception.
kdb: Const qualifier for kdb_getstr's prompt argument
kdb: Provide forward search at more prompt
kdb: Fix a prompt management bug when using | grep
kdb: Remove stack dump when entering kgdb due to NMI
kdb: Avoid printing KERN_ levels to consoles
kdb: Fix off by one error in kdb_cpu()
kdb: fix incorrect counts in KDB summary command output
| -rw-r--r-- | Documentation/DocBook/kgdb.tmpl | 6 | ||||
| -rw-r--r-- | include/linux/kdb.h | 8 | ||||
| -rw-r--r-- | kernel/debug/debug_core.c | 19 | ||||
| -rw-r--r-- | kernel/debug/kdb/kdb_io.c | 46 | ||||
| -rw-r--r-- | kernel/debug/kdb/kdb_main.c | 16 | ||||
| -rw-r--r-- | kernel/debug/kdb/kdb_private.h | 4 | ||||
| -rw-r--r-- | kernel/printk/printk.c | 2 |
7 files changed, 74 insertions, 27 deletions
diff --git a/Documentation/DocBook/kgdb.tmpl b/Documentation/DocBook/kgdb.tmpl index 2428cc04dbc8..f3abca7ec53d 100644 --- a/Documentation/DocBook/kgdb.tmpl +++ b/Documentation/DocBook/kgdb.tmpl | |||
| @@ -197,6 +197,7 @@ | |||
| 197 | may be configured as a kernel built-in or a kernel loadable module. | 197 | may be configured as a kernel built-in or a kernel loadable module. |
| 198 | You can only make use of <constant>kgdbwait</constant> and early | 198 | You can only make use of <constant>kgdbwait</constant> and early |
| 199 | debugging if you build kgdboc into the kernel as a built-in. | 199 | debugging if you build kgdboc into the kernel as a built-in. |
| 200 | </para> | ||
| 200 | <para>Optionally you can elect to activate kms (Kernel Mode | 201 | <para>Optionally you can elect to activate kms (Kernel Mode |
| 201 | Setting) integration. When you use kms with kgdboc and you have a | 202 | Setting) integration. When you use kms with kgdboc and you have a |
| 202 | video driver that has atomic mode setting hooks, it is possible to | 203 | video driver that has atomic mode setting hooks, it is possible to |
| @@ -206,7 +207,6 @@ | |||
| 206 | crashes or doing analysis of memory with kdb while allowing the | 207 | crashes or doing analysis of memory with kdb while allowing the |
| 207 | full graphics console applications to run. | 208 | full graphics console applications to run. |
| 208 | </para> | 209 | </para> |
| 209 | </para> | ||
| 210 | <sect2 id="kgdbocArgs"> | 210 | <sect2 id="kgdbocArgs"> |
| 211 | <title>kgdboc arguments</title> | 211 | <title>kgdboc arguments</title> |
| 212 | <para>Usage: <constant>kgdboc=[kms][[,]kbd][[,]serial_device][,baud]</constant></para> | 212 | <para>Usage: <constant>kgdboc=[kms][[,]kbd][[,]serial_device][,baud]</constant></para> |
| @@ -284,7 +284,6 @@ | |||
| 284 | </listitem> | 284 | </listitem> |
| 285 | </orderedlist> | 285 | </orderedlist> |
| 286 | </para> | 286 | </para> |
| 287 | </sect3> | ||
| 288 | <para>NOTE: Kgdboc does not support interrupting the target via the | 287 | <para>NOTE: Kgdboc does not support interrupting the target via the |
| 289 | gdb remote protocol. You must manually send a sysrq-g unless you | 288 | gdb remote protocol. You must manually send a sysrq-g unless you |
| 290 | have a proxy that splits console output to a terminal program. | 289 | have a proxy that splits console output to a terminal program. |
| @@ -305,6 +304,7 @@ | |||
| 305 | as well as on the initial connect, or to use a debugger proxy that | 304 | as well as on the initial connect, or to use a debugger proxy that |
| 306 | allows an unmodified gdb to do the debugging. | 305 | allows an unmodified gdb to do the debugging. |
| 307 | </para> | 306 | </para> |
| 307 | </sect3> | ||
| 308 | </sect2> | 308 | </sect2> |
| 309 | </sect1> | 309 | </sect1> |
| 310 | <sect1 id="kgdbwait"> | 310 | <sect1 id="kgdbwait"> |
| @@ -350,12 +350,12 @@ | |||
| 350 | </para> | 350 | </para> |
| 351 | </listitem> | 351 | </listitem> |
| 352 | </orderedlist> | 352 | </orderedlist> |
| 353 | </para> | ||
| 353 | <para>IMPORTANT NOTE: You cannot use kgdboc + kgdbcon on a tty that is an | 354 | <para>IMPORTANT NOTE: You cannot use kgdboc + kgdbcon on a tty that is an |
| 354 | active system console. An example of incorrect usage is <constant>console=ttyS0,115200 kgdboc=ttyS0 kgdbcon</constant> | 355 | active system console. An example of incorrect usage is <constant>console=ttyS0,115200 kgdboc=ttyS0 kgdbcon</constant> |
| 355 | </para> | 356 | </para> |
| 356 | <para>It is possible to use this option with kgdboc on a tty that is not a system console. | 357 | <para>It is possible to use this option with kgdboc on a tty that is not a system console. |
| 357 | </para> | 358 | </para> |
| 358 | </para> | ||
| 359 | </sect1> | 359 | </sect1> |
| 360 | <sect1 id="kgdbreboot"> | 360 | <sect1 id="kgdbreboot"> |
| 361 | <title>Run time parameter: kgdbreboot</title> | 361 | <title>Run time parameter: kgdbreboot</title> |
diff --git a/include/linux/kdb.h b/include/linux/kdb.h index 75ae2e2631fc..a19bcf9e762e 100644 --- a/include/linux/kdb.h +++ b/include/linux/kdb.h | |||
| @@ -156,8 +156,14 @@ typedef enum { | |||
| 156 | KDB_REASON_SYSTEM_NMI, /* In NMI due to SYSTEM cmd; regs valid */ | 156 | KDB_REASON_SYSTEM_NMI, /* In NMI due to SYSTEM cmd; regs valid */ |
| 157 | } kdb_reason_t; | 157 | } kdb_reason_t; |
| 158 | 158 | ||
| 159 | enum kdb_msgsrc { | ||
| 160 | KDB_MSGSRC_INTERNAL, /* direct call to kdb_printf() */ | ||
| 161 | KDB_MSGSRC_PRINTK, /* trapped from printk() */ | ||
| 162 | }; | ||
| 163 | |||
| 159 | extern int kdb_trap_printk; | 164 | extern int kdb_trap_printk; |
| 160 | extern __printf(1, 0) int vkdb_printf(const char *fmt, va_list args); | 165 | extern __printf(2, 0) int vkdb_printf(enum kdb_msgsrc src, const char *fmt, |
| 166 | va_list args); | ||
| 161 | extern __printf(1, 2) int kdb_printf(const char *, ...); | 167 | extern __printf(1, 2) int kdb_printf(const char *, ...); |
| 162 | typedef __printf(1, 2) int (*kdb_printf_t)(const char *, ...); | 168 | typedef __printf(1, 2) int (*kdb_printf_t)(const char *, ...); |
| 163 | 169 | ||
diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c index 07ce18ca71e0..0874e2edd275 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c | |||
| @@ -604,7 +604,7 @@ return_normal: | |||
| 604 | online_cpus) | 604 | online_cpus) |
| 605 | cpu_relax(); | 605 | cpu_relax(); |
| 606 | if (!time_left) | 606 | if (!time_left) |
| 607 | pr_crit("KGDB: Timed out waiting for secondary CPUs.\n"); | 607 | pr_crit("Timed out waiting for secondary CPUs.\n"); |
| 608 | 608 | ||
| 609 | /* | 609 | /* |
| 610 | * At this point the primary processor is completely | 610 | * At this point the primary processor is completely |
| @@ -696,6 +696,14 @@ kgdb_handle_exception(int evector, int signo, int ecode, struct pt_regs *regs) | |||
| 696 | 696 | ||
| 697 | if (arch_kgdb_ops.enable_nmi) | 697 | if (arch_kgdb_ops.enable_nmi) |
| 698 | arch_kgdb_ops.enable_nmi(0); | 698 | arch_kgdb_ops.enable_nmi(0); |
| 699 | /* | ||
| 700 | * Avoid entering the debugger if we were triggered due to an oops | ||
| 701 | * but panic_timeout indicates the system should automatically | ||
| 702 | * reboot on panic. We don't want to get stuck waiting for input | ||
| 703 | * on such systems, especially if its "just" an oops. | ||
| 704 | */ | ||
| 705 | if (signo != SIGTRAP && panic_timeout) | ||
| 706 | return 1; | ||
| 699 | 707 | ||
| 700 | memset(ks, 0, sizeof(struct kgdb_state)); | 708 | memset(ks, 0, sizeof(struct kgdb_state)); |
| 701 | ks->cpu = raw_smp_processor_id(); | 709 | ks->cpu = raw_smp_processor_id(); |
| @@ -828,6 +836,15 @@ static int kgdb_panic_event(struct notifier_block *self, | |||
| 828 | unsigned long val, | 836 | unsigned long val, |
| 829 | void *data) | 837 | void *data) |
| 830 | { | 838 | { |
| 839 | /* | ||
| 840 | * Avoid entering the debugger if we were triggered due to a panic | ||
| 841 | * We don't want to get stuck waiting for input from user in such case. | ||
| 842 | * panic_timeout indicates the system should automatically | ||
| 843 | * reboot on panic. | ||
| 844 | */ | ||
| 845 | if (panic_timeout) | ||
| 846 | return NOTIFY_DONE; | ||
| 847 | |||
| 831 | if (dbg_kdb_mode) | 848 | if (dbg_kdb_mode) |
| 832 | kdb_printf("PANIC: %s\n", (char *)data); | 849 | kdb_printf("PANIC: %s\n", (char *)data); |
| 833 | kgdb_breakpoint(); | 850 | kgdb_breakpoint(); |
diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c index 7c70812caea5..fc1ef736253c 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c | |||
| @@ -439,7 +439,7 @@ poll_again: | |||
| 439 | * substituted for %d, %x or %o in the prompt. | 439 | * substituted for %d, %x or %o in the prompt. |
| 440 | */ | 440 | */ |
| 441 | 441 | ||
| 442 | char *kdb_getstr(char *buffer, size_t bufsize, char *prompt) | 442 | char *kdb_getstr(char *buffer, size_t bufsize, const char *prompt) |
| 443 | { | 443 | { |
| 444 | if (prompt && kdb_prompt_str != prompt) | 444 | if (prompt && kdb_prompt_str != prompt) |
| 445 | strncpy(kdb_prompt_str, prompt, CMD_BUFLEN); | 445 | strncpy(kdb_prompt_str, prompt, CMD_BUFLEN); |
| @@ -548,7 +548,7 @@ static int kdb_search_string(char *searched, char *searchfor) | |||
| 548 | return 0; | 548 | return 0; |
| 549 | } | 549 | } |
| 550 | 550 | ||
| 551 | int vkdb_printf(const char *fmt, va_list ap) | 551 | int vkdb_printf(enum kdb_msgsrc src, const char *fmt, va_list ap) |
| 552 | { | 552 | { |
| 553 | int diag; | 553 | int diag; |
| 554 | int linecount; | 554 | int linecount; |
| @@ -680,6 +680,12 @@ int vkdb_printf(const char *fmt, va_list ap) | |||
| 680 | size_avail = sizeof(kdb_buffer) - len; | 680 | size_avail = sizeof(kdb_buffer) - len; |
| 681 | goto kdb_print_out; | 681 | goto kdb_print_out; |
| 682 | } | 682 | } |
| 683 | if (kdb_grepping_flag >= KDB_GREPPING_FLAG_SEARCH) | ||
| 684 | /* | ||
| 685 | * This was a interactive search (using '/' at more | ||
| 686 | * prompt) and it has completed. Clear the flag. | ||
| 687 | */ | ||
| 688 | kdb_grepping_flag = 0; | ||
| 683 | /* | 689 | /* |
| 684 | * at this point the string is a full line and | 690 | * at this point the string is a full line and |
| 685 | * should be printed, up to the null. | 691 | * should be printed, up to the null. |
| @@ -691,19 +697,20 @@ kdb_printit: | |||
| 691 | * Write to all consoles. | 697 | * Write to all consoles. |
| 692 | */ | 698 | */ |
