[KGDB PATCH][3/7] SysRq-G

Tom Rini
2004-02-27T21:33:40Z

Hello. The following adds SysRq-G. This is always configured in on
CONFIG_KGDB && CONFIG_SYSRQ.

diff -zrupN linux-2.6.3+config+serial/drivers/char/sysrq.c linux-2.6.3+config+serial+sysrq+arch_hooks/drivers/char/sysrq.c
--- linux-2.6.3+config+serial/drivers/char/sysrq.c 2004-02-27 12:06:22.000000000 -0700
+++ linux-2.6.3+config+serial+sysrq+arch_hooks/drivers/char/sysrq.c 2004-02-27 12:16:14.000000000 -0700
@@ -31,6 +31,7 @@
#include <linux/suspend.h>
#include <linux/writeback.h>
#include <linux/buffer_head.h> /* for fsync_bdev() */
+#include <linux/kgdb.h> /* for breakpoint() */

#include <linux/spinlock.h>

@@ -44,6 +45,25 @@ int sysrq_enabled = 1;
/* Machine specific power off function */
void (*sysrq_power_off)(void);

+/* Make a breakpoint() right now. */
+#ifdef CONFIG_KGDB
+#define GDB_OP &kgdb_op
+static void kgdb_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty)
+{
+ printk("kgdb sysrq\n");
+ breakpoint();
+}
+
+static struct sysrq_key_op kgdb_op = {
+ .handler = kgdb_sysrq,
+ .help_msg = "kGdb|Fgdb",
+ .action_msg = "Debug breakpoint\n",
+};
+
+#else
+#define GDB_OP NULL
+#endif
+
/* Loglevel sysrq handler */
static void sysrq_handle_loglevel(int key, struct pt_regs *pt_regs,
struct tty_struct *tty)
@@ -239,7 +259,7 @@ static struct sysrq_key_op *sysrq_key_ta
/* d */ NULL,
/* e */ &sysrq_term_op,
/* f */ NULL,
-/* g */ NULL,
+/* g */ GDB_OP,
/* h */ NULL,
/* i */ &sysrq_kill_op,
/* j */ NULL,

--
Tom Rini