All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Let gdb assume that kgdb supports extended mode
@ 2009-09-15 15:52 Louis Rilling
  0 siblings, 0 replies; only message in thread
From: Louis Rilling @ 2009-09-15 15:52 UTC (permalink / raw)
  To: Jason Wessel; +Cc: kgdb-bugreport, linux-kernel, Louis Rilling

Hi,

When looking for ways to reboot my target machine from gdb, I had to implement
the patch below.

Then, from gdb, one has to attach as extended-remote target, and the
'run' command will reboot the target machine.

The behavior is not perfect since gdb will complain afterwards, and the user
has to interrupt it and detach to recover usage. But AFAICS, gdb's remote
protocol only uses the 'RXX' remote command in extended mode, which makes the
current implementation of the 'R0' command in kgdb unreachable from gdb.

So, are there reasons not to include such a patch?

Thanks,

Louis

-------------------------------------------------->
Subject: [PATCH] Let gdb assume that kgdb supports extended mode

... and allow users to reboot the target machine from gdb.

Signed-off-by: Louis Rilling <louis.rilling@kerlabs.com>
---
 kernel/kgdb.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/kernel/kgdb.c b/kernel/kgdb.c
index 5f15d33..e39f886 100644
--- a/kernel/kgdb.c
+++ b/kernel/kgdb.c
@@ -829,6 +829,12 @@ static int kgdb_io_ready(int print_wait)
  * where KGDB is communicating with an external debugger
  */
 
+/* Handle the '!' extended mode request */
+static void gdb_cmd_extended(struct kgdb_state *ks)
+{
+	strcpy(remcom_out_buffer, "OK");
+}
+
 /* Handle the '?' status packets */
 static void gdb_cmd_status(struct kgdb_state *ks)
 {
@@ -1252,6 +1258,9 @@ static int gdb_serial_stub(struct kgdb_state *ks)
 		get_packet(remcom_in_buffer);
 
 		switch (remcom_in_buffer[0]) {
+		case '!': /* extended mode */
+			gdb_cmd_extended(ks);
+			break;
 		case '?': /* gdbserial status */
 			gdb_cmd_status(ks);
 			break;
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-09-15 15:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-15 15:52 [PATCH] Let gdb assume that kgdb supports extended mode Louis Rilling

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.