From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#72559: 31.0.50; profiler-report-write-profile produced unreadable data Date: Sat, 17 Aug 2024 13:35:07 -0400 Message-ID: References: <87wmko35yn.fsf@localhost> <877ccomqg3.fsf@protonmail.com> <867ccojqsd.fsf@gnu.org> <86plq731qz.fsf@gnu.org> <86o75r1ayr.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5903"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 72559@debbugs.gnu.org, pipcet@protonmail.com, yantar92@posteo.net To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 17 19:35:54 2024 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 1sfNLD-0001H7-G9 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Aug 2024 19:35:51 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sfNKn-0000Yk-Iq; Sat, 17 Aug 2024 13:35:25 -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 1sfNKl-0000YT-UB for bug-gnu-emacs@gnu.org; Sat, 17 Aug 2024 13:35:24 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sfNKl-0002DB-Ki for bug-gnu-emacs@gnu.org; Sat, 17 Aug 2024 13:35:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=lAlF5519XXHkqyzLEKecTuEehMtU7OP4aeY6+DDysy8=; b=HCH/FxyccW7VkALvFDZp4BkWCyAmffzEY2zZPNlex8/XhRmZYy7qGto0kOAoKbfGCIOzpWgRboQbA9nYlTs6WWXzmEFXKrN9iMNBdwqZZimDa5QjAMoGVpI04L00gyPOWKZutmEWPGAT47qbpdE4qnlc5j6D8t8HFuOdzIKtl43EOXBhsp6Ys7PcMY96FitBcRtdX6T32E/YzJekPoiX+j3iWYPRVZoXszj4ALlp/wEu6hJnnNW/p6+HtgmAJQxfZwaIUh+hnEF5D3oSFELDiVCtCHNdAruF1w02TPTxvPoERJHbw9deMs8WaPilTGldtjff4fX3Kaeih2PNxMZHcA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sfNLO-0007kv-I2 for bug-gnu-emacs@gnu.org; Sat, 17 Aug 2024 13:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Aug 2024 17:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72559 X-GNU-PR-Package: emacs Original-Received: via spool by 72559-submit@debbugs.gnu.org id=B72559.172391616229806 (code B ref 72559); Sat, 17 Aug 2024 17:36:02 +0000 Original-Received: (at 72559) by debbugs.gnu.org; 17 Aug 2024 17:36:02 +0000 Original-Received: from localhost ([127.0.0.1]:54914 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfNLN-0007kc-Ay for submit@debbugs.gnu.org; Sat, 17 Aug 2024 13:36:01 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:10367) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfNLK-0007kP-Ia for 72559@debbugs.gnu.org; Sat, 17 Aug 2024 13:35:58 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 0319E100044; Sat, 17 Aug 2024 13:35:14 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1723916108; bh=jSQAhZZ3Nfn0jkToQZnJe/j4/G5m/MVuD/HOQ173fME=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ngxbow/Et+ECSa5xh6BZ8kmh2kZEFa+PeP7vUTu/o4J+9JhiFNQdXGrM4gEk87NZI T+6tAT6Vzm2hc6jMcDhXt/Z+THnDM4miyfZ8GR1eb60YoWWpKgbSsLVFcC4U+dmaO/ aurxPPCGfiZyyE/yHwyLEcFa9eMpCtzNM+dICDNnYYlVrzK7LMeiuGuo/HIG0BDIeB KR4Ukbt9BN+vkb1HhqSzDpfNLEgQOtr+YgofiSY8Wo5Ya5P4WgYFcFizhyJ69AUhDQ Rvi8kZnUjq2nas11deTNRz3ha5V9A8qnAkRp0hW3FCLY0YDZq/fKyxTYt9cAGAzKz9 ss+tIBBoRBPHA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id AC2CE100035; Sat, 17 Aug 2024 13:35:08 -0400 (EDT) Original-Received: from alfajor (unknown [216.154.9.87]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 742A212021C; Sat, 17 Aug 2024 13:35:08 -0400 (EDT) In-Reply-To: <86o75r1ayr.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 17 Aug 2024 17:27:08 +0300") 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:290274 Archived-At: >> I don't think we want to write them as function objects, because then >> we'll again bump into the problem that some function objects contain >> unprintable objects like buffers. > But Emacs 29 does succeed there, at least in my testing, including > when the profile shows byte-compiled functions. So how come Emacs 30 > cannot? Emacs-29 did: (defun profiler-format-entry (entry) "Format ENTRY in human readable string. ENTRY would be a function name of a function itself." (cond ((memq (car-safe entry) '(closure lambda)) (format "#" (sxhash entry))) ((byte-code-function-p entry) (format "#" (sxhash entry))) ((or (subrp entry) (symbolp entry) (stringp entry)) (format "%s" entry)) (t (format "#" (sxhash entry))))) (defun profiler-fixup-entry (entry) (if (symbolp entry) entry (profiler-format-entry entry))) IOW it did not save the actual function object but only some kind of "name" (like we do now). And then when using such a saved backtrace, the `stringp` above made it print just that name. My suggestion above (as in the patch below) just re-instates that previous behavior. Stefan diff --git a/lisp/profiler.el b/lisp/profiler.el index a5d62e20e3a..34e4d7032df 100644 --- a/lisp/profiler.el +++ b/lisp/profiler.el @@ -452,6 +452,11 @@ profiler-report-make-entry-part (let ((string (cond ((eq entry t) "Others") + ;; When we save profile data into a file, the function + ;; objects are replaced with their "names". When we see + ;; a string here, that's presumably why, so just print + ;; it as-is. + ((stringp entry) entry) (t (propertize (help-fns-function-name entry) ;; Override the `button-map' which ;; otherwise adds RET, mouse-1, and TAB