From nobody Sat Feb 05 01:58:50 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 5005419BFFFE; Sat, 5 Feb 2022 01:58:50 +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 4JrFty1kZ7z4ffM; Sat, 5 Feb 2022 01:58:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644026330; 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=ADHA3Ds0H0lvgXpUNbZ1dCX4vXFG85migtLHk3G4W0A=; b=DMPOHUy8+J1ijPXNkJAtUf9Xh/dUcSCoXKOmA/iWLr80+wlLWXwvZ+t7buK8I9IX3Esz2u GjP49qYmsnkgesOOvMoUjGd3alZ++8SseGd8EIhThWf7lvLVRfLGe4Xwm9t9SJUN2amCU4 7c9/Jn3FBLSyZbIUfTGkRQndz5349+j4vbdot7rrkjswGrimvhUZi5xlRhZmGiCwVYCucV Mlxk5MJoTM2lyr3Olf2yNeyarYT2E4WApkxV3QqE/sV7z6Y5919Q++smns32MlHeCOUB0H R0YRnsV9sgAng7+X20vPPaQyuG00TuurTvOnT864Dq2s4TUIQHlX7Btd8P7AEA== 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 1AEEC169FA; Sat, 5 Feb 2022 01:58:50 +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 2151woaJ074505; Sat, 5 Feb 2022 01:58:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2151wojB074504; Sat, 5 Feb 2022 01:58:50 GMT (envelope-from git) Date: Sat, 5 Feb 2022 01:58:50 GMT Message-Id: <202202050158.2151wojB074504@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: 93627e0a18d4 - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 93627e0a18d40370b64c9da558adfd8a59a5cfb6 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644026330; 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=ADHA3Ds0H0lvgXpUNbZ1dCX4vXFG85migtLHk3G4W0A=; b=bOSc8emePx79SaudMai/TEKBIZMLc9kAfbu+EsnIfdqgnJWyDWld9xtaxGtkX2JRWPK2zY dcdR5tgf028RYu2ojxmUM5/j1uPvrIfea49veJJpVJCOGPasaIrDozI9N5pPoY6I1MFIfM G0NPEVSaKlObDxMdM/OvcrkenW4NE+yIS/0c1Xc92clqy3Om2TWdvMsIS/VwrLWWCvSFWs ZtUySOZfbBFrkCv2z7YhA8pQVBswb9LPDWf6AR7iWluEHez7f2VMl6KbCGtcrwDVOpkaJF 1wN/H+Pdi9FBuC5PToxlEApF7tcHLtytM0eJP2k09pQXJI0H5mGCVVThx2tBpg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644026330; a=rsa-sha256; cv=none; b=ShZKUEiJHrZB8xqrPzFUvkXva1xF+CIzqRYs0rutXaeechbjKEd/hl6nlU34xA4om1PCG4 ROoTUcpfpjbpplj95eMway3IC7gE7uci+4eZFjeNS0lKBtciGeyZ1H7XKLS0+m2A4MFyNs wSv5Qmv/we45GghxKNZgVS7vfvq/WGWp/b+m4GcHCMBjtY1eE1NALh6o+7gsWKvXIwKrs2 1ZN59eS/MbIZyjYTd31+Mq737BuBQ0Dlsxz4NQk8bhkeAq93lGYa8H3eOK8xm3tT+peoz8 ZC9NV4K3vckzSHC81p2d4VddPZO6VwNpwLiVWxcxQIVulx2oGCoE+cq131clJQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=93627e0a18d40370b64c9da558adfd8a59a5cfb6 commit 93627e0a18d40370b64c9da558adfd8a59a5cfb6 Author: Michał Górny AuthorDate: 2022-01-10 03:03:46 +0000 Commit: Ed Maste CommitDate: 2022-02-05 01:58:34 +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 9a85184eb49a..11ed5358848d 100644 --- a/sys/gdb/gdb_packet.c +++ b/sys/gdb/gdb_packet.c @@ -315,24 +315,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);