diff options
| -rw-r--r-- | Documentation/DocBook/kgdb.tmpl | 17 | ||||
| -rw-r--r-- | kernel/debug/debug_core.c | 16 |
2 files changed, 33 insertions, 0 deletions
diff --git a/Documentation/DocBook/kgdb.tmpl b/Documentation/DocBook/kgdb.tmpl index d71b57fcf11..4ee4ba3509f 100644 --- a/Documentation/DocBook/kgdb.tmpl +++ b/Documentation/DocBook/kgdb.tmpl | |||
| @@ -362,6 +362,23 @@ | |||
| 362 | </para> | 362 | </para> |
| 363 | </para> | 363 | </para> |
| 364 | </sect1> | 364 | </sect1> |
| 365 | <sect1 id="kgdbreboot"> | ||
| 366 | <title>Run time parameter: kgdbreboot</title> | ||
| 367 | <para> The kgdbreboot feature allows you to change how the debugger | ||
| 368 | deals with the reboot notification. You have 3 choices for the | ||
| 369 | behavior. The default behavior is always set to 0.</para> | ||
| 370 | <orderedlist> | ||
| 371 | <listitem><para>echo -1 > /sys/module/debug_core/parameters/kgdbreboot</para> | ||
| 372 | <para>Ignore the reboot notification entirely.</para> | ||
| 373 | </listitem> | ||
| 374 | <listitem><para>echo 0 > /sys/module/debug_core/parameters/kgdbreboot</para> | ||
| 375 | <para>Send the detach message to any attached debugger client.</para> | ||
| 376 | </listitem> | ||
| 377 | <listitem><para>echo 1 > /sys/module/debug_core/parameters/kgdbreboot</para> | ||
| 378 | <para>Enter the debugger on reboot notify.</para> | ||
| 379 | </listitem> | ||
| 380 | </orderedlist> | ||
| 381 | </sect1> | ||
| 365 | </chapter> | 382 | </chapter> |
| 366 | <chapter id="usingKDB"> | 383 | <chapter id="usingKDB"> |
| 367 | <title>Using kdb</title> | 384 | <title>Using kdb</title> |
diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c index 3c1ad4e0354..3f88a45e6f0 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c | |||
| @@ -76,6 +76,8 @@ static int exception_level; | |||
| 76 | struct kgdb_io *dbg_io_ops; | 76 | struct kgdb_io *dbg_io_ops; |
| 77 | static DEFINE_SPINLOCK(kgdb_registration_lock); | 77 | static DEFINE_SPINLOCK(kgdb_registration_lock); |
| 78 | 78 | ||
| 79 | /* Action for the reboot notifiter, a global allow kdb to change it */ | ||
| 80 | static int kgdbreboot; | ||
| 79 | /* kgdb console driver is loaded */ | 81 | /* kgdb console driver is loaded */ |
| 80 | static int kgdb_con_registered; | 82 | static int kgdb_con_registered; |
| 81 | /* determine if kgdb console output should be used */ | 83 | /* determine if kgdb console output should be used */ |
| @@ -97,6 +99,7 @@ static int __init opt_kgdb_con(char *str) | |||
| 97 | early_param("kgdbcon", opt_kgdb_con); | 99 | early_param("kgdbcon", opt_kgdb_con); |
| 98 | 100 | ||
| 99 | module_param(kgdb_use_con, int, 0644); | 101 | module_param(kgdb_use_con, int, 0644); |
| 102 | module_param(kgdbreboot, int, 0644); | ||
| 100 | 103 | ||
| 101 | /* | 104 | /* |
| 102 | * Holds information about breakpoints in a kernel. These breakpoints are | 105 | * Holds information about breakpoints in a kernel. These breakpoints are |
| @@ -788,8 +791,21 @@ void __init dbg_late_init(void) | |||
| 788 | static int | 791 | static int |
| 789 | dbg_notify_reboot(struct notifier_block *this, unsigned long code, void *x) | 792 | dbg_notify_reboot(struct notifier_block *this, unsigned long code, void *x) |
| 790 | { | 793 | { |
| 794 | /* | ||
| 795 | * Take the following action on reboot notify depending on value: | ||
| 796 | * 1 == Enter debugger | ||
| 797 | * 0 == [the default] detatch debug client | ||
| 798 | * -1 == Do nothing... and use this until the board resets | ||
| 799 | */ | ||
| 800 | switch (kgdbreboot) { | ||
| 801 | case 1: | ||
| 802 | kgdb_breakpoint(); | ||
| 803 | case -1: | ||
| 804 | goto done; | ||
| 805 | } | ||
| 791 | if (!dbg_kdb_mode) | 806 | if (!dbg_kdb_mode) |
| 792 | gdbstub_exit(code); | 807 | gdbstub_exit(code); |
| 808 | done: | ||
| 793 | return NOTIFY_DONE; | 809 | return NOTIFY_DONE; |
| 794 | } | 810 | } |
| 795 | 811 | ||
