From owner-svn-src-all@freebsd.org Thu Aug 22 00:36:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B353FD8EF0; Thu, 22 Aug 2019 00:36:17 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DQZ94Jgrz3JmP; Thu, 22 Aug 2019 00:36:17 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75C2A23E80; Thu, 22 Aug 2019 00:36:17 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7M0aHpj088230; Thu, 22 Aug 2019 00:36:17 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7M0aHHJ088228; Thu, 22 Aug 2019 00:36:17 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201908220036.x7M0aHHJ088228@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 22 Aug 2019 00:36:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351370 - head/sys/gdb X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/gdb X-SVN-Commit-Revision: 351370 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Aug 2019 00:36:17 -0000 Author: cem Date: Thu Aug 22 00:36:16 2019 New Revision: 351370 URL: https://svnweb.freebsd.org/changeset/base/351370 Log: gdb(4): Style No functional change. I was surprised to find that no sys/ header already defines the -1 EOF convention anywhere, so defined one locally. Modified: head/sys/gdb/gdb_int.h head/sys/gdb/gdb_main.c head/sys/gdb/gdb_packet.c Modified: head/sys/gdb/gdb_int.h ============================================================================== --- head/sys/gdb/gdb_int.h Thu Aug 22 00:35:17 2019 (r351369) +++ head/sys/gdb/gdb_int.h Thu Aug 22 00:36:16 2019 (r351370) @@ -31,6 +31,10 @@ #ifndef _GDB_GDB_INT_H_ #define _GDB_GDB_INT_H_ +#ifndef EOF +#define EOF (-1) +#endif + extern struct gdb_dbgport *gdb_cur; extern int gdb_listening; @@ -54,7 +58,7 @@ gdb_rx_char(void) c = *gdb_rxp++; gdb_rxsz--; } else - c = -1; + c = EOF; return (c); } Modified: head/sys/gdb/gdb_main.c ============================================================================== --- head/sys/gdb/gdb_main.c Thu Aug 22 00:35:17 2019 (r351369) +++ head/sys/gdb/gdb_main.c Thu Aug 22 00:36:16 2019 (r351370) @@ -653,7 +653,10 @@ gdb_trap(int type, int code) case 'H': { /* Set thread. */ intmax_t tid; struct thread *thr; - gdb_rx_char(); + + /* Ignore 'g' (general) or 'c' (continue) flag. */ + (void) gdb_rx_char(); + if (gdb_rx_varhex(&tid)) { gdb_tx_err(EINVAL); break; @@ -768,7 +771,7 @@ gdb_trap(int type, int code) gdb_tx_err(ENOENT); break; } - case -1: + case EOF: /* Empty command. Treat as unknown command. */ /* FALLTHROUGH */ default: Modified: head/sys/gdb/gdb_packet.c ============================================================================== --- head/sys/gdb/gdb_packet.c Thu Aug 22 00:35:17 2019 (r351369) +++ head/sys/gdb/gdb_packet.c Thu Aug 22 00:36:16 2019 (r351370) @@ -197,7 +197,7 @@ gdb_rx_varhex(uintmax_t *vp) v += C2N(c); c = gdb_rx_char(); } while (isxdigit(c)); - if (c != -1) { + if (c != EOF) { gdb_rxp--; gdb_rxsz++; } @@ -343,13 +343,12 @@ gdb_rx_bindata(unsigned char *data, size_t datalen, si while (*amt < datalen) { c = gdb_rx_char(); - /* End of packet? */ - if (c == -1) + if (c == EOF) break; /* Escaped character up next */ if (c == '}') { - /* Truncated packet? Bail out */ - if ((c = gdb_rx_char()) == -1) + /* Malformed packet. */ + if ((c = gdb_rx_char()) == EOF) return (1); c ^= 0x20; }