From unknown Sat Aug 16 16:20:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#66363: gdb-control-commands-regexp issues Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Oct 2023 15:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 66363 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 66363@debbugs.gnu.org X-Debbugs-Original-To: Emacs Bug Report Received: via spool by submit@debbugs.gnu.org id=B.16965184754158 (code B ref -1); Thu, 05 Oct 2023 15:08:01 +0000 Received: (at submit) by debbugs.gnu.org; 5 Oct 2023 15:07:55 +0000 Received: from localhost ([127.0.0.1]:48172 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoPxC-00014z-L3 for submit@debbugs.gnu.org; Thu, 05 Oct 2023 11:07:54 -0400 Received: from lists.gnu.org ([2001:470:142::17]:47732) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoPxA-00013S-Ak for submit@debbugs.gnu.org; Thu, 05 Oct 2023 11:07:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qoPwm-0007PJ-N3 for bug-gnu-emacs@gnu.org; Thu, 05 Oct 2023 11:07:28 -0400 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qoPwl-0007yq-29 for bug-gnu-emacs@gnu.org; Thu, 05 Oct 2023 11:07:28 -0400 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2c007d6159aso12779171fa.3 for ; Thu, 05 Oct 2023 08:07:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696518444; x=1697123244; darn=gnu.org; h=to:date:message-id:subject:mime-version:from:sender:from:to:cc :subject:date:message-id:reply-to; bh=pvs7/8NX310UTfzcLLySStEEuP1fmylICxtYvf9VMGA=; b=Xq5GQhxjyBklP4q5knINbPepv2MIBPbXqbKfef3yz8682/4qcTqdiCso0i6996vsWB O2Szx97mKmHxXl6DXPmx2O2/PmUPH8XhJe9ZDzI9yAvcnRtTz4Lt2dLixdkf+Svap5q3 XietuT0C1rLi4iN7llgmIu2iMvbZ9vy51olMZLX859/eDMs8usTZMY60yndD1dsEcxwk RDa0MOem979FbARV+W9/BvSLN88LElRzbV37pVNJ7QGypUQ3Ar6m/E3zLTVG44ihXAgx zxJeM+ngbrDaagNHxXYsJFbBGXAng8YcHXMl/jMILkj+HhJTEq9APyjijAHxczavGMzF /zSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696518444; x=1697123244; h=to:date:message-id:subject:mime-version:from:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pvs7/8NX310UTfzcLLySStEEuP1fmylICxtYvf9VMGA=; b=MP4XY2Q8DvNhhbTUvh86A9TGaMLvs6SPUTY/3i3bkcf0qgGxr4I8XuEeAYqBokzDEl 05YsiQ6//D65zsvpLxSsjf40G91p4KVl9lUH3to0u20fg+g3fK2zYtg7ywofkxIrediR WqY0u4F/oNIs8acSmPJJmIu5Ns6FKwycRuf6uxs8JMHDpv4CTa1YrRxXkXbAz+5oI1X1 8J7IfYd0oqGnR00YjTgYJy1LFRskgiqOXEz2UakR43HqO3Akq5w/6kloKiPbGM2I0FJ/ Ol5zFZZxTT+uJhJC6z1EdD13sQcnm8vx0MtAN06cVKIM2RAGVkWeg7O1oCwAdIHWZiRD niXQ== X-Gm-Message-State: AOJu0Yw1GfeQVmEw+9heXtPcy/3FB8NoOJMjtwfbyt1sg4RplC2d8Zu0 SSYydPwsspbSExZQKozR6H6wdRS0SIWetg== X-Google-Smtp-Source: AGHT+IF2sUpqu7HZ9agFL1LvdCMeI4/VK43X5c7XeIDBGMWVX6rCXkF+MAjFCk95m4DlO8Q/ICYORA== X-Received: by 2002:a2e:9650:0:b0:2c2:774b:3cd2 with SMTP id z16-20020a2e9650000000b002c2774b3cd2mr4982253ljh.21.1696518444335; Thu, 05 Oct 2023 08:07:24 -0700 (PDT) Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se. [188.150.165.235]) by smtp.gmail.com with ESMTPSA id w11-20020a2e998b000000b002bffbe767cbsm337452lji.85.2023.10.05.08.07.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Oct 2023 08:07:23 -0700 (PDT) From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Content-Type: multipart/mixed; boundary="Apple-Mail=_D8559FD7-289D-4999-9076-9E4C4A7DE69C" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Message-Id: Date: Thu, 5 Oct 2023 17:07:22 +0200 X-Mailer: Apple Mail (2.3654.120.0.1.15) Received-SPF: pass client-ip=2a00:1450:4864:20::233; envelope-from=mattias.engdegard@gmail.com; helo=mail-lj1-x233.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --Apple-Mail=_D8559FD7-289D-4999-9076-9E4C4A7DE69C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii The variable `gdb-control-commands-regexp` in gdb-mi.el cannot work as = currently defined and used. Only group 3 is of interest, but that group = hasn't referred to anything useful for several years. Group 3 probably refers to a part of the regex's tail where the command = argument is matched: "\\([[:blank:]]+\\([^[:blank:]]*\\)\\)*$" However, this seems to be broken as well, because all groups here are = inside repetitions. This part of the regexp is also exponential in form = if not in practice but we'd better simplify it anyway. Attached is a suggested patch which makes explicit the command = abbreviations matched, and leaves only a single submatch. It also = changes the tail to assuming that the command argument doesn't contain = non-newlines (or the final eol anchor wouldn't make sense) but that it = can contain spaces (which seems reasonable). However, right now the = argument is only checked for being non-empty or not. I don't have a working gdb setup at the moment so if someone would be = kind to test it, I would be very grateful for it. --Apple-Mail=_D8559FD7-289D-4999-9076-9E4C4A7DE69C Content-Disposition: attachment; filename=gdb-control-commands-regexp.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="gdb-control-commands-regexp.diff" Content-Transfer-Encoding: quoted-printable diff=20--git=20a/lisp/progmodes/gdb-mi.el=20b/lisp/progmodes/gdb-mi.el=0A= index=20bc0070d2630..f7e96a2f19e=20100644=0A---=20= a/lisp/progmodes/gdb-mi.el=0A+++=20b/lisp/progmodes/gdb-mi.el=0A@@=20= -1960,19=20+1960,28=20@@=20breakpoint-disabled=0A=20=20=20:group=20'gdb)=0A= =20=0A=20=0C=0A+(rx-define=20gdb-python-guile-commands=0A+=20=20(or=20= "python"=20"python-interactive"=20"pi"=20"guile"=20"guile-repl"=20"gr"))=0A= +=0A=20(defvar=20gdb-python-guile-commands-regexp=0A-=20=20= "python\\|python-interactive\\|pi\\|guile\\|guile-repl\\|gr"=0A+=20=20= (rx=20gdb-python-guile-commands)=0A=20=20=20"Regexp=20that=20matches=20= Python=20and=20Guile=20commands=20supported=20by=20GDB.")=0A=20=0A=20= (defvar=20gdb-control-commands-regexp=0A-=20=20(concat=0A-=20=20=20= "^\\("=0A-=20=20=20"comm\\(a\\(n\\(ds?\\)?\\)?\\)?\\|if\\|while"=0A-=20=20= =20"\\|def\\(i\\(ne?\\)?\\)?\\|doc\\(u\\(m\\(e\\(nt?\\)?\\)?\\)?\\)?\\|"=0A= -=20=20=20gdb-python-guile-commands-regexp=0A-=20=20=20= "\\|while-stepping\\|stepp\\(i\\(ng?\\)?\\)?\\|ws\\|actions"=0A-=20=20=20= "\\|expl\\(o\\(re?\\)?\\)?"=0A-=20=20=20= "\\)\\([[:blank:]]+\\([^[:blank:]]*\\)\\)*$")=0A+=20=20(rx=20bol=0A+=20=20= =20=20=20=20(or=20"comm"=20"comma"=20"comman"=20"command"=20"commands"=0A= +=20=20=20=20=20=20=20=20=20=20"if"=20"while"=0A+=20=20=20=20=20=20=20=20= =20=20"def"=20"defi"=20"defin"=20"define"=0A+=20=20=20=20=20=20=20=20=20=20= "doc"=20"docu"=20"docum"=20"docume"=20"documen"=20"document"=0A+=20=20=20= =20=20=20=20=20=20=20"while-stepping"=0A+=20=20=20=20=20=20=20=20=20=20= "stepp"=20"steppi"=20"steppin"=20"stepping"=0A+=20=20=20=20=20=20=20=20=20= =20"ws"=20"actions"=0A+=20=20=20=20=20=20=20=20=20=20"expl"=20"explo"=20= "explor"=20"explore"=0A+=20=20=20=20=20=20=20=20=20=20= gdb-python-guile-commands)=0A+=20=20=20=20=20=20(?=20(+=20blank)=0A+=20=20= =20=20=20=20=20=20=20(group=20=20=20=20=20=20=20;=20Group=201=20contains=20= the=20command=20arguments.=0A+=20=20=20=20=20=20=20=20=20=20(*=20nonl)))=0A= +=20=20=20=20=20=20eol)=0A=20=20=20"Regexp=20matching=20GDB=20commands=20= that=20enter=20a=20recursive=20reading=20loop.=0A=20As=20long=20as=20GDB=20= is=20in=20the=20recursive=20reading=20loop,=20it=20does=20not=20expect=0A= =20commands=20to=20be=20prefixed=20by=20\"-interpreter-exec=20= console\".")=0A@@=20-2033,7=20+2042,7=20@@=20gdb-send=0A=20=20=20;;=20= Python=20and=20Guile=20commands=20that=20have=20an=20argument=20don't=20= enter=20the=0A=20=20=20;;=20recursive=20reading=20loop.=0A=20=20=20(let*=20= ((control-command-p=20(string-match=20gdb-control-commands-regexp=20= string))=0A-=20=20=20=20=20=20=20=20=20(command-arg=20(and=20= control-command-p=20(match-string=203=20string)))=0A+=20=20=20=20=20=20=20= =20=20(command-arg=20(and=20control-command-p=20(match-string=201=20= string)))=0A=20=20=20=20=20=20=20=20=20=20(python-or-guile-p=20= (string-match=20gdb-python-guile-commands-regexp=0A=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20string)))=0A=20=20=20=20=20(if=20(and=20= control-command-p=0A= --Apple-Mail=_D8559FD7-289D-4999-9076-9E4C4A7DE69C-- From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 05 11:13:07 2023 Received: (at control) by debbugs.gnu.org; 5 Oct 2023 15:13:07 +0000 Received: from localhost ([127.0.0.1]:48212 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoQ2F-0001H7-6D for submit@debbugs.gnu.org; Thu, 05 Oct 2023 11:13:07 -0400 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]:47246) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoQ2C-0001Gd-PK for control@debbugs.gnu.org; Thu, 05 Oct 2023 11:13:05 -0400 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2bffa8578feso13555381fa.2 for ; Thu, 05 Oct 2023 08:12:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696518760; x=1697123560; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=roHBLlYf3oOg1bOfiSDFZe758ieC6/FJVOjOgnAYmq8=; b=alOVJv9wg2ckxMYiN3WkiKXy5nAJ9MpguczMz9MKMfw9gG5izJzfesoc51h6VIP/Fr 4f1HNLtMJWF5iKcySjIB2+MmEaZ6lCX1MgaJG8X14Plrb5/AD58zXxwcsq+cwnvs8M4g tQsDtCIO+dx8RQY+UxfWo4+dMpTt+3Pe99HW5aiBFkRaW7E0A55AYbhOCd1DxcH9U7Hl kUIYrJwA+KbX53DeoP3bj0mOK/plvrLXzeXu+K67VZRxUQfjzEedpvNtZXVW8XnGTjZ8 +WoypGJGJNEI1lCyv7ur6B1TI/Y9zWhcqjMh06nXdQFMOuJc9aS2aJksvuJ3hQjGbjks wZqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696518760; x=1697123560; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=roHBLlYf3oOg1bOfiSDFZe758ieC6/FJVOjOgnAYmq8=; b=vclZQaBzlIy7UBmWpGVoFQrHpmbmPMK11MKNUh5V5zbRmGaeopnWMqdjmo8EcEQM61 zYW5zhlpgTuHxm2uty2zSAu1XC8NW8Z1NnZpTSHkLT6mSTEJXWtfFis+HY8/VcmOtYRb AKQennjqhxr5wMkMv1HnigIa3jfqZ6f6owrSHA73gwPiZamFh/gR2FRtMarv88uyuR2I FUKM5he5NByqgOkxU4F1broXBzQ3Dby479XO0p8aeDPigS5/MHQax5OcLsaERCud/oCj wAMqPHIyhuN36IM6fHq1g8PhTS57tZbyYQQHogzDASxL41+KdGEOe3ugK7UKaaa6r3CF nfUw== X-Gm-Message-State: AOJu0YzXSIUzSlQnLsHFkk5PwywXYLNohcfI0RFvrieonsyzy7zvBJRy 9JFKHWsNt8cRDWW2boDhRJfWO1E/lt/V5rJDHy9g+nhM X-Google-Smtp-Source: AGHT+IHlRYC944VjNh++YAR19jXJBBCu8zCGOCoeskIxkQm1hWhbbC4+4xOPN1hgI7XqZvizJsHQMtKIeZL2oqnOjUA= X-Received: by 2002:a2e:7e0b:0:b0:2c0:2ef8:9716 with SMTP id z11-20020a2e7e0b000000b002c02ef89716mr5332433ljc.1.1696518760216; Thu, 05 Oct 2023 08:12:40 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 5 Oct 2023 15:12:39 +0000 From: Stefan Kangas MIME-Version: 1.0 Date: Thu, 5 Oct 2023 15:12:39 +0000 Message-ID: Subject: To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: tags 66363 + patch thanks Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stefankangas[at]gmail.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:232 listed in] [list.dnswl.org] 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines 2.0 BLANK_SUBJECT Subject is present but empty X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) tags 66363 + patch thanks From unknown Sat Aug 16 16:20:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#66363: gdb-control-commands-regexp issues Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Oct 2023 16:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66363 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Cc: 66363@debbugs.gnu.org Received: via spool by 66363-submit@debbugs.gnu.org id=B66363.169652336420513 (code B ref 66363); Thu, 05 Oct 2023 16:30:02 +0000 Received: (at 66363) by debbugs.gnu.org; 5 Oct 2023 16:29:24 +0000 Received: from localhost ([127.0.0.1]:48363 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoRE3-0005Km-NJ for submit@debbugs.gnu.org; Thu, 05 Oct 2023 12:29:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48564) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoRE1-0005KV-OV for 66363@debbugs.gnu.org; Thu, 05 Oct 2023 12:29:22 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qoRDe-0007SL-0b; Thu, 05 Oct 2023 12:28:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=UBfYer3NrUKY08M7roLHBEFZrfpyC0rMjP30WsWDJqA=; b=gQbXacHc+8JxNONFO+ED vuKttk38Gb4pY9H4I9wr3c9DyaY3WU2JvTdbWYVxZ4nJ43JZgCMYTrHltJ8oyhzTrkMgYiAJeQNHW GL4wS4oEf+fgmtMgawtZnnN4bnsR/fz+UW+J2r6yiEtn5cvSc6PfdvPLTdkCT1tyGRCmL8SDrU5Vz wfonSUrEIu0eb6BFzIpEbVO20RKRQyBGJ4w3/oPPI2UwfN+ixW6S0/xNju+v/EHHrPS+zuYnRKmJO XHHHNtrQIwQITe4Yy+BDl2j1jZbzzsUBYDwOu6cIvZTwV84MlBt5vLgCnu0h+4oa2Wlm13JFH7ljc 1RdqcH/dfll6Ag==; Date: Thu, 05 Oct 2023 19:29:06 +0300 Message-Id: <83wmw12fu5.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= on Thu, 5 Oct 2023 17:07:22 +0200) References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Mattias Engdegård > Date: Thu, 5 Oct 2023 17:07:22 +0200 > > The variable `gdb-control-commands-regexp` in gdb-mi.el cannot work as currently defined and used. Only group 3 is of interest, but that group hasn't referred to anything useful for several years. > > Group 3 probably refers to a part of the regex's tail where the command argument is matched: > > "\\([[:blank:]]+\\([^[:blank:]]*\\)\\)*$" > > However, this seems to be broken as well, because all groups here are inside repetitions. This part of the regexp is also exponential in form if not in practice but we'd better simplify it anyway. > > Attached is a suggested patch which makes explicit the command abbreviations matched, and leaves only a single submatch. It also changes the tail to assuming that the command argument doesn't contain non-newlines (or the final eol anchor wouldn't make sense) but that it can contain spaces (which seems reasonable). However, right now the argument is only checked for being non-empty or not. > > I don't have a working gdb setup at the moment so if someone would be kind to test it, I would be very grateful for it. I'd appreciate a few examples of using this that don't work correctly (or not at all), as it is otherwise not easy to understand the problem, and much less the proposed solution and how to test it. TIA From unknown Sat Aug 16 16:20:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#66363: gdb-control-commands-regexp issues Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Oct 2023 17:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66363 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 66363@debbugs.gnu.org Received: via spool by 66363-submit@debbugs.gnu.org id=B66363.169652622125330 (code B ref 66363); Thu, 05 Oct 2023 17:17:02 +0000 Received: (at 66363) by debbugs.gnu.org; 5 Oct 2023 17:17:01 +0000 Received: from localhost ([127.0.0.1]:48450 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoRy8-0006aS-Kl for submit@debbugs.gnu.org; Thu, 05 Oct 2023 13:17:01 -0400 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]:42384) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoRy7-0006aG-8J for 66363@debbugs.gnu.org; Thu, 05 Oct 2023 13:16:59 -0400 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2c1807f3400so15577431fa.1 for <66363@debbugs.gnu.org>; Thu, 05 Oct 2023 10:16:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696526195; x=1697130995; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date:message-id:reply-to; bh=bYmK62RKzLwsfwoN/qVyd5ViqUEV6LofD1yJsS1RMQE=; b=Z125sbEYpu2Dds3C1VsS5XPA3I3OI96z7jPnYhoSBiBYw/c7mW+YXk8JxeG4RSrxAK UoVeY/9sOrKBe1Z9LsUh+LeNIgRhNsOCb8G/5Ah+RF0H/tAr03Bf/tTQz7E1AORegtlo 28uY2eAOxIUUcSdl0IiFiP/3yUz52Nby/XNds4h2hwYvktXu/Qo6HMv/4wSXFVrH4HvN hYw7LFIXENnRNC8kvT0eOFYw/6NQV9YjgW3loUf/zAS/hLmcak0ARasFBIBpb3DtC5Kr 32vPTzL5+H9J3J5epgYS8tMjW9OrjDBbMLh84Rl9H0l2CBN89VQZMCZkX7H3fUfJrAuL MIAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696526195; x=1697130995; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=bYmK62RKzLwsfwoN/qVyd5ViqUEV6LofD1yJsS1RMQE=; b=tn3AgwSANKYkfoBY92iGuGg5BxleBWf4nX0mqBRf0zXBiL9ebrGwToSh+SEULfcLzq UEMP62t0vAwBdKRfjvi0GSb+J9djIya/hXsFf4gXZdLdsEpBXE/WZoqDuWoDdY2LvNVc 4wFRP7AY7/8YX4mnfWfsic6k6ejaNfABy1ClY8L2TfgvS5vceI76ViE4yw33A18xhaN2 RG88xalTaz3iyJR7NxIhffofR2abhvN48+8p7vFc1ycYljUp1JThB3erKbwQ/dp/YPy7 jkQ+CjmFIT8WlBgKkULupWC9yiQ1ierd9+KlUxilLeQq1miIpaJLvrDs+WRk7iwcKkBs v4KA== X-Gm-Message-State: AOJu0YygaFnn6iOjaS2SivHE7ZWCBPRTHCdeOfCk1xkcRty5JVe+S+vU E8DPjcNi56anebCcHlS5onM= X-Google-Smtp-Source: AGHT+IEzLikH/rptHAHWrRZrh8pxM2Ck8hntBFfKlH1uoZuwlzs82k45MfK2Nic7yyk2/hYHoxyB3A== X-Received: by 2002:a2e:9347:0:b0:2c0:7d6:570b with SMTP id m7-20020a2e9347000000b002c007d6570bmr2314315ljh.26.1696526194650; Thu, 05 Oct 2023 10:16:34 -0700 (PDT) Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se. [188.150.165.235]) by smtp.gmail.com with ESMTPSA id w23-20020a2e8217000000b002b9f03729e2sm373906ljg.36.2023.10.05.10.16.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Oct 2023 10:16:33 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= In-Reply-To: <83wmw12fu5.fsf@gnu.org> Date: Thu, 5 Oct 2023 19:16:32 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <83wmw12fu5.fsf@gnu.org> X-Mailer: Apple Mail (2.3654.120.0.1.15) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > I'd appreciate a few examples of using this that don't work correctly > (or not at all), as it is otherwise not easy to understand the > problem, and much less the proposed solution and how to test it. I don't have any examples but the problems are clear from reading the = code. The regexp is defined by: > (defvar gdb-python-guile-commands-regexp > "python\\|python-interactive\\|pi\\|guile\\|guile-repl\\|gr" > "Regexp that matches Python and Guile commands supported by GDB.") >=20 > (defvar gdb-control-commands-regexp > (concat > "^\\(" > "comm\\(a\\(n\\(ds?\\)?\\)?\\)?\\|if\\|while" > = "\\|def\\(i\\(ne?\\)?\\)?\\|doc\\(u\\(m\\(e\\(nt?\\)?\\)?\\)?\\)?\\|" > gdb-python-guile-commands-regexp > "\\|while-stepping\\|stepp\\(i\\(ng?\\)?\\)?\\|ws\\|actions" > "\\|expl\\(o\\(re?\\)?\\)?" > "\\)\\([[:blank:]]+\\([^[:blank:]]*\\)\\)*$") > "Regexp matching GDB commands that enter a recursive reading loop. > As long as GDB is in the recursive reading loop, it does not expect > commands to be prefixed by \"-interpreter-exec console\".") which results in the string regexp > = "^\\(comm\\(a\\(n\\(ds?\\)?\\)?\\)?\\|if\\|while\\|def\\(i\\(ne?\\)?\\)?\\= |doc\\(u\\(m\\(e\\(nt?\\)?\\)?\\)?\\)?\\|python\\|python-interactive\\|pi\= \|guile\\|guile-repl\\|gr\\|while-stepping\\|stepp\\(i\\(ng?\\)?\\)?\\|ws\= \|actions\\|expl\\(o\\(re?\\)?\\)?\\)\\([[:blank:]]+\\([^[:blank:]]*\\)\\)= *$" It is used in one place only: > (let* ((control-command-p (string-match gdb-control-commands-regexp = string)) > (command-arg (and control-command-p (match-string 3 string))) As you can see it refers to group 3, which is matched by = "\\(n\\(ds?\\)?\\)" -- clearly not what anybody intended. As for the tail, even if the match group is corrected it's a rather = roundabout way of checking whether there is a non-blank character after = the command (and is written using nested repetitions which is how this = came to my attention). For the examples you asked about, perhaps commit 30c0f81f9f which = introduced the now broken mechanism can be of help. From unknown Sat Aug 16 16:20:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#66363: gdb-control-commands-regexp issues Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Oct 2023 17:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66363 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Cc: 66363@debbugs.gnu.org Received: via spool by 66363-submit@debbugs.gnu.org id=B66363.169652783928281 (code B ref 66363); Thu, 05 Oct 2023 17:44:01 +0000 Received: (at 66363) by debbugs.gnu.org; 5 Oct 2023 17:43:59 +0000 Received: from localhost ([127.0.0.1]:48463 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoSOE-0007M5-Ps for submit@debbugs.gnu.org; Thu, 05 Oct 2023 13:43:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38704) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoSOB-0007Lp-Rs for 66363@debbugs.gnu.org; Thu, 05 Oct 2023 13:43:57 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qoSNo-0004kU-5n; Thu, 05 Oct 2023 13:43:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=s52rkA5r1LD3RNCKB6fu8EDFsSmP6sMsEMHKBzue6HI=; b=R2MiY7vl8DcHwTHrGcdB UqcbLNRlFLp+hSb91xnhCwkhT+IL6estGxG1RMhZfL8OOlhekhQUbfXnbCRpK4YDwErCSe4cLSZrp 2TziXvpwS34mqyb4BNkyxQ17C1aFjkNpfIE13Yh2kXtyBX6rvj0+IkZ7kaG7ruCAdzrwuuE/wzYN1 DtcyiRRvW54pqrJ/2S6lO/ard1maPIIM3yzwsDvclykrm2jbjYZa65V7+7vXyUa9GWH2xEmc22btl 4bHmYsn33/VI35DE/WFhKBfNfmdgJyjzgg7IyLTNqqv5zrcHek1hOVy9HoU5uHSmmIpNooUoMQLL1 XCAktFxbNenpew==; Date: Thu, 05 Oct 2023 20:43:40 +0300 Message-Id: <83jzs12cdv.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= on Thu, 5 Oct 2023 19:16:32 +0200) References: <83wmw12fu5.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Mattias Engdegård > Date: Thu, 5 Oct 2023 19:16:32 +0200 > Cc: 66363@debbugs.gnu.org > > > I'd appreciate a few examples of using this that don't work correctly > > (or not at all), as it is otherwise not easy to understand the > > problem, and much less the proposed solution and how to test it. > > I don't have any examples but the problems are clear from reading the code. > The regexp is defined by: > > > (defvar gdb-python-guile-commands-regexp > > "python\\|python-interactive\\|pi\\|guile\\|guile-repl\\|gr" > > "Regexp that matches Python and Guile commands supported by GDB.") > > > > (defvar gdb-control-commands-regexp > > (concat > > "^\\(" > > "comm\\(a\\(n\\(ds?\\)?\\)?\\)?\\|if\\|while" > > "\\|def\\(i\\(ne?\\)?\\)?\\|doc\\(u\\(m\\(e\\(nt?\\)?\\)?\\)?\\)?\\|" > > gdb-python-guile-commands-regexp > > "\\|while-stepping\\|stepp\\(i\\(ng?\\)?\\)?\\|ws\\|actions" > > "\\|expl\\(o\\(re?\\)?\\)?" > > "\\)\\([[:blank:]]+\\([^[:blank:]]*\\)\\)*$") > > "Regexp matching GDB commands that enter a recursive reading loop. > > As long as GDB is in the recursive reading loop, it does not expect > > commands to be prefixed by \"-interpreter-exec console\".") > > which results in the string regexp > > > "^\\(comm\\(a\\(n\\(ds?\\)?\\)?\\)?\\|if\\|while\\|def\\(i\\(ne?\\)?\\)?\\|doc\\(u\\(m\\(e\\(nt?\\)?\\)?\\)?\\)?\\|python\\|python-interactive\\|pi\\|guile\\|guile-repl\\|gr\\|while-stepping\\|stepp\\(i\\(ng?\\)?\\)?\\|ws\\|actions\\|expl\\(o\\(re?\\)?\\)?\\)\\([[:blank:]]+\\([^[:blank:]]*\\)\\)*$" > > It is used in one place only: > > > (let* ((control-command-p (string-match gdb-control-commands-regexp string)) > > (command-arg (and control-command-p (match-string 3 string))) > > As you can see it refers to group 3, which is matched by "\\(n\\(ds?\\)?\\)" -- clearly not what anybody intended. So the problem is only that 3 should be changed to the correct group number? > As for the tail, even if the match group is corrected it's a rather roundabout way of checking whether there is a non-blank character after the command (and is written using nested repetitions which is how this came to my attention). Here you are talking about some optimization of the regexp, or is it another bug? If the latter, what is the bug here? From unknown Sat Aug 16 16:20:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#66363: gdb-control-commands-regexp issues Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Oct 2023 18:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66363 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 66363@debbugs.gnu.org Received: via spool by 66363-submit@debbugs.gnu.org id=B66363.169652951331881 (code B ref 66363); Thu, 05 Oct 2023 18:12:02 +0000 Received: (at 66363) by debbugs.gnu.org; 5 Oct 2023 18:11:53 +0000 Received: from localhost ([127.0.0.1]:48500 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoSpF-0008I8-23 for submit@debbugs.gnu.org; Thu, 05 Oct 2023 14:11:53 -0400 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]:54432) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoSpC-0008Hv-7s for 66363@debbugs.gnu.org; Thu, 05 Oct 2023 14:11:51 -0400 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-503f39d3236so1633103e87.0 for <66363@debbugs.gnu.org>; Thu, 05 Oct 2023 11:11:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696529486; x=1697134286; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date:message-id:reply-to; bh=2BxAN2o59CR8hCqZh+Cnr0FAVu0plOIO01ASTzvXL+M=; b=ZJAUZiP8s5y7Ahy7yypQ1jnLkpjSrD1l2Zm3OT6Ij0WYwwmkLyCKS6f/CFdBDx+Fr7 wASxBIgXc7P1xEuQ6qMqvAfVmgGnv1kWHxo4pjpQYiUGsXTy+H/ih3oRBjQaG2+ZKv7b HBRCay3r7Q/4hiQF9SzVTRxAgWKAVRU9XFooPsNqNAXGC75z4SZMYbRCXQMi05WtC7+D GcdlEOy15GHdUlIN3HGRp2ikZC1ZnYNmH2Y9kKL1/A01q54mZUyuP0b4JibFLGUBiqh8 f95ISOepH9TPEZBg7ieLkwCZPJUkDdEhAujtm4cjMNCAH1Qv7oA+zFwLW2/VZ4be6M99 WabQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696529486; x=1697134286; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=2BxAN2o59CR8hCqZh+Cnr0FAVu0plOIO01ASTzvXL+M=; b=JLHgE37ae706kkP4+dSRQiqKYVD2ey8Xa3pbUutPksZgk9DTeqV6Tvcm1a+BuZJMRz XXgijmurz9IkKzhY+jH1ZBrM9/6WQ3wn02pp2zR/LIF9B+lpXfw8eljYuJT3jXYWE4PG k/Efg6u3jZ1M2zcKvkRlrk0aXFiLTsQrvTmBeGIs66UGHXFe4XSNIvdMWNuUabi0hyUn KM7FhYzZ9955tpXNIFdZgQ38z2eUnO2Mxpli5XrHX8u08u4l+sikeWBmS5lT9J0dvmWG MMvHGz7hfwi5NUehfXdG1+VVKMo1anDyUxugF7RyWmeInoFAGBz6U3P4m4+PkK++q+rK ZsUg== X-Gm-Message-State: AOJu0YzV/RBwzocXchL5KJUXYn1cBAENHhMGVpJFetIzeTv5691/HhL+ BjWEMHaAirj0diy1TrcFl2BmUS7oSxzkyw== X-Google-Smtp-Source: AGHT+IE4/Q849gXmUBYEJxT57sxxwRWQqeMIvjWvL/MWEktNwcRsqjkiSRn76pXMU8UP69TI0RKgDw== X-Received: by 2002:a05:6512:ba0:b0:502:9fce:b6d4 with SMTP id b32-20020a0565120ba000b005029fceb6d4mr6599848lfv.25.1696529485758; Thu, 05 Oct 2023 11:11:25 -0700 (PDT) Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se. [188.150.165.235]) by smtp.gmail.com with ESMTPSA id q25-20020ac24a79000000b0050419b760d0sm389226lfp.17.2023.10.05.11.11.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Oct 2023 11:11:25 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= In-Reply-To: <83jzs12cdv.fsf@gnu.org> Date: Thu, 5 Oct 2023 20:11:24 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <83wmw12fu5.fsf@gnu.org> <83jzs12cdv.fsf@gnu.org> X-Mailer: Apple Mail (2.3654.120.0.1.15) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 5 okt. 2023 kl. 19.43 skrev Eli Zaretskii : > So the problem is only that 3 should be changed to the correct group > number? That would perhaps work, but it wouldn't be a very robust solution. = There are many groups preceding that we don't care about, and the bug = arose precisely because they were added without considering that a group = was being used. Better then to get rid of all groups save the one in use. (The proposed = patch does that.) That would make it much more difficult for the same bug to arise again. > Here you are talking about some optimization of the regexp, or is it > another bug? If the latter, what is the bug here? It's related. When the reference to subgroup 3 was added (30c0f81f9f), = the tail looked like this: "\\([[:blank:]]+\\([^[:blank:]]*\\)\\)?$" ^^^^^^^^^^^^^^^^^^^ and subgroup 3 was the second group in this substring (underlined = above). Later (f71afd600a) the last `?` was changed into a `*`, but that = made the contents of that group somewhat hazy because of the repetition: "\\([[:blank:]]+\\([^[:blank:]]*\\)\\)*$" ^ which doesn't leave us with a useful group for the purpose of detecting = command arguments at all. So the tail of the regexp has to be rewritten anyway, and we might as = well do it in a more straightforward way. (The proposed patch does that = as well.) The reason I found this is that it contains a sub-pattern on the form = (A+B*)* which is super-linear in general but usually easy to fix so that = the result is actually more readable, yet faster. From unknown Sat Aug 16 16:20:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#66363: gdb-control-commands-regexp issues Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Oct 2023 18:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66363 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Cc: 66363@debbugs.gnu.org Received: via spool by 66363-submit@debbugs.gnu.org id=B66363.16965319604310 (code B ref 66363); Thu, 05 Oct 2023 18:53:02 +0000 Received: (at 66363) by debbugs.gnu.org; 5 Oct 2023 18:52:40 +0000 Received: from localhost ([127.0.0.1]:48549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoTSh-00017S-OY for submit@debbugs.gnu.org; Thu, 05 Oct 2023 14:52:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36606) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoTSf-00017C-0l for 66363@debbugs.gnu.org; Thu, 05 Oct 2023 14:52:38 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qoTSH-0008Ig-4l; Thu, 05 Oct 2023 14:52:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=NDZPK+77RPktuHIl5iaZXM9bQYphRiiAKX+L5dm2KlE=; b=NfLkbbsOaJsU/TzQ7YAZ 83KMnGEMwp5uc49Y2p9Ha+AMSseKqWGEPwd6pdbD4FtT0Z7yg+Kmj4IGEmAWXIjXH88F3ndF/tIFp pPvpzHPt9P/lLs90qWTX/LuPIq6X1tCzKc4dl8eVL554lnWZAEInHQSn1KGFMBxfFC8atm58StE9z ThzPSSgOlQ6kowcAe8tgg0z73y0caKixtHQQwRfcMKhgtwxLalA+M0RG3twHFWReQWu5K7A0EANmu GFSihsQ9cEoVqKSrA2wJV2hPw93Zj5Oks24LNMrrMBXXdibm7VD5BXnGHlLZB50X+1+BMtLCH0mp8 kecKQP3VlxRIDw==; Date: Thu, 05 Oct 2023 21:52:21 +0300 Message-Id: <83il7k3nru.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= on Thu, 5 Oct 2023 20:11:24 +0200) References: <83wmw12fu5.fsf@gnu.org> <83jzs12cdv.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Mattias Engdegård > Date: Thu, 5 Oct 2023 20:11:24 +0200 > Cc: 66363@debbugs.gnu.org > > 5 okt. 2023 kl. 19.43 skrev Eli Zaretskii : > > > So the problem is only that 3 should be changed to the correct group > > number? > > That would perhaps work, but it wouldn't be a very robust solution. There are many groups preceding that we don't care about, and the bug arose precisely because they were added without considering that a group was being used. > > Better then to get rid of all groups save the one in use. (The proposed patch does that.) > That would make it much more difficult for the same bug to arise again. > > > Here you are talking about some optimization of the regexp, or is it > > another bug? If the latter, what is the bug here? > > It's related. When the reference to subgroup 3 was added (30c0f81f9f), the tail looked like this: > > "\\([[:blank:]]+\\([^[:blank:]]*\\)\\)?$" > ^^^^^^^^^^^^^^^^^^^ > and subgroup 3 was the second group in this substring (underlined above). Later (f71afd600a) the last `?` was changed into a `*`, but that made the contents of that group somewhat hazy because of the repetition: > > "\\([[:blank:]]+\\([^[:blank:]]*\\)\\)*$" > ^ > which doesn't leave us with a useful group for the purpose of detecting command arguments at all. > So the tail of the regexp has to be rewritten anyway, and we might as well do it in a more straightforward way. (The proposed patch does that as well.) > > The reason I found this is that it contains a sub-pattern on the form (A+B*)* which is super-linear in general but usually easy to fix so that the result is actually more readable, yet faster. Thanks. I'm okay with the changes in principle, but someone will have to test them by running all of the control commands and verifying they work after the fix, before this can be installed. I myself won't have the time for doing that any time soon, sorry. From unknown Sat Aug 16 16:20:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#66363: gdb-control-commands-regexp issues Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 06 Oct 2023 12:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66363 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 66363@debbugs.gnu.org Received: via spool by 66363-submit@debbugs.gnu.org id=B66363.169659417129897 (code B ref 66363); Fri, 06 Oct 2023 12:10:02 +0000 Received: (at 66363) by debbugs.gnu.org; 6 Oct 2023 12:09:31 +0000 Received: from localhost ([127.0.0.1]:49352 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoje7-0007m8-52 for submit@debbugs.gnu.org; Fri, 06 Oct 2023 08:09:31 -0400 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]:55747) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoje3-0007lu-Ui for 66363@debbugs.gnu.org; Fri, 06 Oct 2023 08:09:29 -0400 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-50573e85ee0so2497010e87.3 for <66363@debbugs.gnu.org>; Fri, 06 Oct 2023 05:09:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696594143; x=1697198943; darn=debbugs.gnu.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:sender:from:to:cc:subject:date:message-id:reply-to; bh=NAqh8UBsGtLjoVmcP9s2jV+HS4QKi50bZlSx4w9NXQI=; b=JfaaUjxXdmlOQ4qJU2aYXd12+eaFJIbxlj30uPyKGbf/YHVR04PDodFHGU3YLyGy41 piBLmqJFanaIKlzL5nmZNIaN0sGQ6+UrH4HIzcGX7cM8FjdXtaDBlgXNBAHC8LBqIp7A gE8n4PjNk19esPPfp9+Jqh0kW1LexXFBUqS2cQEXOyDXSkAR1rUgfu7UMUlOBZpQn1V+ tJdvhMTOM0lCde1ebl8J0OrIstCwbHclQXKAxReSfGA4KIFEmzDrpr1lApxCvG/6fVeZ PYyXG8+NjMu3LUUD/QjLBqSZtOou3OmD6geIOCwW2z4GQAyFfa4asQ+wn2hQ+zaOSRjw KayQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696594143; x=1697198943; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NAqh8UBsGtLjoVmcP9s2jV+HS4QKi50bZlSx4w9NXQI=; b=N7+n/tVYoq5E2Ft8NlTObu4hseSiQUg4364VGsApH707/PAGJhQamoVqJFJuKdD/o2 9b6WxxK8DZLjKQmEK1R6/bIzfkK3UJtF+kqvqwIYK5ciEE/08i03llKzg5MPno4dgduI bZZG7bPsuA1gP60Ze2P0ErjwfZwSEWFGiagS+ZlS6v82xrk3PWtUp6FGmHXZwNSpo+EX 5IwMcCwHSsmITwzZaANkqVHj+ifHDHKOX219wrETAjt8Tmb9IUe8PQdDuQdY1nbpIeGo 1OKkMwwlOw99a2wKEbbf9f0Y1rCuyLLBNwsSq9hL5f4Nn8TAY1BUcpbKLHlU7SCOMJNP Q7cg== X-Gm-Message-State: AOJu0YxxOFNY0kvvU9BndudhNpxXij+lbN+JZfVRt0Wq+EJ5N1DIeVVF mPmWl8Jz0ZYaaWj/s1+KGgE= X-Google-Smtp-Source: AGHT+IE1uW0TZCW0JnN1Ek7ZTxG4QS+bfcyua2EjLlLPgx4XZonQtgdhwF5TWH0jqp4frr9uD+ZMYQ== X-Received: by 2002:a19:e05d:0:b0:503:3804:d2ce with SMTP id g29-20020a19e05d000000b005033804d2cemr6757298lfj.35.1696594142724; Fri, 06 Oct 2023 05:09:02 -0700 (PDT) Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se. [188.150.165.235]) by smtp.gmail.com with ESMTPSA id q9-20020a19a409000000b00501b9fc977csm280159lfc.37.2023.10.06.05.09.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Oct 2023 05:09:02 -0700 (PDT) From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Message-Id: Content-Type: multipart/mixed; boundary="Apple-Mail=_4D169025-340A-4341-A87C-9A8959271FA7" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Date: Fri, 6 Oct 2023 14:09:01 +0200 In-Reply-To: <83il7k3nru.fsf@gnu.org> References: <83wmw12fu5.fsf@gnu.org> <83jzs12cdv.fsf@gnu.org> <83il7k3nru.fsf@gnu.org> X-Mailer: Apple Mail (2.3654.120.0.1.15) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --Apple-Mail=_4D169025-340A-4341-A87C-9A8959271FA7 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 5 okt. 2023 kl. 20.52 skrev Eli Zaretskii : > I'm okay with the changes in principle, but someone will have > to test them by running all of the control commands and verifying they > work after the fix, before this can be installed. I myself won't have > the time for doing that any time soon, sorry. That's fine, I can wait. The bug only affects GDB users so I'm not = personally inconvenienced. Here's an improved version of the patch that also fixes another bug in = the original code: the extra match against = gdb-python-guile-commands-regexp is both incorrect (not anchored) and = superfluous as that information is available in the match just made. For instance, consider what happens if the command string is "stepping = ...". It will match gdb-control-command-regexp and also = gdb-python-guile-commands-regexp and set python-or-guile-p, despite not = being a Python or Guile command, and prevent gdb-control-level from = being incremented. --Apple-Mail=_4D169025-340A-4341-A87C-9A8959271FA7 Content-Disposition: attachment; filename=gdb-control-commands-regexp-2.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="gdb-control-commands-regexp-2.diff" Content-Transfer-Encoding: quoted-printable diff=20--git=20a/lisp/progmodes/gdb-mi.el=20b/lisp/progmodes/gdb-mi.el=0A= index=20bc0070d2630..3afdc59a67e=20100644=0A---=20= a/lisp/progmodes/gdb-mi.el=0A+++=20b/lisp/progmodes/gdb-mi.el=0A@@=20= -1960,19=20+1960,23=20@@=20breakpoint-disabled=0A=20=20=20:group=20'gdb)=0A= =20=0A=20=0C=0A-(defvar=20gdb-python-guile-commands-regexp=0A-=20=20= "python\\|python-interactive\\|pi\\|guile\\|guile-repl\\|gr"=0A-=20=20= "Regexp=20that=20matches=20Python=20and=20Guile=20commands=20supported=20= by=20GDB.")=0A-=0A=20(defvar=20gdb-control-commands-regexp=0A-=20=20= (concat=0A-=20=20=20"^\\("=0A-=20=20=20= "comm\\(a\\(n\\(ds?\\)?\\)?\\)?\\|if\\|while"=0A-=20=20=20= "\\|def\\(i\\(ne?\\)?\\)?\\|doc\\(u\\(m\\(e\\(nt?\\)?\\)?\\)?\\)?\\|"=0A= -=20=20=20gdb-python-guile-commands-regexp=0A-=20=20=20= "\\|while-stepping\\|stepp\\(i\\(ng?\\)?\\)?\\|ws\\|actions"=0A-=20=20=20= "\\|expl\\(o\\(re?\\)?\\)?"=0A-=20=20=20= "\\)\\([[:blank:]]+\\([^[:blank:]]*\\)\\)*$")=0A+=20=20(rx=20bol=0A+=20=20= =20=20=20=20(or=0A+=20=20=20=20=20=20=20(or=20"comm"=20"comma"=20= "comman"=20"command"=20"commands"=0A+=20=20=20=20=20=20=20=20=20=20=20= "if"=20"while"=0A+=20=20=20=20=20=20=20=20=20=20=20"def"=20"defi"=20= "defin"=20"define"=0A+=20=20=20=20=20=20=20=20=20=20=20"doc"=20"docu"=20= "docum"=20"docume"=20"documen"=20"document"=0A+=20=20=20=20=20=20=20=20=20= =20=20"while-stepping"=0A+=20=20=20=20=20=20=20=20=20=20=20"stepp"=20= "steppi"=20"steppin"=20"stepping"=0A+=20=20=20=20=20=20=20=20=20=20=20= "ws"=20"actions"=0A+=20=20=20=20=20=20=20=20=20=20=20"expl"=20"explo"=20= "explor"=20"explore")=0A+=20=20=20=20=20=20=20(group=20=20=20=20=20=20=20= =20=20;=20group=201:=20Python=20and=20Guile=20commands=0A+=20=20=20=20=20= =20=20=20(or=20"python"=20"python-interactive"=20"pi"=20"guile"=20= "guile-repl"=20"gr")))=0A+=20=20=20=20=20=20(?=20(+=20blank)=0A+=20=20=20= =20=20=20=20=20=20(group=20=20=20=20=20=20=20;=20group=202:=20command=20= arguments=0A+=20=20=20=20=20=20=20=20=20=20(*=20nonl)))=0A+=20=20=20=20=20= =20eol)=0A=20=20=20"Regexp=20matching=20GDB=20commands=20that=20enter=20= a=20recursive=20reading=20loop.=0A=20As=20long=20as=20GDB=20is=20in=20= the=20recursive=20reading=20loop,=20it=20does=20not=20expect=0A=20= commands=20to=20be=20prefixed=20by=20\"-interpreter-exec=20console\".")=0A= @@=20-2032,15=20+2036,13=20@@=20gdb-send=0A=20=20=20=20=20=20=20(setq=20= gdb-continuation=20nil)))=0A=20=20=20;;=20Python=20and=20Guile=20= commands=20that=20have=20an=20argument=20don't=20enter=20the=0A=20=20=20= ;;=20recursive=20reading=20loop.=0A-=20=20(let*=20((control-command-p=20= (string-match=20gdb-control-commands-regexp=20string))=0A-=20=20=20=20=20= =20=20=20=20(command-arg=20(and=20control-command-p=20(match-string=203=20= string)))=0A-=20=20=20=20=20=20=20=20=20(python-or-guile-p=20= (string-match=20gdb-python-guile-commands-regexp=0A-=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20string)))=0A-=20=20=20=20(if=20(and=20= control-command-p=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20(or=20(not=20= python-or-guile-p)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (null=20command-arg)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (zerop=20(length=20command-arg))))=0A-=20=20=20=20=20=20=20=20(setq=20= gdb-control-level=20(1+=20gdb-control-level)))))=0A+=20=20(when=20= (string-match=20gdb-control-commands-regexp=20string)=0A+=20=20=20=20= (let=20((python-or-guile-p=20(match-beginning=201))=0A+=20=20=20=20=20=20= =20=20=20=20(command-arg=20(match-string=202=20string)))=0A+=20=20=20=20=20= =20(when=20(or=20(not=20python-or-guile-p)=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(null=20command-arg)=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(zerop=20(length=20command-arg)))=0A+=20=20=20=20=20=20= =20=20(setq=20gdb-control-level=20(1+=20gdb-control-level))))))=0A=20=0A=20= (defun=20gdb-mi-quote=20(string)=0A=20=20=20"Return=20STRING=20quoted=20= properly=20as=20an=20MI=20argument.=0A= --Apple-Mail=_4D169025-340A-4341-A87C-9A8959271FA7-- From unknown Sat Aug 16 16:20:14 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Subject: bug#66363: closed (Re: bug#66363: gdb-control-commands-regexp issues) Message-ID: References: <0082FBBE-56E6-4E4F-A802-8A890A1E41B0@gmail.com> X-Gnu-PR-Message: they-closed 66363 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 66363@debbugs.gnu.org Date: Sun, 29 Oct 2023 16:36:01 +0000 Content-Type: multipart/mixed; boundary="----------=_1698597361-29792-1" This is a multi-part message in MIME format... ------------=_1698597361-29792-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #66363: gdb-control-commands-regexp issues which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 66363@debbugs.gnu.org. --=20 66363: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D66363 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1698597361-29792-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 66363-done) by debbugs.gnu.org; 29 Oct 2023 16:35:31 +0000 Received: from localhost ([127.0.0.1]:43227 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qx8l9-0007jc-Bu for submit@debbugs.gnu.org; Sun, 29 Oct 2023 12:35:31 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]:56485) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qx8l7-0007jN-B4 for 66363-done@debbugs.gnu.org; Sun, 29 Oct 2023 12:35:30 -0400 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-507a55302e0so5089041e87.0 for <66363-done@debbugs.gnu.org>; Sun, 29 Oct 2023 09:34:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698597291; x=1699202091; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date:message-id:reply-to; bh=4qMvw8jyycI28mXjdQ1iaB+4JVYAaVuJB61OrteJRAA=; b=WPdI2Fq28aJth7jpyqzKWw+xStKyRFuV+VZKhpmXWrY98V/oWbALf9bqVbeeFzOmiF 38RX0GR4kpJrPnu+yau9TSTkzeiHZRjLsw+5qr6I0YjAtanxbMZMpmd+5teJX9uniN3m SMmNeZpjb8uWNUMphAePsilM6MLmOsKS608X2cixkodF7wxyW/hr16aNJa+41J27Ph39 9XQAhW2o9ZFaLxBEUTPXLFn/WEpLvwmWubu8mY/WkRzKdemnGub7I0Wo+a4+MwHA0Inj PqSQ80lDhgn4ZR5iWrSjQIhINU7HxTBaS81fxMqxo8YQqN6eBUFEP6sikAgT2eTCMfIP y0xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698597291; x=1699202091; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=4qMvw8jyycI28mXjdQ1iaB+4JVYAaVuJB61OrteJRAA=; b=UlWfLTwgCKQIXRvCbUAoXJaR4kvD90Lpi0HEXE2na8aKX1Y0Myqc/yrkfORt0+a0KJ kvN8Skh4hiWHjplwgWDZZI3JZGkl+oOTmsPEMPS6dg7MeuD8739MN0oc5YnNnx+r/aLB LUaMCltJaz+7OJoq8zCvyrDyuDNLS5+/lL5Po9p10CQFkcRWXaMVcFx3WXUMPYAXQTgw ny18ezqsZBfo1Fhf+vdUL6BTtn2i4zz8Evgn2aShkmjhw/wAXm7lgiU5dCgOkRYHEf/U DO5mPmaUfEfOQIGrxmA6ET5YaziOGesOu7hZNcJdDQXqH9KZS/y5QGuqAkbS0ixn1ae9 YV0A== X-Gm-Message-State: AOJu0YyC1ccp7mFRv8SAhQ5pXpH1cAWqt0FyKkawjv20QSJCbRlHArEi tisvdGiF6w2ptGNoO+xJaV0= X-Google-Smtp-Source: AGHT+IEHwnfsx878OksOkIGMwB8M6v3quY0xv15Xgd/QEOA1V9di/Amp5XDpttQOR96zIXztVYBe6A== X-Received: by 2002:a05:6512:15a:b0:507:a701:3206 with SMTP id m26-20020a056512015a00b00507a7013206mr5284734lfo.49.1698597290266; Sun, 29 Oct 2023 09:34:50 -0700 (PDT) Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se. [188.150.165.235]) by smtp.gmail.com with ESMTPSA id i14-20020ac2522e000000b00500cede2786sm1090883lfl.65.2023.10.29.09.34.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Oct 2023 09:34:49 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Subject: Re: bug#66363: gdb-control-commands-regexp issues From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: Date: Sun, 29 Oct 2023 17:34:48 +0100 Content-Transfer-Encoding: 7bit Message-Id: <0082FBBE-56E6-4E4F-A802-8A890A1E41B0@gmail.com> References: <83wmw12fu5.fsf@gnu.org> <83jzs12cdv.fsf@gnu.org> <83il7k3nru.fsf@gnu.org> To: Eli Zaretskii X-Mailer: Apple Mail (2.3654.120.0.1.15) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 66363-done Cc: 66363-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Pushed to master after finally finding a machine with gdb on it. ------------=_1698597361-29792-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 5 Oct 2023 15:07:55 +0000 Received: from localhost ([127.0.0.1]:48172 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoPxC-00014z-L3 for submit@debbugs.gnu.org; Thu, 05 Oct 2023 11:07:54 -0400 Received: from lists.gnu.org ([2001:470:142::17]:47732) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoPxA-00013S-Ak for submit@debbugs.gnu.org; Thu, 05 Oct 2023 11:07:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qoPwm-0007PJ-N3 for bug-gnu-emacs@gnu.org; Thu, 05 Oct 2023 11:07:28 -0400 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qoPwl-0007yq-29 for bug-gnu-emacs@gnu.org; Thu, 05 Oct 2023 11:07:28 -0400 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2c007d6159aso12779171fa.3 for ; Thu, 05 Oct 2023 08:07:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696518444; x=1697123244; darn=gnu.org; h=to:date:message-id:subject:mime-version:from:sender:from:to:cc :subject:date:message-id:reply-to; bh=pvs7/8NX310UTfzcLLySStEEuP1fmylICxtYvf9VMGA=; b=Xq5GQhxjyBklP4q5knINbPepv2MIBPbXqbKfef3yz8682/4qcTqdiCso0i6996vsWB O2Szx97mKmHxXl6DXPmx2O2/PmUPH8XhJe9ZDzI9yAvcnRtTz4Lt2dLixdkf+Svap5q3 XietuT0C1rLi4iN7llgmIu2iMvbZ9vy51olMZLX859/eDMs8usTZMY60yndD1dsEcxwk RDa0MOem979FbARV+W9/BvSLN88LElRzbV37pVNJ7QGypUQ3Ar6m/E3zLTVG44ihXAgx zxJeM+ngbrDaagNHxXYsJFbBGXAng8YcHXMl/jMILkj+HhJTEq9APyjijAHxczavGMzF /zSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696518444; x=1697123244; h=to:date:message-id:subject:mime-version:from:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pvs7/8NX310UTfzcLLySStEEuP1fmylICxtYvf9VMGA=; b=MP4XY2Q8DvNhhbTUvh86A9TGaMLvs6SPUTY/3i3bkcf0qgGxr4I8XuEeAYqBokzDEl 05YsiQ6//D65zsvpLxSsjf40G91p4KVl9lUH3to0u20fg+g3fK2zYtg7ywofkxIrediR WqY0u4F/oNIs8acSmPJJmIu5Ns6FKwycRuf6uxs8JMHDpv4CTa1YrRxXkXbAz+5oI1X1 8J7IfYd0oqGnR00YjTgYJy1LFRskgiqOXEz2UakR43HqO3Akq5w/6kloKiPbGM2I0FJ/ Ol5zFZZxTT+uJhJC6z1EdD13sQcnm8vx0MtAN06cVKIM2RAGVkWeg7O1oCwAdIHWZiRD niXQ== X-Gm-Message-State: AOJu0Yw1GfeQVmEw+9heXtPcy/3FB8NoOJMjtwfbyt1sg4RplC2d8Zu0 SSYydPwsspbSExZQKozR6H6wdRS0SIWetg== X-Google-Smtp-Source: AGHT+IF2sUpqu7HZ9agFL1LvdCMeI4/VK43X5c7XeIDBGMWVX6rCXkF+MAjFCk95m4DlO8Q/ICYORA== X-Received: by 2002:a2e:9650:0:b0:2c2:774b:3cd2 with SMTP id z16-20020a2e9650000000b002c2774b3cd2mr4982253ljh.21.1696518444335; Thu, 05 Oct 2023 08:07:24 -0700 (PDT) Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se. [188.150.165.235]) by smtp.gmail.com with ESMTPSA id w11-20020a2e998b000000b002bffbe767cbsm337452lji.85.2023.10.05.08.07.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Oct 2023 08:07:23 -0700 (PDT) From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Content-Type: multipart/mixed; boundary="Apple-Mail=_D8559FD7-289D-4999-9076-9E4C4A7DE69C" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Subject: gdb-control-commands-regexp issues Message-Id: Date: Thu, 5 Oct 2023 17:07:22 +0200 To: Emacs Bug Report X-Mailer: Apple Mail (2.3654.120.0.1.15) Received-SPF: pass client-ip=2a00:1450:4864:20::233; envelope-from=mattias.engdegard@gmail.com; helo=mail-lj1-x233.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --Apple-Mail=_D8559FD7-289D-4999-9076-9E4C4A7DE69C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii The variable `gdb-control-commands-regexp` in gdb-mi.el cannot work as = currently defined and used. Only group 3 is of interest, but that group = hasn't referred to anything useful for several years. Group 3 probably refers to a part of the regex's tail where the command = argument is matched: "\\([[:blank:]]+\\([^[:blank:]]*\\)\\)*$" However, this seems to be broken as well, because all groups here are = inside repetitions. This part of the regexp is also exponential in form = if not in practice but we'd better simplify it anyway. Attached is a suggested patch which makes explicit the command = abbreviations matched, and leaves only a single submatch. It also = changes the tail to assuming that the command argument doesn't contain = non-newlines (or the final eol anchor wouldn't make sense) but that it = can contain spaces (which seems reasonable). However, right now the = argument is only checked for being non-empty or not. I don't have a working gdb setup at the moment so if someone would be = kind to test it, I would be very grateful for it. --Apple-Mail=_D8559FD7-289D-4999-9076-9E4C4A7DE69C Content-Disposition: attachment; filename=gdb-control-commands-regexp.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="gdb-control-commands-regexp.diff" Content-Transfer-Encoding: quoted-printable diff=20--git=20a/lisp/progmodes/gdb-mi.el=20b/lisp/progmodes/gdb-mi.el=0A= index=20bc0070d2630..f7e96a2f19e=20100644=0A---=20= a/lisp/progmodes/gdb-mi.el=0A+++=20b/lisp/progmodes/gdb-mi.el=0A@@=20= -1960,19=20+1960,28=20@@=20breakpoint-disabled=0A=20=20=20:group=20'gdb)=0A= =20=0A=20=0C=0A+(rx-define=20gdb-python-guile-commands=0A+=20=20(or=20= "python"=20"python-interactive"=20"pi"=20"guile"=20"guile-repl"=20"gr"))=0A= +=0A=20(defvar=20gdb-python-guile-commands-regexp=0A-=20=20= "python\\|python-interactive\\|pi\\|guile\\|guile-repl\\|gr"=0A+=20=20= (rx=20gdb-python-guile-commands)=0A=20=20=20"Regexp=20that=20matches=20= Python=20and=20Guile=20commands=20supported=20by=20GDB.")=0A=20=0A=20= (defvar=20gdb-control-commands-regexp=0A-=20=20(concat=0A-=20=20=20= "^\\("=0A-=20=20=20"comm\\(a\\(n\\(ds?\\)?\\)?\\)?\\|if\\|while"=0A-=20=20= =20"\\|def\\(i\\(ne?\\)?\\)?\\|doc\\(u\\(m\\(e\\(nt?\\)?\\)?\\)?\\)?\\|"=0A= -=20=20=20gdb-python-guile-commands-regexp=0A-=20=20=20= "\\|while-stepping\\|stepp\\(i\\(ng?\\)?\\)?\\|ws\\|actions"=0A-=20=20=20= "\\|expl\\(o\\(re?\\)?\\)?"=0A-=20=20=20= "\\)\\([[:blank:]]+\\([^[:blank:]]*\\)\\)*$")=0A+=20=20(rx=20bol=0A+=20=20= =20=20=20=20(or=20"comm"=20"comma"=20"comman"=20"command"=20"commands"=0A= +=20=20=20=20=20=20=20=20=20=20"if"=20"while"=0A+=20=20=20=20=20=20=20=20= =20=20"def"=20"defi"=20"defin"=20"define"=0A+=20=20=20=20=20=20=20=20=20=20= "doc"=20"docu"=20"docum"=20"docume"=20"documen"=20"document"=0A+=20=20=20= =20=20=20=20=20=20=20"while-stepping"=0A+=20=20=20=20=20=20=20=20=20=20= "stepp"=20"steppi"=20"steppin"=20"stepping"=0A+=20=20=20=20=20=20=20=20=20= =20"ws"=20"actions"=0A+=20=20=20=20=20=20=20=20=20=20"expl"=20"explo"=20= "explor"=20"explore"=0A+=20=20=20=20=20=20=20=20=20=20= gdb-python-guile-commands)=0A+=20=20=20=20=20=20(?=20(+=20blank)=0A+=20=20= =20=20=20=20=20=20=20(group=20=20=20=20=20=20=20;=20Group=201=20contains=20= the=20command=20arguments.=0A+=20=20=20=20=20=20=20=20=20=20(*=20nonl)))=0A= +=20=20=20=20=20=20eol)=0A=20=20=20"Regexp=20matching=20GDB=20commands=20= that=20enter=20a=20recursive=20reading=20loop.=0A=20As=20long=20as=20GDB=20= is=20in=20the=20recursive=20reading=20loop,=20it=20does=20not=20expect=0A= =20commands=20to=20be=20prefixed=20by=20\"-interpreter-exec=20= console\".")=0A@@=20-2033,7=20+2042,7=20@@=20gdb-send=0A=20=20=20;;=20= Python=20and=20Guile=20commands=20that=20have=20an=20argument=20don't=20= enter=20the=0A=20=20=20;;=20recursive=20reading=20loop.=0A=20=20=20(let*=20= ((control-command-p=20(string-match=20gdb-control-commands-regexp=20= string))=0A-=20=20=20=20=20=20=20=20=20(command-arg=20(and=20= control-command-p=20(match-string=203=20string)))=0A+=20=20=20=20=20=20=20= =20=20(command-arg=20(and=20control-command-p=20(match-string=201=20= string)))=0A=20=20=20=20=20=20=20=20=20=20(python-or-guile-p=20= (string-match=20gdb-python-guile-commands-regexp=0A=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20string)))=0A=20=20=20=20=20(if=20(and=20= control-command-p=0A= --Apple-Mail=_D8559FD7-289D-4999-9076-9E4C4A7DE69C-- ------------=_1698597361-29792-1--