From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Patch: debug-instrumented predicate Date: Mon, 04 Oct 2021 18:14:51 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11130"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Arthur Miller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 05 00:16:34 2021 Return-path: Envelope-to: ged-emacs-devel@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 1mXWGA-0002fx-4v for ged-emacs-devel@m.gmane-mx.org; Tue, 05 Oct 2021 00:16:34 +0200 Original-Received: from localhost ([::1]:39006 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXWG8-0001w7-4f for ged-emacs-devel@m.gmane-mx.org; Mon, 04 Oct 2021 18:16:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXWFN-0000kt-Dj for emacs-devel@gnu.org; Mon, 04 Oct 2021 18:15:45 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:16945) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXWFK-0003GA-Hd for emacs-devel@gnu.org; Mon, 04 Oct 2021 18:15:44 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 011ED4404F1; Mon, 4 Oct 2021 18:15:40 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 446694404CB; Mon, 4 Oct 2021 18:15:38 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1633385738; bh=dg5A2adYstVa6w8ZXKF7t2RyocTW/O2sTSojJIZwMiA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=PuMZTnTkFZ/t3RYSvTAQl2MfdroteVa1AWCRXEBKQGyklZsKw8uKTvmYrbDQ6vdo9 sB6hGqDvv+n7VYy+o7O8ZIV6Z5gsmJ5CuIDXGjOBIrcCXCO5UL9+od+HeRIknbcEWq KkS9ewiKbUA7CQe6+EvCk/D7EC0JjmVyTeL+KYH4Stm17j3lwF0Rdg0Gdf+1Ix8UUy z+I1IqPPealr8DTnA7Pqo+Zv0NmHp3tOsjY4LgEyd9NwZD14dL86BBYjJqepzP0j8m 8tb+mjISxdkmXISQd1pAwebn3Hm1K3VwskAj9QhLPd79OjQw97SqEB6Ks+UNORQaWe q3ihiL0Z5WiBA== Original-Received: from alfajor (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 1EA1A120208; Mon, 4 Oct 2021 18:15:38 -0400 (EDT) In-Reply-To: (Arthur Miller's message of "Mon, 04 Oct 2021 23:58:26 +0200") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:276277 Archived-At: Arthur Miller [2021-10-04 23:58:26] wrote: > Stefan Monnier writes: >>> Concrete use-case would be to offer a user some kind of gui to instrument or remove >>> instrumentation for debug/edebug/profile/trace. >> >> W.r.t *removal* of debug/profile/trace, this could be done by offering >> a generic removal GUI for advice. > > Njah, advice already has add/remove which can be connected to a gui button or > what not. However any generic interface always need a specialisation for a case > at hand anyway, at least a different label on a button. But we are drifting > away. I don't think it's drifting: I'm suggesting that we try to add support for it in a way that supports them all at the same time. > I ask/suggest for an API to discover if instrumentation is installed or not. And I'm suggesting that make `advice-member-p` should be the way to do that. Currently this requires reliance on some internal knowledge of the advice's name, but we could fix it by making this name public&stable. > The only one that truly is missing a mean to test for on/off state is edebug. Indeed. I haven't looked at whether it could be made to use `advice-add` so that `advice-member-p` could be used as well. There's a good chance that it's not really an option (I mean technically, I'm pretty sure it could be done, but I suspect it will come with enough downsides that it's not worth it). Until it can be made to use `advice-member-p` we should indeed export a public way to test whether a function is instrumented by Edebug. > I don't know which one is more efficient, but I don't like neither of those two, > I don't think any of suggested solutions is efficient. Also they both rely on > internal state that can change whenever. As long as these functions are defined in `edebug.el` it's OK if they rely on internal state. > When a function is instrumented for edebug, edebug adds some properties into > symbols property list. However when instrumentation is removed, edebug leaves > those properties to scrap behind; that inclusive the position in buffer where it > was active. IMO it is a bug; it shouldn't leave scrap behind. It would also be > trivial to check if a funciton is instrumented or not, if those properties were > removed when instrumentation is removed. > > Unless I misunderstand the purpose why properties are left behind after > instrumentation is removed :). I suspect they're not left behind for any good reason, and the best way to find out is to remove them and see if someone screams. Stefan