From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Extend gdb to filter registers Date: Sun, 6 Oct 2019 00:24:26 -0400 Message-ID: <253E46C6-9141-492C-918E-7218172BA9FC@gmail.com> References: <837e5j6561.fsf@gnu.org> <048A4D6D-54A6-4495-807A-9C123B4AFB7F@gmail.com> <83d0fb47uh.fsf@gnu.org> <633E2F0B-BFD6-4CF1-B9AB-9CD36827ABC1@gmail.com> <83sgo72f0i.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_DAEA6188-59A5-43F4-88F5-ADF9E1441957" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="169395"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Stefan Monnier , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 06 06:25:09 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iGy6W-000hvj-6x for ged-emacs-devel@m.gmane.org; Sun, 06 Oct 2019 06:25:08 +0200 Original-Received: from localhost ([::1]:60090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGy6V-0003z3-05 for ged-emacs-devel@m.gmane.org; Sun, 06 Oct 2019 00:25:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53167) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGy5w-0003yk-Ej for emacs-devel@gnu.org; Sun, 06 Oct 2019 00:24:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iGy5v-0004AW-CS for emacs-devel@gnu.org; Sun, 06 Oct 2019 00:24:32 -0400 Original-Received: from mail-qk1-x733.google.com ([2607:f8b0:4864:20::733]:41977) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iGy5t-00049Z-RZ; Sun, 06 Oct 2019 00:24:30 -0400 Original-Received: by mail-qk1-x733.google.com with SMTP id p10so9606769qkg.8; Sat, 05 Oct 2019 21:24:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=ZKf4JwSlFx0IxNuJGJq73fygZWgw1xUX1EgySVUDOXY=; b=YZRgAI4gx9eysiBuHuTKwwd4aAbajQlsD/rKW+eybB9b1/S2bPqnvKg5zbzW7uP236 IfZWE9Gp8B2b00DYqkTUFLlDMibLOcmVh67+4QXn+hyRmzgv5LCLd1Zlmu4XYk+erIdU yUtmHlUDNbWScGHd0PFLMKF7E2m5DSL5vizXMSGxcJHNlthfF+p17IAJbGYaUBUe54gu PJlSof4KWAW8di+YekzP1e4c7ZyEK0nRSILNLlOYwo6GFSTp55e/nyUv2tS742Zt/XQr iTUuBEpnYijjTdvESDlhuTWYSYh1FFU1mP/D+ndB8bVONBJ3GJ7pk/aJyZ/uJPi7uqqa UPrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=ZKf4JwSlFx0IxNuJGJq73fygZWgw1xUX1EgySVUDOXY=; b=q1DjesWym8RdZyCyLnBaBbXwrMWk4s9Xl9gqSXVBuL47a6DzXz+fJCsl3uX1ZwHN1C ayj2zvUWWVEGVSKK4mZwS72vfjUBvaaL9XXXJh/PQIbC2t/P4hGQ06vNYzgAjk/kpdSs MAwrt1djxOUQ1Ig8Rkf47RWqWe1fqbTEBpBFdYZ1EKt9Y/DFeyQNHPuNP8Vh+dFsF/N8 S+dkmGi9tOG2G8kBUOxvdBoTkxfbS3Fr9R5Jw90Ak8MmYoRLlRZuYyQcwJjfTv5sftfx eXjYTcx/eg4biTPIYu0RmTKLob2n38wam6A3gB18jvqL651O9l4lmpUm0vUEwxvE2+2J 4PWg== X-Gm-Message-State: APjAAAXIguoU3jV5DMvJCp1bEhOKZhJZBYgpM+bLA4z/2rDeAcwhP9Iv t/6pESfMs0wDpV+DkggqV1IKYM2WWzMQIQ== X-Google-Smtp-Source: APXvYqxuI+M9vPYPRaKbY+2A1LzzwSqBKj2K0aZd60Od962uJnQMEh3dDZk6Omr2HfJ4vh5Of63CLA== X-Received: by 2002:a37:2e46:: with SMTP id u67mr17392647qkh.116.1570335868280; Sat, 05 Oct 2019 21:24:28 -0700 (PDT) Original-Received: from [192.168.1.5] (c-71-207-8-160.hsd1.pa.comcast.net. [71.207.8.160]) by smtp.gmail.com with ESMTPSA id z72sm6355365qka.115.2019.10.05.21.24.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 Oct 2019 21:24:27 -0700 (PDT) In-Reply-To: <83sgo72f0i.fsf@gnu.org> X-Mailer: Apple Mail (2.3445.104.11) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::733 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:240637 Archived-At: --Apple-Mail=_DAEA6188-59A5-43F4-88F5-ADF9E1441957 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Thanks for your kind reply, Eli. Here are some more questions: * If I found a problem in existing code that is unrelated to my new feature but is quite trivial to fix (2~3 lines), should I create a new branch and send it as an separate patch to bug tracker, or include it in my new feature? * IIUC, I send the patch to the bug tracker and people will review it, is that correct? * If the patch is a fix, should I first create a bug report and reply to that report? I'm still not quite sure how everything works, hope I'm not too garrulous. Attached is the patch for the bug fix. Changes are: 1. gdb-mi uses a buffer to store and parse output from gdb process and it is cleared after each complete conversation, however the cleanup function is not protected against call to `error' in handlers who process the output's content and do various things to it. 2. gdb-mi uses `error' for error messages from gdb, I think it should use `user-error' instead because the gdb-mi code is running well, the error is from gdb and are normal errors like "symbol not found in current context". We shouldn't drop a user into a backtrace for errors like this Yuan --Apple-Mail=_DAEA6188-59A5-43F4-88F5-ADF9E1441957 Content-Disposition: attachment; filename=unwind-protect.patch Content-Type: application/octet-stream; x-unix-mode=0600; name="unwind-protect.patch" Content-Transfer-Encoding: quoted-printable =46rom=201bbfaa19081c34167722b0806550696f219e261b=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Yuan=20Fu=20=0ADate:=20Sat,=20= 5=20Oct=202019=2023:29:17=20-0400=0ASubject:=20[PATCH=201/2]=20Add=20= unwind-protect=20to=20error=20handling=20function=0A=0A= lisp/progmodes/gdb-mi.el=20(gdb-done-or-error):=20add=20unwind-protect=0A= ---=0A=20lisp/progmodes/gdb-mi.el=20|=2014=20+++++++-------=0A=201=20= file=20changed,=207=20insertions(+),=207=20deletions(-)=0A=0Adiff=20= --git=20a/lisp/progmodes/gdb-mi.el=20b/lisp/progmodes/gdb-mi.el=0Aindex=20= 60852e4ad6..042c49c737=20100644=0A---=20a/lisp/progmodes/gdb-mi.el=0A+++=20= b/lisp/progmodes/gdb-mi.el=0A@@=20-2644,13=20+2644,13=20@@=20= gdb-done-or-error=0A=20=20=20=20=20;;=20We=20are=20done=20concatenating=20= to=20the=20output=20sink.=20=20Restore=20it=20to=20user=20sink:=0A=20=20=20= =20=20(setq=20gdb-output-sink=20'user)=0A=20=0A-=20=20=20=20(when=20(and=20= token-number=20is-complete)=0A-=20=20=20=20=20=20(with-current-buffer=0A= -=09=20=20(gdb-get-buffer-create=20'gdb-partial-output-buffer)=0A-=09= (gdb-handle-reply=20(string-to-number=20token-number))))=0A-=0A-=20=20= (when=20is-complete=0A-=20=20=20=20(gdb-clear-partial-output))))=0A+=20=20= =20=20(unwind-protect=20(when=20(and=20token-number=20is-complete)=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (with-current-buffer=0A+=09=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(gdb-get-buffer-create=20'gdb-partial-output-buffer)=0A+=09=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20(gdb-handle-reply=20= (string-to-number=20token-number))))=0A+=20=20=20=20=20=20;;=20protect=20= against=20handler-emitted=20errors=0A+=20=20=20=20=20=20(when=20= is-complete=0A+=20=20=20=20=20=20=20=20(gdb-clear-partial-output)))))=0A=20= =0A=20(defun=20gdb-concat-output=20(so-far=20new)=0A=20=20=20(cond=0A--=20= =0A2.23.0=0A=0A=0A=46rom=20d76fdd533594153e144f78d47cdb6c2968041a99=20= Mon=20Sep=2017=2000:00:00=202001=0AFrom:=20Yuan=20Fu=20= =0ADate:=20Sat,=205=20Oct=202019=2023:39:05=20-0400=0A= Subject:=20[PATCH=202/2]=20Change=20error=20to=20user-error=0A=0A= lisp/progmodes/gdb-mi.el=0A=20=20(gdb-read-memory-custom):=20Change=20= error=20to=20user-error=0A---=0A=20lisp/progmodes/gdb-mi.el=20|=203=20= ++-=0A=201=20file=20changed,=202=20insertions(+),=201=20deletion(-)=0A=0A= diff=20--git=20a/lisp/progmodes/gdb-mi.el=20b/lisp/progmodes/gdb-mi.el=0A= index=20042c49c737..1bc451df8e=20100644=0A---=20= a/lisp/progmodes/gdb-mi.el=0A+++=20b/lisp/progmodes/gdb-mi.el=0A@@=20= -3500,7=20+3500,8=20@@=20gdb-read-memory-custom=0A=20=20=20=20=20=20=20= (progn=0A=20=20=20=20=20=20=20=20=20(let=20((gdb-memory-address=20= gdb-memory-last-address))=0A=20=20=20=20=20=20=20=20=20=20=20= (gdb-invalidate-memory=20'update)=0A-=20=20=20=20=20=20=20=20=20=20= (error=20err-msg))))))=0A+=20=20=20=20=20=20=20=20=20=20;;=20an=20error=20= from=20gdb=20should=20be=20considered=20a=20user=20error=0A+=20=20=20=20=20= =20=20=20=20=20(user-error=20err-msg))))))=0A=20=0A=20(defvar=20= gdb-memory-mode-map=0A=20=20=20(let=20((map=20(make-sparse-keymap)))=0A= --=20=0A2.23.0=0A=0A= --Apple-Mail=_DAEA6188-59A5-43F4-88F5-ADF9E1441957--