From nobody Sat Feb 05 01:59:03 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8ABA919883D4; Sat, 5 Feb 2022 01:59:03 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JrFvC2QCcz4fyJ; Sat, 5 Feb 2022 01:59:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644026343; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CJl5UADDkefmHhpFgtQ836KjmILk3sn6p+hdS1ZYnYk=; b=pxLydRTZXV6yoHqzdJlpez7lB+0EXMR2lAB3z8PpRnHEE78MXoUA0oWcKxYiIqj0wa3CB2 LY0AZjpufu1N5xXYbt28ArTJEIQYbopdSeOGsO7TNrocIJV9Mi3imV6/MkbMYZiHmCNRa6 qY8bsd7WBd46CWQuaBlCvebO2hoH/TKgtzb59cyvvG/dLRM/Tqw//uCpRNeVZs87ozH7Xk y0RMHSt3/uByFZfooPeko+3VFBwOOnGiyGVAxjJDQWHakJhN+p3GIhGajyCdn+7MbiGaw8 a3HIC35SL7FX4vZPLVMTAa+rxLRWSMvKP+a3DQgTHo0EW7h84Q1Q7Hf5MJOrVQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23ED6169FB; Sat, 5 Feb 2022 01:59:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2151x3W3074631; Sat, 5 Feb 2022 01:59:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2151x3dd074630; Sat, 5 Feb 2022 01:59:03 GMT (envelope-from git) Date: Sat, 5 Feb 2022 01:59:03 GMT Message-Id: <202202050159.2151x3dd074630@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 4fa8cb965e73 - stable/12 - gdb(4): Do not use run length encoding for 3-symbol repetitions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4fa8cb965e73421df00ac5c724aa27b8a117fc32 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644026343; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CJl5UADDkefmHhpFgtQ836KjmILk3sn6p+hdS1ZYnYk=; b=BBpU2UnipcarHSB7WsopRnTl0SFgVNsD3T/n85wLpFdqFf+AwqgYfUDc/TvjshHkZqJaHf cktxdg3OOfQqV3JRLudblLvX3M1JU8ZcJ4SAwFkcVis6wihEaKliBFWlyZkFKVqrWN67Rv BKkh8osHjrXDCMGRjoB/xsVRDFzkXq3oAzDQt438Qe7y72VTM4QPiEbrJua8txazRYwtVp VKrK61ugDJUghCpVK/oix9QVboJtvO63FuW1k5luBUVz6zjR7a3Onae+SAcYevR2CYr+Fh nJz92lr/mRcF5xGFXvvqo8bsWOfhpNR/U6MeLy5x7ojsGmadcVvCkXawRCjdZg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644026343; a=rsa-sha256; cv=none; b=QD4aAeLoRm8aGp/PpQCn5r78P7JoollMl9R5wcHNgI2shB7TVada/VVgxieTsqjhSc2zZX L8cvYWC91LS7bJQ/+X13vg2fj3R+TUVG9Ro0NC2JhVxzz5RFCx+hPTXdvv6VeIIGBBGdH5 5dKw2dKP0LrUg8dqoP3peEvlNtgaheXGLH4Hbb+djBNKh/dNNTeFXBhjyooOL99RQcDaf9 nsK4cQoO1QlWpS7WSBHiXTNEISH/KJTAZJ+0FDvnM+XZ8t3BUy9qicXQ/f3Ty7AZum8hO3 FrNtWkKeUV6g+RrtVbjJM63hYGn/0NwxXPKmKC6CDoe4DpP9vJhiUTDNxJ8LWA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=4fa8cb965e73421df00ac5c724aa27b8a117fc32 commit 4fa8cb965e73421df00ac5c724aa27b8a117fc32 Author: Michał Górny AuthorDate: 2022-01-10 03:03:46 +0000 Commit: Ed Maste CommitDate: 2022-02-05 01:15:50 +0000 gdb(4): Do not use run length encoding for 3-symbol repetitions Disable the gdb packet run length encoding for 3-symbol repetitions. While it is technically possible to encode them, they have no advantage over sending the characters verbatim (the resulting length is the same) and they result in sending non-printable \x1f character. The protocol has been designed with the intent of avoiding non-printable characters and therefore the run length encoding is biased to emit \x20 (a space) with the minimal intended run length of 4. While at it, simplify the logic by merging the different 'if' blocks into a single while loop, and moving 'runlen == 0' check lower. Reviewed by: cem, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33686 (cherry picked from commit 028a372fe2658ccf72ed481b9e942b28a59cb178) --- sys/gdb/gdb_packet.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/sys/gdb/gdb_packet.c b/sys/gdb/gdb_packet.c index c74eaaa855b3..32a80a7643e0 100644 --- a/sys/gdb/gdb_packet.c +++ b/sys/gdb/gdb_packet.c @@ -254,24 +254,16 @@ gdb_tx_end(void) runlen--; } } - if (runlen == 1) { + /* Don't emit '$', '#', '+', '-' or a run length below 3. */ + while (runlen == 1 || runlen == 2 || + runlen + 29 == '$' || runlen + 29 == '#' || + runlen + 29 == '+' || runlen + 29 == '-') { gdb_cur->gdb_putc(c); cksum += c; runlen--; } if (runlen == 0) continue; - /* Don't emit '$', '#', '+' or '-'. */ - if (runlen == 7) { - gdb_cur->gdb_putc(c); - cksum += c; - runlen--; - } - if (runlen == 6 || runlen == 14 || runlen == 16) { - gdb_cur->gdb_putc(c); - cksum += c; - runlen--; - } gdb_cur->gdb_putc('*'); cksum += '*'; gdb_cur->gdb_putc(runlen+29);