Date: Sat, 12 Jun 2004 07:38:46 GMT From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 54707 for review Message-ID: <200406120738.i5C7ckss099311@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=54707 Change 54707 by marcel@marcel_nfs on 2004/06/12 07:38:15 o Fix "info thread" by declaring the iterator as static. o Print received packets when the verbose level > 1. o In gdb_packet() and gdb_packet_data() return whether to quit. Affected files ... .. //depot/projects/gdb/usr.bin/kgdb/packet.c#5 edit Differences ... ==== //depot/projects/gdb/usr.bin/kgdb/packet.c#5 (text+ko) ==== @@ -30,6 +30,7 @@ #include <sys/types.h> #include <assert.h> #include <ctype.h> +#include <err.h> #include <errno.h> #include <fcntl.h> #include <inttypes.h> @@ -55,13 +56,13 @@ 10 + (((c) < 'a') ? (c) - 'A' : (c) - 'a')) #define N2C(n) (((n) < 10) ? (n) + '0' : (n) + 'a' - 10) -static void +static int gdb_packet(void) { - struct kthr *thr_iter; + static struct kthr *thr_iter = NULL; - thr_iter = NULL; - printf("GDB: got '%s'\n", gdb_rxp); + if (verbose > 1) + warnx("gdb_packet: '%s'", gdb_rxp); switch (gdb_rx_char()) { case '?': /* Last signal. */ gdb_tx_begin('S'); @@ -95,6 +96,8 @@ gdb_tx_ok(); break; } + case 'k': /* Kill request. */ + return (1); case 'm': { /* Read memory. */ uintmax_t addr, size; if (gdb_rx_varhex(&addr) || gdb_rx_char() != ',' || @@ -161,16 +164,19 @@ gdb_tx_empty(); break; } + return (0); } /* * Functions to receive and extract from a packet. */ -void +int gdb_packet_data(const char *buf, size_t sz) { + int ret; + ret = 0; switch (gdb_rxstate) { case 0: /* Hunt mode: looking for new packet. */ while (sz > 0 && *buf != '$') { @@ -178,7 +184,7 @@ sz--; } if (sz == 0) - return; + return (0); gdb_rxsz = 0; gdb_rxsum = 0; gdb_rxstate++; @@ -194,7 +200,7 @@ sz--; } if (sz == 0) - return; + return (0); gdb_rxbuf[gdb_rxsz] = 0; gdb_rxsum &= 0xff; gdb_rxstate++; @@ -203,7 +209,7 @@ /* FALLTHROUGH */ case 2: /* First checksum. */ if (sz == 0) - return; + return (0); gdb_rxsum -= (C2N(*buf) << 4) & 0xf0; gdb_rxstate++; buf++; @@ -211,12 +217,12 @@ /* FALLTHROUGH */ case 3: /* Second checksum. */ if (sz == 0) - return; + return (0); gdb_rxsum -= (C2N(*buf)) & 0x0f; if (gdb_rxsum == 0) { gdb_packet_send("+", 1); gdb_rxp = gdb_rxbuf; - gdb_packet(); + ret = gdb_packet(); } else gdb_packet_send("-", 1); gdb_rxstate = 0; @@ -224,6 +230,8 @@ default: assert(0); } + + return (ret); } int
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200406120738.i5C7ckss099311>