From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#25295: 26.0.50; Represent eieio objects using object-print in backtraces and edebug Date: Sat, 21 Oct 2017 14:36:46 -0700 Message-ID: <87efpww5ch.fsf@ericabrahamsen.net> References: <87pokampa4.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1508621956 29086 195.159.176.226 (21 Oct 2017 21:39:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 21 Oct 2017 21:39:16 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) Cc: 25295@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 21 23:39: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 1e61U3-0006US-QQ for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Oct 2017 23:39:08 +0200 Original-Received: from localhost ([::1]:59282 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e61UB-00075a-4J for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Oct 2017 17:39:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46010) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e61U1-00075U-Ny for bug-gnu-emacs@gnu.org; Sat, 21 Oct 2017 17:39:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e61Ty-0000Tq-K1 for bug-gnu-emacs@gnu.org; Sat, 21 Oct 2017 17:39:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:46009) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e61Ty-0000Sz-Dt for bug-gnu-emacs@gnu.org; Sat, 21 Oct 2017 17:39:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e61Ty-0007wa-2K for bug-gnu-emacs@gnu.org; Sat, 21 Oct 2017 17:39:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Oct 2017 21:39:02 +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.150862190630489 (code B ref 25295); Sat, 21 Oct 2017 21:39:02 +0000 Original-Received: (at 25295) by debbugs.gnu.org; 21 Oct 2017 21:38:26 +0000 Original-Received: from localhost ([127.0.0.1]:54690 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e61TN-0007vf-Us for submit@debbugs.gnu.org; Sat, 21 Oct 2017 17:38:26 -0400 Original-Received: from mail.ericabrahamsen.net ([50.56.99.223]:48976) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e61TK-0007vW-Fx for 25295@debbugs.gnu.org; Sat, 21 Oct 2017 17:38:22 -0400 Original-Received: from localhost (71-212-71-66.tukw.qwest.net [71.212.71.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 6F406C06E0; Sat, 21 Oct 2017 21:38:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.ericabrahamsen.net; s=mail; t=1508621901; bh=/hkLeDeIphJysTNsqOJ7h13dB2t5HMd/HhqLXExBLqg=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=BsGWCP7/PDvuVP5vr//xml7AmyVec7fGRuV6Pv7aEVbIQ6xEnzz3G2FIxdBBSKUcK aqRT/QA04KYKNEpakfQgqhNiRlk9lceTPUDW1BXYjB+8YhhA2cGsG768OW5mDOfDOV Wv0WXcPu3Y/rByi0sf/12CxzUTxq829lhJ0K0qXQ= In-Reply-To: (Stefan Monnier's message of "Thu, 02 Mar 2017 02:00:53 -0500") 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:138828 Archived-At: On 03/02/17 02:00 AM, Stefan Monnier wrote: >> 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 () How about we just apply this and see what happens? Developing with EIEIO is pretty painful -- oftentimes the *Messages* buffer is such a mess you can't even tell if there's been an error or not. I've been running the above patch, as well as an equivalent change in `eval-expression', and nothing bad has happened. Perhaps there's a slowdown, but from my own selfish point of view any slowdown is far, far preferable to the several seconds you need to wait for a class object to be spat out into *Messages*. BTW, this works in edebug but only at the top level: if a nested structure is printed, interior objects are still represented as the full struct.