GNU bug report logs - #42672
28.0.50; cl-defgeneric with :method generates incorrect Edebug symbols

Previous Next

Package: emacs;

Reported by: Philipp Stephani <p.stephani2 <at> gmail.com>

Date: Sun, 2 Aug 2020 11:15:01 UTC

Severity: normal

Found in version 28.0.50

Full log


View this message in rfc822 format

From: Philipp Stephani <p.stephani2 <at> gmail.com>
To: 42672 <at> debbugs.gnu.org
Subject: bug#42672: 28.0.50; cl-defgeneric with :method generates incorrect Edebug symbols
Date: Sun, 2 Aug 2020 22:01:07 +0200
Am So., 2. Aug. 2020 um 13:15 Uhr schrieb Philipp Stephani
<p.stephani2 <at> gmail.com>:
>
>
> Create a file /tmp/defmethod.el:
>
> $ cat /tmp/defmethod.el
> (cl-defgeneric foo (_)
>   (:method ((_ number)) 1))
>
> Visit the file in Emacs:
>
> $ emacs -Q /tmp/defmethod.el
>
> Instrument the `cl-defgeneric' form using C-u C-M-x.  The *Messages*
> buffer now contains
>
> Edebug: nil ((_ number))
> Edebug: foo
>
> The second line is for the generic function itself.  The first line,
> however, is for the method defined by the `:method' form.  But its name
> should be `foo ((_ number))', not `nil ((_ number))'.  This becomes a
> problem if there are multiple such generic functions with different
> names but identical signatures, because Edebug will then generate
> duplicate symbols.  This breaks e.g. coverage instrumentation because
> the instrumented frequencies will be attached to the wrong symbol.
>
> Implementation-wise, I guess this is a problem with
> `edebug-match-cl-generic-method-args'.  That function contains the
> snippet
>
>     ;; Append the arguments to edebug-def-name.
>     (setq edebug-def-name
>           (intern (format "%s %s" edebug-def-name args)))
>
> However, `edebug-def-name' is only non-nil when using `cl-defmethod',
> not when using `cl-defgeneric' with `:method'.

I've added a workaround (commit 3e0c3479b2). A more long-term solution
should ensure that the name of the `cl-defgeneric' function is part of
the method defined in this way.




This bug report was last modified 4 years and 318 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.