From nobody Sat Jan 22 19:46:31 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 E3D3319727A1; Sat, 22 Jan 2022 19:46:31 +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 4Jh6FM58H1z3qfc; Sat, 22 Jan 2022 19:46:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642880791; 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=izQ5ur5U9FT3XKdS2ezfQkfZoh/AHGP2DBu0Qo0yf4I=; b=W3YkZkQBDk5Agkzh28o8zizeSTNl1oJUsqMmaBiw0t1kzv5yYYQPxF5NKdYM2u0WR/0BPV pAHiMhv2VAbL/21U8Cc0EVWloll6Qfau/6CsITHXMpXVf4HRdeS8e1clpZsNhtOZvf2mR/ W6s4KoeidLqVfNUx+ueGNIjA0wv8DrdYUMSNa3djl5lRnI4SfJBo074DqY98jAoytdfjG9 /qjCIO0WSoFD6LZJezoWPyGMP+mWr8PfXQySa/vZIbV81D9hcTCHEU7v97F7TmKYbpUedd 2R2Kr++v93/5T6wn8NjRCZihoOt1hEJb1XTma0HueHIGrwIxYzOPRHFlYWcOAg== 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 8269215128; Sat, 22 Jan 2022 19:46:31 +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 20MJkVKZ013850; Sat, 22 Jan 2022 19:46:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20MJkVZq013849; Sat, 22 Jan 2022 19:46:31 GMT (envelope-from git) Date: Sat, 22 Jan 2022 19:46:31 GMT Message-Id: <202201221946.20MJkVZq013849@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 028a372fe265 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 028a372fe2658ccf72ed481b9e942b28a59cb178 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642880791; 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=izQ5ur5U9FT3XKdS2ezfQkfZoh/AHGP2DBu0Qo0yf4I=; b=QVm7MJKrc9NT0sQO7p+STC8jNiBIh3r2uOhxrp8hGyH9q6Y1uejOWZ9s2nRIbDAfxU9DCE Vdp6IXEWUydev5D+8MPVBkuxPed9NshkPSic4M4hDY+bSPnw8SoBTEc6MC0HqVNRz+kc4u zw729kcWnoyKNEYC3ArSkPLvTKyyE4h2VUbcwkb9t0z9XHG6C3K4VpcSzwX9A8SGT0KdoA vPdPh7cMWNrKto4tiCv4SM0UqUajLLJDYHq04WafuPwNoZWwNPX83loMkrZi9jc3ygJ3Fq TxdgcCWE0BwNY4zoKmUX6qT324q7ti1NnQB57tfBFlMqbcMvq0sG7lk94pFXnA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642880791; a=rsa-sha256; cv=none; b=QIDsjSjJ50i4K3E4DWAHKgB28N5MXRQb68ziAcZcG/FJZTolwKZCKIlt9Il9RPGqSuB4nT HZBtFy9G4/OT7OCaJanS9HSzav/uQV2Q7DAK76fifxZmL+VRFn8b3xreKP+V1YLL/YMgU/ Ywi1JoNwHaJx4yNa9BOsyz/6nghOTb205G9uUqyZVHvifheTMIzPABwNdyn8JElob3awiQ A1BIbRWBM0Yvh4ebd7peeuV8mE5ZZKVDmmxOtT1Dy0W2sr/1fweS5+a8TD1eYqqyh5tzZc SyDHlTlLkZJUtt2IUnQQXIif0t36f1BOprALQ2SKbDgqbIqtzav8j/1yWsq4HA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=028a372fe2658ccf72ed481b9e942b28a59cb178 commit 028a372fe2658ccf72ed481b9e942b28a59cb178 Author: Michał Górny AuthorDate: 2022-01-10 03:03:46 +0000 Commit: Ed Maste CommitDate: 2022-01-22 19:46:06 +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 --- 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);