From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#66363: gdb-control-commands-regexp issues Date: Thu, 5 Oct 2023 17:07:22 +0200 Message-ID: Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_D8559FD7-289D-4999-9076-9E4C4A7DE69C" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11235"; mail-complaints-to="usenet@ciao.gmane.io" To: 66363@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 05 17:08:00 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qoPxI-0002lY-0g for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 05 Oct 2023 17:08:00 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qoPx3-0007Te-Bh; Thu, 05 Oct 2023 11:07:45 -0400 Original-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 1qoPx1-0007TH-UC for bug-gnu-emacs@gnu.org; Thu, 05 Oct 2023 11:07:44 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qoPx1-00087T-MA for bug-gnu-emacs@gnu.org; Thu, 05 Oct 2023 11:07:43 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qoPxJ-00015N-Oh for bug-gnu-emacs@gnu.org; Thu, 05 Oct 2023 11:08:01 -0400 X-Loop: help-debbugs@gnu.org 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-Debbugs-Original-To: Emacs Bug Report Original-Received: via spool by submit@debbugs.gnu.org id=B.16965184754158 (code B ref -1); Thu, 05 Oct 2023 15:08:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Oct 2023 15:07:55 +0000 Original-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 Original-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 Original-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 Original-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 Original-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) Original-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) 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:271879 Archived-At: --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--