Subject: bug#59213: closed (Re: bug#59213: Emacs 29: Edebug fails to instrument a parameter whose name begins with _)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 11 Feb 2023 11:18:02 +0000

Your bug report

#59213: Emacs 29: Edebug fails to instrument a parameter whose name begins with _

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
59213: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59213
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#59213: Emacs 29: Edebug fails to instrument a parameter whose name begins with _
From: Alan Mackenzie <[email-masked]>
To: Stefan Monnier <[email-masked]>
Cc: [email-masked], Eli Zaretskii <[email-masked]>
Date: Sat, 11 Feb 2023 11:17:24 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello, Stefan.

On Fri, Feb 10, 2023 at 17:05:32 -0500, Stefan Monnier wrote:

[ .... ]

> > What do you think?

> I think that's good enough for `emacs-29`, yes.

I've committed the fix (with modifications) to master, as requested by
Eli, and I'm closing the bug with this post.

> I don't like the use of a dynbound variable to control this, but it's
> not clear how to do better.  One thing that occurred to me right now is
> that we could mark the Edebug closures themselves, e.g. by replacing

>     (function (lambda () ,@forms))

> with

>     (function (lambda () :closure-dont-trim-context ,@forms))

> and then have `cconv-make-interpreted-closure` look for this
> tell-tale sign.

Interesting.  Isn't there a good chance this would foul up programs which
analyse the structure of a closure?  (A bit like
testcover-analyze-coverage analyses the calling structure of
edebug-enter).

> A few minor comments about your patch below.

[ .... ]

> Hmm... any reason why we can't just replace

>     (if (null lexvars)

> with

>     (if (or cconv-dont-trim-unused-variables (null lexvars))

> and be done with it?

No, no reason at all.  I think I was concerned to preserve the macro
expansion, but seeing as how that wouldn't even be in the uninstrumented
form, this is clearly not a valid concern.  So I modified the patch to do
that before committing it.

Thanks!

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).

Subject: Emacs 29: Edebug fails to instrument a parameter whose name begins with _
From: Alan Mackenzie <[email-masked]>
To: [email-masked]
Date: Sat, 12 Nov 2022 09:35:58 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello, Emacs.

In Emacs 29 (not started with -Q, but...),

I instrumented for edebug a function which looked like:

    (defun c-trim-found-types (beg end _old-len) ....)

, the compilation being with lexical-binding: t.

During the edebug session, I attempted

    e _old-len RET.

Instead of giving me the value of _old-len (which was 3) it gave the
error message

    Error: Symbol's value as variable is void: _old-len

..  This is a bug.

Just because a function doesn't use a particular argument (here
_old-len) doesn't mean the person debugging it isn't interested in its
value.  In this particular case, it was extremely interesting, because
beg and end were unequal, and _old-len was 3.

In the end, I found out the info with the d command (backtrace), but I
shouldn't have to.

-- 
Alan Mackenzie (Nuremberg, Germany).