Skip to contentSkip to conversation

FRV: Extend gdbstub to support more features of gdb

PATCH New David Howells 1 participant 1 message Mar 25, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 FRV: Extend gdbstub to support more features of gdb

Extend gdbstub to support more features of gdb remote protocol to keep gdb-7 and emacs gud mode happy:

(*) The D command. Detach debugger.

(*) The H command. Handle setting the target thread by ignoring it.

(*) The qAttached command. Indicate we 'attached' to an existing process.

(*) The qC command. Indicate that the current thread ID is 0.

(*) The qOffsets command. Indicate that no relocation has been done.

(*) The qSymbol:: command. Indicate that we're not interested in looking up
any symbol addresses.

(*) The qSupported command. Indicate the maximum packet size and the fact
that reverse step and continue aren't supported.

(*) The vCont? command. Indicate that we don't support any of its variants.

Also make it possible to trace the commands and replies without tracing the individual character I/O.

---

 arch/frv/include/asm/gdb-stub.h |    7 ++++
 arch/frv/kernel/gdb-io.c        |    4 +--
 arch/frv/kernel/gdb-stub.c      |   61 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 70 insertions(+), 2 deletions(-)
arch/frv/include/asm/gdb-stub.h +7 -0
index 2da7164..e6bedd0 100644
@@ -12,6 +12,7 @@
 #ifndef __ASM_GDB_STUB_H
 #define __ASM_GDB_STUB_H
 
+#undef GDBSTUB_DEBUG_IO
 #undef GDBSTUB_DEBUG_PROTOCOL
 
 #include <asm/ptrace.h>
@@ -108,6 +109,12 @@ extern void gdbstub_printk(const char *fmt, ...);
 extern void debug_to_serial(const char *p, int n);
 extern void console_set_baud(unsigned baud);
 
+#ifdef GDBSTUB_DEBUG_IO
+#define gdbstub_io(FMT,...) gdbstub_printk(FMT, ##__VA_ARGS__)
+#else
+#define gdbstub_io(FMT,...) ({ 0; })
+#endif
+
 #ifdef GDBSTUB_DEBUG_PROTOCOL
 #define gdbstub_proto(FMT,...) gdbstub_printk(FMT,##__VA_ARGS__)
 #else
arch/frv/kernel/gdb-io.c +2 -2
index c997bcc..2ca641d 100644
@@ -171,11 +171,11 @@ int gdbstub_rx_char(unsigned char *_ch, int nonblock)
 		return -EINTR;
 	}
 	else if (st & (UART_LSR_FE|UART_LSR_OE|UART_LSR_PE)) {
-		gdbstub_proto("### GDB Rx Error (st=%02x) ###\n",st);
+		gdbstub_io("### GDB Rx Error (st=%02x) ###\n",st);
 		return -EIO;
 	}
 	else {
-		gdbstub_proto("### GDB Rx %02x (st=%02x) ###\n",ch,st);
+		gdbstub_io("### GDB Rx %02x (st=%02x) ###\n",ch,st);
 		*_ch = ch & 0x7f;
 		return 0;
 	}
arch/frv/kernel/gdb-stub.c +61 -0

87 lines not on this page · raw message