From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#25295: 26.0.50; Represent eieio objects using object-print in backtraces and edebug Date: Thu, 02 Mar 2017 02:00:53 -0500 Message-ID: References: <87pokampa4.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1488438134 20705 195.159.176.226 (2 Mar 2017 07:02:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 2 Mar 2017 07:02:14 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: 25295@debbugs.gnu.org To: Eric Abrahamsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Mar 02 08:02:09 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1cjKkX-0004Np-Bm for geb-bug-gnu-emacs@m.gmane.org; Thu, 02 Mar 2017 08:02:05 +0100 Original-Received: from localhost ([::1]:50766 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjKkd-0000FA-KH for geb-bug-gnu-emacs@m.gmane.org; Thu, 02 Mar 2017 02:02:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55464) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjKkX-0000Ex-II for bug-gnu-emacs@gnu.org; Thu, 02 Mar 2017 02:02:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjKkU-00052L-Cq for bug-gnu-emacs@gnu.org; Thu, 02 Mar 2017 02:02:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37037) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjKkU-00051p-AX for bug-gnu-emacs@gnu.org; Thu, 02 Mar 2017 02:02:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cjKkT-00016u-V5 for bug-gnu-emacs@gnu.org; Thu, 02 Mar 2017 02:02:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 02 Mar 2017 07:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25295 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25295-submit@debbugs.gnu.org id=B25295.14884380624187 (code B ref 25295); Thu, 02 Mar 2017 07:02:01 +0000 Original-Received: (at 25295) by debbugs.gnu.org; 2 Mar 2017 07:01:02 +0000 Original-Received: from localhost ([127.0.0.1]:35236 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjKjW-00015T-JG for submit@debbugs.gnu.org; Thu, 02 Mar 2017 02:01:02 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:9054) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjKjT-00014o-Ny for 25295@debbugs.gnu.org; Thu, 02 Mar 2017 02:01:00 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BPBQAawrdY/zPujBhdGgEBAQECAQEBAQgBAQEBgycpQYQ4hVaFAnOQcykBlQuCDYYcBAICgjxAGAECAQEBAQEBAWIoQg4BhCABBAFWIwULCzQSFBgNJIoFCLNsixgBAQEBAQUCASWLO4o5BZBUi1SccIZgkzYfOIEBIRQILD6FBYFmIoF3iDwBAQE X-IPAS-Result: A0BPBQAawrdY/zPujBhdGgEBAQECAQEBAQgBAQEBgycpQYQ4hVaFAnOQcykBlQuCDYYcBAICgjxAGAECAQEBAQEBAWIoQg4BhCABBAFWIwULCzQSFBgNJIoFCLNsixgBAQEBAQUCASWLO4o5BZBUi1SccIZgkzYfOIEBIRQILD6FBYFmIoF3iDwBAQE X-IronPort-AV: E=Sophos;i="5.35,228,1484024400"; d="scan'208";a="294241305" Original-Received: from 24-140-238-51.cpe.teksavvy.com (HELO pastel.home) ([24.140.238.51]) by smtp.teksavvy.com with ESMTP; 02 Mar 2017 02:00:53 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 84E266565E; Thu, 2 Mar 2017 02:00:53 -0500 (EST) In-Reply-To: <87pokampa4.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Thu, 29 Dec 2016 12:52:19 -0800") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:130031 Archived-At: > Objects have an `object-print' method which produces the # > representation, but this appears to only sometimes be used in edebug, > and never in backtraces. I've installed a cl-print.el package into Emacs's master branch which is like EIEIO's object-print but more thorough. This is now used in edebug, so it should hopefully fix the "only sometimes" part (and it additionally knows about cl-defstructs as well, rather than only EIEIO objects). Using it in backtraces should be a simple matter of applying the patch below. I haven't installed it because I'm afraid of the potential breakage and slowdown of using cl-prin1, so I'd rather wait and see how it fares in Edebug first. My experiments seem to indicate that it might be "good enough" but it might also suffer from the overhead of cl-generic (mostly the fact that a call to a generic-function ends up going through some &rest+apply which in cl-print's case end up generating a lot of garbage: in one of my tests, the cl-print code was twice slower than the C code but the added time was almost entirely spent in the GC and that seemed to come exclusively from the lists allocated for &rest. I.e. if we could change cl-generic so it doesn't use &rest+apply as much there's a chance it could potentially be about as fast as the C code). Stefan diff --git a/lisp/subr.el b/lisp/subr.el index ea159e733c..68bfceb8d2 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4660,10 +4660,10 @@ backtrace--print-frame (princ (if (plist-get flags :debug-on-exit) "* " " ")) (cond ((and evald (not debugger-stack-frame-as-list)) - (prin1 func) - (if args (prin1 args) (princ "()"))) + (cl-prin1 func) + (if args (cl-prin1 args) (princ "()"))) (t - (prin1 (cons func args)))) + (cl-prin1 (cons func args)))) (princ "\n")) (defun backtrace ()