From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#60768: 30.0.50; edebug-instrument-function off by one Date: Fri, 13 Jan 2023 15:05:40 +0200 Message-ID: <83lem6a8kb.fsf@gnu.org> References: <87lem740sy.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6568"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60768@debbugs.gnu.org To: No Wayman , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 13 14:06:50 2023 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 1pGJlh-0001UI-VZ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 Jan 2023 14:06:50 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGJlL-0003Dn-Kp; Fri, 13 Jan 2023 08:06:27 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGJky-0002yR-Lt for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2023 08:06:16 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pGJkw-0004Rh-C4 for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2023 08:06:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pGJkv-0004wu-RY for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2023 08:06:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Jan 2023 13:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60768 X-GNU-PR-Package: emacs Original-Received: via spool by 60768-submit@debbugs.gnu.org id=B60768.167361514919005 (code B ref 60768); Fri, 13 Jan 2023 13:06:01 +0000 Original-Received: (at 60768) by debbugs.gnu.org; 13 Jan 2023 13:05:49 +0000 Original-Received: from localhost ([127.0.0.1]:49835 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGJkj-0004wT-0O for submit@debbugs.gnu.org; Fri, 13 Jan 2023 08:05:49 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:37948) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGJkh-0004wF-5f for 60768@debbugs.gnu.org; Fri, 13 Jan 2023 08:05:47 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGJkb-0004Ni-Mz; Fri, 13 Jan 2023 08:05:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=OgM2KVQ7BLBBKlYR9FHyTQkmRm1czMH5HFKWAulaKYc=; b=QfXs7fQySsGd rpWZkZhMzImKjdAuTub3lWdCZsJocw8KLa7lQwaUUxeRyXAiP3PQVbz6Mmv9zGPJzLrtLlXBTWbbp qopiT+HAo20FF8pZaltnH66rMKd1wusfOUeGA5OT82wkk/vK93gnHa3c5pnhI3Q3WeYgIskAUXrBB dIAi1kKjZCaLfv93SLS+r4V/ZPFdILYMKK2mfPcRz1JvHmxM0BiZpaOxffoJOfbdx39zXjBmPUB9p ImWVjE8+38DnLCw9DUfdyyfjQIWenH4qHkRuHUm0NZ69CxR9HRMncvYdZEDRtoANhnUZuCWBTy6ny BA8MD6LwOkpafDmQ8C7ZiA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGJka-00076K-TC; Fri, 13 Jan 2023 08:05:41 -0500 In-Reply-To: <87lem740sy.fsf@gmail.com> (message from No Wayman on Thu, 12 Jan 2023 21:27:06 -0500) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:253289 Archived-At: > From: No Wayman > Date: Thu, 12 Jan 2023 21:27:06 -0500 > > 1. Save the following elisp to /tmp/test.el: > > > --8<---------------cut here---------------start------------->8--- > ;; -*- lexical-binding: t; -*- > > ;;;###autoload > (defun one () > "ONE" > (1+ 0)) > > (defun two () > "TWO" > (1+ (one))) > > (defun three () > "THREE" > (1+ (two))) > > (provide 'test) > --8<---------------cut here---------------end--------------->8--- > > 2. Run emacs from the command line with the following: > > emacs -Q --batch -l /tmp/test.el --eval "(progn (require 'edebug) > (edebug-instrument-function #'one))" > > Expected output: Edebug: one > Actual output: Edebug: two > > If you repeat the test with an additional autoload cookie added > above function "two", function one is correctly instrumented. > > If you repeat it with an autoload cookie only above function > "three", function two is, incorrectly, instrumented. > > My hunch is find-function-search-for-symbol being thrown off > somehow. It's not a real problem, and it has nothing to do with the autoload cookie, AFAICT. If you modify edebug.el like below: diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 2f7d03e..0ac51ad 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -518,6 +518,7 @@ edebug-read-top-level-form ;; Don't enter Edebug while doing that, in case we're trying to ;; instrument things like end-of-defun. (edebug-active t)) + (save-excursion (end-of-defun)) (end-of-defun) (beginning-of-defun) (prog1 i.e., add one call to end-of-defun whose result is thrown away, before the _real_ call to end-of-defun, the problems go away. The reason seems to be that end-of-defun calls scan-sexps, and the first call to scan-sexps does something that wasn't done before. Stefan, any ideas what could that be? Any hints where to look?