From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#40992: 27.0.90; Evaluating a function while using edebug breaks Date: Fri, 1 May 2020 17:33:06 +0000 Message-ID: <20200501173306.GB22689@ACM> References: <87sggkawmz.fsf@russet.org.uk> <20200501155630.GA22689@ACM> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="110241"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 40992@debbugs.gnu.org To: Phillip Lord , Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 01 19:36:22 2020 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 1jUZaH-000SXr-MI for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 May 2020 19:36:21 +0200 Original-Received: from localhost ([::1]:38746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUZaG-00082T-Kw for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 May 2020 13:36:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39868) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jUZYT-00078X-If for bug-gnu-emacs@gnu.org; Fri, 01 May 2020 13:36:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUZY2-0007Em-CM for bug-gnu-emacs@gnu.org; Fri, 01 May 2020 13:34:29 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39050) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jUZY1-0007Dw-Tt for bug-gnu-emacs@gnu.org; Fri, 01 May 2020 13:34:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jUZY1-0007t2-QR for bug-gnu-emacs@gnu.org; Fri, 01 May 2020 13:34:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 May 2020 17:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40992 X-GNU-PR-Package: emacs Original-Received: via spool by 40992-submit@debbugs.gnu.org id=B40992.158835439130255 (code B ref 40992); Fri, 01 May 2020 17:34:01 +0000 Original-Received: (at 40992) by debbugs.gnu.org; 1 May 2020 17:33:11 +0000 Original-Received: from localhost ([127.0.0.1]:50596 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUZXD-0007rv-J7 for submit@debbugs.gnu.org; Fri, 01 May 2020 13:33:11 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:38665 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1jUZXB-0007rm-AL for 40992@debbugs.gnu.org; Fri, 01 May 2020 13:33:10 -0400 Original-Received: (qmail 42287 invoked by uid 3782); 1 May 2020 17:33:07 -0000 Original-Received: from acm.muc.de (p4FE15DBE.dip0.t-ipconnect.de [79.225.93.190]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Fri, 01 May 2020 19:33:06 +0200 Original-Received: (qmail 23067 invoked by uid 1000); 1 May 2020 17:33:06 -0000 Content-Disposition: inline In-Reply-To: <20200501155630.GA22689@ACM> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Received-From: 209.51.188.43 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" Xref: news.gmane.io gmane.emacs.bugs:179446 Archived-At: Hello, Phillip and Lars. On Fri, May 01, 2020 at 15:56:30 +0000, Alan Mackenzie wrote: > On Fri, May 01, 2020 at 09:26:44 +0100, Phillip Lord wrote: > > Edebug fails while tracing a function, if that function is evaluated > > during the edebug session. The error reported is: > > Wrong type argument: listp, # > > edebug--display-1: Wrong type argument: listp, # > > This is a regression as it works in Emacs-26, but fails in Emacs-27. > Yes. A bit of bisection shows that the commit which introduced this bug > is: > commit e8b3a15cb6ff187ce08afcb43bd9a0b7907268ca > Author: Lars Ingebrigtsen > Date: Sun Oct 20 12:07:42 2019 +0200 > Mark breakpoints in edebug with highlights > * lisp/emacs-lisp/edebug.el (edebug--overlay-breakpoints) > (edebug--overlay-breakpoints-remove): New functions (bug#23468). > (edebug-modify-breakpoint): Use them to highlight breakpoints. > (edebug--display-1): Restore breakpoint highlights. > (edebug--recursive-edit): Remove highlights on exit. > Lars, have you got any comment on this? > > Reproduction: > > In clean emacs -q > > M-x hanoi > > jump to hanoi function > > C-u C-M-x > > M-x hanoi > > After stepping through into hanoi with point still in > > C-M-x > > and step once more. The cause is now clear. When you instrument a function, the symbol is given a property 'edebug, whose value is a list of edebug information. It is this list which edebug--overlay-breakpoints is trying to access when it throws the error. When you recompile the function without instrumentation, edebug sets the 'edebug property to the marker #. This non-list value of the property acts elsewhere as a signal that the function isn't instrumented. This is a fundamental problem, that the edebug information is attached to the symbol `hanoi' rather than to the (instrumented) function which is no longer the symbol-function of `hanoi'. Sadly, there is no way of attaching a property to a function, only to a symbol (or a buffer position). There doesn't appear to be a good way of solving this bug. A workable workaround would be to check that the 'edebug property value is a list in edebug--overlay-breakpoints, and just to remove the breakpoint highlights when it's not a list. When it's not a list, it's a marker pointing to the start of the function, from which the end of the function can be found, to serve as the END argument to edebug--overlay-breakpoints-remove. Or something like that. :-( > > I use this workflow quite a lot when debugging. I may start to debug a > > function, decided I have seen enough, to un-instrument so I don't see it > > debugged again. -- Alan Mackenzie (Nuremberg, Germany).