GNU bug report logs - #72559
31.0.50; profiler-report-write-profile produced unreadable data

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> posteo.net>

Date: Sat, 10 Aug 2024 12:42:01 UTC

Severity: normal

Found in version 31.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 72559 <at> debbugs.gnu.org, pipcet <at> protonmail.com, yantar92 <at> posteo.net
Subject: bug#72559: 31.0.50; profiler-report-write-profile produced unreadable data
Date: Sat, 17 Aug 2024 13:35:07 -0400
>> 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 "#<lambda %#x>" (sxhash entry)))
            ((byte-code-function-p entry)
             (format "#<compiled %#x>" (sxhash entry)))
            ((or (subrp entry) (symbolp entry) (stringp entry))
             (format "%s" entry))
            (t
             (format "#<unknown %#x>" (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





This bug report was last modified 336 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.