In article <20150624163947.ga17...@quark.internal.precedence.co.uk>,
Patrick Welche  <pr...@cam.ac.uk> wrote:
>-=-=-=-=-=-
>
>On Wed, Jun 24, 2015 at 04:42:12PM +0100, Patrick Welche wrote:
>> The reason kgdb wasn't working all this time on amd64 is that GETC()
>> returns -1 immediately whether or not a character is available =>
>> all of kgdb's checksums fail due to the extra "-1" characters.
>
>The attached gets us that far.
>(Next the target suffers a lock panic on receipt of a "m" command)
>

How about this?

christos

Index: kgdb_stub.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kgdb_stub.c,v
retrieving revision 1.28
diff -u -u -r1.28 kgdb_stub.c
--- kgdb_stub.c 21 Sep 2014 17:17:15 -0000      1.28
+++ kgdb_stub.c 24 Jun 2015 17:49:54 -0000
@@ -85,8 +85,17 @@
 static u_char buffer[KGDB_BUFLEN];
 static kgdb_reg_t gdb_regs[KGDB_NUMREGS];
 
-#define GETC() ((*kgdb_getc)(kgdb_ioarg))
-#define PUTC(c)        ((*kgdb_putc)(kgdb_ioarg, c))
+#define GETC() kgdb_waitc(kgdb_ioarg)
+#define PUTC(c)        (*kgdb_putc)(kgdb_ioarg, c)
+
+static int
+kgdb_waitc(void *arg)
+{
+       int c;
+       while ((c = (*kgdb_getc)(arg)) == -1)
+               continue;
+       return c;
+}
 
 /*
  * db_trap_callback can be hooked by MD port code to handle special

Reply via email to