Subject: Re: bug#40992: 27.0.90; Evaluating a function while using edebug breaks

From: Alan Mackenzie <[email-masked]>
Date: Sun, 3 May 2020 11:55:04 +0000

Hello, everybody.

On Sat, May 02, 2020 at 16:57:26 +0300, Eli Zaretskii wrote:
> > Date: Sat, 2 May 2020 13:34:47 +0000
> > Cc: Noam Postavsky <[email-masked]>, [email-masked],
> >   [email-masked], [email-masked]
> > From: Alan Mackenzie <[email-masked]>

> > Noam's fix, I think, will either leave stale highlights on what used to
> > be breakpoints, or won't leave the highlights active whilst the
> > debugging is still in progress.  It might be the least bad fix, though.

> If Noam's fix is incomplete, I still think reverting the feature on
> emacs-27 is a better solution.  We should continue working on this on
> master until we find a better solution.

OK.  I've reverted the feature in the emacs-27 branch (with a directive
not to merge to master).  This should fix the bug in emacs-27.

I've had two ideas about fixing this bug in master whilst leaving the
breakpoint highlight feature in place:

(i): (Please bear in mind it was ~04:30 when I thought this up. ;-)  To
each type of function (subr, byte-compile, lambda form, closure form) we
add an extra field for a @dfn{function property list}, possibly
optional.  For dumped functions, the contents will be the index into a
vector holding lots of function property lists.  For functions in r/w
storage, we have a property list directly.  We will have functions like
put-function-property, get-function-property,
remove-function-properties.  Having got this infrastructure, edebug will
now store the 'edebug property on this function-property-list, and the
problems we've had with the symbol-plist just evaporate.

(ii) We devise a new (symbol-) property called something like
'ghost-edebug.  When an instrumented function gets recompiled by C-M-x,
etc., the previous contents of 'edebug get moved to 'ghost-edebug, and
'edebug gets a marker, as it currently does.  Whilst manipulating the
breakpoint highlights, edebug will use 'ghost-edebug when 'edebug holds
a marker.  The 'ghost-edebug property will be removed when the `hanoi'
function is next instrumented.  Maybe this will work.

-- 
Alan Mackenzie (Nuremberg, Germany).