From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: When calling defuns is a Bad Thing. Date: Mon, 22 Oct 2018 14:06:38 +0000 Message-ID: <20181022140638.GA4585@ACM> References: <20181021164110.GA4664@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1540217646 22246 195.159.176.226 (22 Oct 2018 14:14:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 22 Oct 2018 14:14:06 +0000 (UTC) User-Agent: Mutt/1.10.1 (2018-07-13) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 22 16:14:02 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gEay1-0005bl-6s for ged-emacs-devel@m.gmane.org; Mon, 22 Oct 2018 16:14:01 +0200 Original-Received: from localhost ([::1]:35487 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEb07-0000sf-AK for ged-emacs-devel@m.gmane.org; Mon, 22 Oct 2018 10:16:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46697) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEazO-0000Zq-EE for emacs-devel@gnu.org; Mon, 22 Oct 2018 10:15:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gEazK-0002tc-MM for emacs-devel@gnu.org; Mon, 22 Oct 2018 10:15:26 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:45731 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1gEazI-0002rL-Rp for emacs-devel@gnu.org; Mon, 22 Oct 2018 10:15:21 -0400 Original-Received: (qmail 76229 invoked by uid 3782); 22 Oct 2018 14:15:18 -0000 Original-Received: from acm.muc.de (p5B1472A5.dip0.t-ipconnect.de [91.20.114.165]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 22 Oct 2018 16:15:17 +0200 Original-Received: (qmail 4619 invoked by uid 1000); 22 Oct 2018 14:06:38 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:230556 Archived-At: Hello, Stefan. On Sun, Oct 21, 2018 at 14:07:18 -0400, Stefan Monnier wrote: > > Calling defuns (as opposed to primitives) from edebug is a bad idea, > > unless those defuns are also defined in edebug.el. > Just as a datapoint, I remember using Edebug to debug itself, and > it was very useful to be able to do it (although it's clearly > problematic in the general case). > So, I partly agree, but I also think maybe we should try and work to > make it easier to Edebug any code, even the one used by Edebug. I hacked up some analysis code (something which you surely have as a nicely parameterised macro ;-) and found 50 "external" defuns called by edebug.el, most of them, surely, in the non-engine parts. Indeed, one of them is sit-for, which I can vaguely remember edebugging in the past, so yes, things aren't as bad as I initially thought. There are, by the way, twelve "external" macros called, ranging all the way from cl-defstruct to pcase-dolist to cl-letf*. Most, if not all, of these are surely "harmless", in that either they're used in non-critical parts of edebug.el, or they don't generate calls to defuns in their expansions. So, I now agree with your initial assessment, there's probably nothing much to worry about here, but I intend to explore further, and see if I can crash/hang Emacs by using edebug. One thing that could be done is to put a `no-edebug' property on symbols whose function mustn't be instrumented (such as edebug-slow-after), but that seems somewhat excessive, unless we find a real problem. > Stefan -- Alan Mackenzie (Nuremberg, Germany).