From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: Re: Patch: debug-instrumented predicate Date: Mon, 04 Oct 2021 23:58:26 +0200 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="14227"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 05 00:01:14 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 1mXW1J-0003WI-U6 for ged-emacs-devel@m.gmane-mx.org; Tue, 05 Oct 2021 00:01:14 +0200 Original-Received: from localhost ([::1]:58084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXW1I-0003P6-2F for ged-emacs-devel@m.gmane-mx.org; Mon, 04 Oct 2021 18:01:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35348) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXVyj-0008H2-RN for emacs-devel@gnu.org; Mon, 04 Oct 2021 17:58:33 -0400 Original-Received: from mail-oln040092069080.outbound.protection.outlook.com ([40.92.69.80]:34670 helo=EUR02-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXVyh-00026Q-0z for emacs-devel@gnu.org; Mon, 04 Oct 2021 17:58:33 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DC+2a7IODFt23zKk0d0rKLGMew322AraTg4lDIHHrrz18YfFLcqIXP26/rTlPXJzj/q6PCnp+bQMhVWO/Ndkje1vHKdLhzXQj8242Iup3h1dLD4nvL/XwwdBnFooUr0GpjK5BOKlJZ2cCyTuB1dKgLRl51B8KZ7wB9U3jFmTrByaSd7s06Eff3lvsi5izMr1SAd4y2f63E8q7O1SX2nc8K333lja4CZ6SfLNMunmQvYXBkvzxa983KxDiz/sNX3/emPUbvG3KVq1oMZ0VFFqu+AFIeS3DSctuX+vOSlKC3UH4gGHHaFROHf4T0x2pVRuNgBUxcQQPgmJW7AzICyikg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gZVUydX3FdPncehC3drHtBokdjBFP9DU6pUmDuETDtg=; b=Od3yXNnyBV7gH+7qCeKV2OfG8yeOSb6XBDtTzZ6p6iYHAVWF0GcaoGB0aqEyUPkA8mWFe7wL03rNarcLkDx3nMyrbrx2izWjJP0XffRCX3qgZq7zYDSDSWbNqDM6Lq8FdmhW/2Qwk9wAjKs0iezxkBDgsSodP7s4yy/0RGEJBt1DIgJCHxgyZZCBBSnlxWs+n2e9YHva8rtG6zBHXRB0mrcP303fD5BPIKFECRVios88mUyavpU42DKs52BI3yLjcaZNTe9GTPN47m0t+72cwXZrbR+4TPF8jK9fsot9EKj6BUrqDmwwsq17l9m/NOOLKUirGYWXf6MZJdVygNV/XA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gZVUydX3FdPncehC3drHtBokdjBFP9DU6pUmDuETDtg=; b=OVG1x9aOhUkjP3wHLR0NfAmMmiOIrzbWkVBTrjVIog3k4Wk7ro0ajcjxWz3/ptS2ncQcBU95QL9CRtZ6vCMWziN3ZjURHibUHYFQ9+5bWZ/OydD+W49sAgoLwCJaxgEenFxULa4lCTU9V5zAPeJrFd8uEscQfLZ7FfZ3fS5DmtmsvzrGqBo43dy+URScpX7+XKDicZHdRvFJL7yywOI7RuMmD5Ed6uMEMnajabG6knipqQALdIXCgl7lLKBPkyxhGXI0PUozSCoGKAa9PV4F0FEQXdpI+UXR0clSKI6u9b0SSF+hzkLkOemnxD5NUONlR91FNlJhbolf2yjWtXTxSQ== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by AM9PR09MB4546.eurprd09.prod.outlook.com (2603:10a6:20b:280::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.19; Mon, 4 Oct 2021 21:58:27 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c05b:e2ca:5b8a:56d2]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c05b:e2ca:5b8a:56d2%9]) with mapi id 15.20.4566.022; Mon, 4 Oct 2021 21:58:27 +0000 In-Reply-To: (Stefan Monnier's message of "Mon, 04 Oct 2021 16:00:21 -0400") X-TMN: [yjpKhbRwzV7iZnLq8iRHILxMCcrw+QO1] X-ClientProxiedBy: HE1P195CA0019.EURP195.PROD.OUTLOOK.COM (2603:10a6:3:fd::29) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87bl44sb99.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by HE1P195CA0019.EURP195.PROD.OUTLOOK.COM (2603:10a6:3:fd::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.15 via Frontend Transport; Mon, 4 Oct 2021 21:58:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2c1bf7fa-9a55-438e-d9b1-08d987821871 X-MS-TrafficTypeDiagnostic: AM9PR09MB4546: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hmb7N8u6qktlPYKunOak7HfZiG5hzbhH/OuVpJ4L/QQL+lfFpCTXP6usbt98BqPxDx/uDkC7k6GkwcAXI1DHdT2IFeGF5pq7TZkg1S/GYftckCkg0nSGK1X2kzwgrSmyXJ/IYcUnAUOPNgu3kekTJP85iE4dLZHTepccERSaAn7R8qzgsNdVlwv8246ZStmat+aNfy51pAp2Rx5cwBXu4l1HHED4nCwQAq5UM+iir9iE6086OlaXEvxIrKCjoHz3aRzCADoKfbqTVR7ApGdoKO5TNG6QZy2QQg8rQSND4FPJyoYWvGcNpKkEFYaWQZr15fWEulB2p/yatho5EkmKz6NHcSqAAvaRN9u8gmD6lbenfsOFtdtmjO5r70Tru50SZW6AzocQm6IiC5lLaQPWotmvVNYDxPswCvn+KEwbZAYYj8jfjmKDF5NblfLLkQyO X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 93CIkkGtMnD6/LjoVcoYD0b3G5GvV8TAmwFJJU3zSbz+BO7kJjn7+bEB2MS8oy61yfHlzsY/V6A8m88HQPhHSieQTY2Ha+ingqDoWoEojEVhe5PQ3+rmQV+BwIRA60Ntz4Nu/0k55ZK0saW+hQ3FbA== X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-72e6e.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 2c1bf7fa-9a55-438e-d9b1-08d987821871 X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2021 21:58:27.8215 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR09MB4546 Received-SPF: pass client-ip=40.92.69.80; envelope-from=arthur.miller@live.com; helo=EUR02-VE1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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:276274 Archived-At: 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. Edebug, debug, elp and trace already have means to add and remove instrumentation. I ask/suggest for an API to discover if instrumentation is installed or not. What they don't offer, except for trace, is an API to check if instrumentation is on or off. Debug is trivial, see the attached patch; trace has trase-is-traced, elp has private elp--instrumented-p which I suggested to make public. The only one that truly is missing a mean to test for on/off state is edebug. > It wouldn't cover the case where the user wants to add such > instrumentation, tho. No, it wouldn't, but it does not have to; see comment above. > And currently, that wouldn't cover Edebug because Edebug doesn't install its > instrumented code with `advice-add`. No edebug does it by other means; it instruments function with wrapped code. I have posted example of how helpful.el does check, and I have also attached a patch that uses different method to check for on/off state based on built-in function as posted with patch. 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. Since we already talk edebug, I think there is a bug. I meant to report it when I have done patch to fix it, but I haven't had time with that yet: 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 :).