From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: No Wayman Newsgroups: gmane.emacs.bugs Subject: bug#60768: 30.0.50; edebug-instrument-function off by one Date: Thu, 13 Jul 2023 08:03:55 -0400 Message-ID: <87edlc81az.fsf@gmail.com> References: <87lem740sy.fsf@gmail.com> <83lem6a8kb.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9937"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.11.9; emacs 30.0.50 Cc: 60768@debbugs.gnu.org, Stefan Monnier To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 13 14:05:35 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 1qJv4g-0002PE-K1 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 13 Jul 2023 14:05:34 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJv4R-0002l5-AR; Thu, 13 Jul 2023 08:05:19 -0400 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 1qJv4C-0002iv-7N for bug-gnu-emacs@gnu.org; Thu, 13 Jul 2023 08:05:06 -0400 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 1qJv4B-0007nH-JU for bug-gnu-emacs@gnu.org; Thu, 13 Jul 2023 08:05:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qJv49-0006ha-S2 for bug-gnu-emacs@gnu.org; Thu, 13 Jul 2023 08:05:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: No Wayman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Jul 2023 12:05: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.168924989425744 (code B ref 60768); Thu, 13 Jul 2023 12:05:01 +0000 Original-Received: (at 60768) by debbugs.gnu.org; 13 Jul 2023 12:04:54 +0000 Original-Received: from localhost ([127.0.0.1]:53546 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJv42-0006hA-0u for submit@debbugs.gnu.org; Thu, 13 Jul 2023 08:04:54 -0400 Original-Received: from mail-qk1-f180.google.com ([209.85.222.180]:54716) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJv3y-0006gw-66 for 60768@debbugs.gnu.org; Thu, 13 Jul 2023 08:04:52 -0400 Original-Received: by mail-qk1-f180.google.com with SMTP id af79cd13be357-765942d497fso58107385a.1 for <60768@debbugs.gnu.org>; Thu, 13 Jul 2023 05:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689249884; x=1691841884; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:from:to:cc:subject:date:message-id:reply-to; bh=CFOCVu+rGqfDFsuDX0d3EtGrD+PhpAsmVCgYpvLnw2o=; b=o3q2M81evFThsxIy8Tux9AsQtHKI2scMrM9w2Suj+opUjqUN9eOaifxk5s76qsWdSo wNYstvSkAgRzYkb9JHeg3sg1y8yDX7Jks7qonXgPN3bJ0lgT/2TyNjhIQHGoW+LQLaeC 3/bDruQ0fphiU45R/Eg9XMM0mL9UxmlAaZ1bcLOT+08v0gKCWE827gMdlDOe1GKld9zI xaTmcjaK3OP8THwpwHaMRS71SHw5iq/8vlBLE5ad3lr7UlhHZask4LAmZbMpp1MhMpuX IAnPpgThR1W0XDXBIwIDpPihDOshLYLiYw3GrshHa8wBAXw4ZtFRfveFZemJvtbYtr3o Jsyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689249884; x=1691841884; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=CFOCVu+rGqfDFsuDX0d3EtGrD+PhpAsmVCgYpvLnw2o=; b=ClzCWdjwVJfPPd61JxJanK090xKgWJIFFAmB3JabHyB+N7KuM2v0xtwQcxFkfMhUBl Z/ZxBNg1gdNE1/7SZrY1irL17yESedtqB+kFUUpycKEKkq59vMJxQiVUU1QmZX5gJJPb NVSdzl0OHRg7eXqYnRmx8TGMXsJMIkdWnfuS7rHNFN4WdEeTEV2IIxnE+tZAq8mRbkYd fLLU/JALgByxTzik6Hi0hLi4h3xJw9ope0lmNa+3OCUSCtZQ3/LLBI/jwHtw3guX6PBI iRr0V/+yakFV0c1Jp2pcenRYC/GYZvx8cbh6uTu5by47O8CDhnvrhrIC7VnHlTaEPhhW 3/xg== X-Gm-Message-State: ABy/qLZ8s3GPygnjKTRY87AO0UgmDyUcBOn0HaJv+ieKtNoNACavpzYL pWUznFGJtNGDzizTl4Z18Gw9XgGHXipshQ== X-Google-Smtp-Source: APBJJlGTdhj5ZdV6TSEMyBVaYCBkc+v20q2bjE2mfUv3moAEU9iYcCBOHULYXqAOaauNNnlvKK3nMA== X-Received: by 2002:a05:620a:28c3:b0:767:1db2:c32f with SMTP id l3-20020a05620a28c300b007671db2c32fmr1765496qkp.33.1689249883899; Thu, 13 Jul 2023 05:04:43 -0700 (PDT) Original-Received: from laptop ([2601:84:847f:c697:e217:2894:4724:14f4]) by smtp.gmail.com with ESMTPSA id x20-20020ae9f814000000b00767db1ba172sm2830760qkh.31.2023.07.13.05.04.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 05:04:43 -0700 (PDT) In-reply-to: <83lem6a8kb.fsf@gnu.org> 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:265015 Archived-At: Eli Zaretskii writes: >> 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? Any chance of applying this workaround with a note to investigate more for a proper fix?