unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Phillip Lord <phillip.lord@russet.org.uk>,
	Lars Ingebrigtsen <larsi@gnus.org>
Cc: 40992@debbugs.gnu.org
Subject: bug#40992: 27.0.90; Evaluating a function while using edebug breaks
Date: Fri, 1 May 2020 17:33:06 +0000	[thread overview]
Message-ID: <20200501173306.GB22689@ACM> (raw)
In-Reply-To: <20200501155630.GA22689@ACM>

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, #<marker at 4045 in hanoi.el>
> > edebug--display-1: Wrong type argument: listp, #<marker at 4045 in hanoi.el>

> > 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 <larsi@gnus.org>
> 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 #<marker at 4045 in hanoi.el>.  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).





  reply	other threads:[~2020-05-01 17:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01  8:26 bug#40992: 27.0.90; Evaluating a function while using edebug breaks Phillip Lord
2020-05-01 15:56 ` Alan Mackenzie
2020-05-01 17:33   ` Alan Mackenzie [this message]
2020-05-01 18:02     ` Eli Zaretskii
2020-05-02  1:43     ` Lars Ingebrigtsen
2020-05-02  3:05       ` Noam Postavsky
2020-05-02  7:10         ` Eli Zaretskii
2020-05-02 13:34           ` Alan Mackenzie
2020-05-02 13:57             ` Eli Zaretskii
2020-05-03 11:55               ` Alan Mackenzie
2020-05-03 12:13               ` Alan Mackenzie
2020-05-02 21:54           ` Phillip Lord
2020-05-11 20:16             ` Alan Mackenzie
2020-05-02 13:14         ` Alan Mackenzie
2020-05-04  1:27 ` Pouar Dragon
2020-05-04 18:34   ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200501173306.GB22689@ACM \
    --to=acm@muc.de \
    --cc=40992@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=phillip.lord@russet.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).