From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: emacs-devel@gnu.org
Subject: Re: Improving representation of EIEIO objects in backtraces/error messages
Date: Sat, 31 Dec 2016 12:48:45 -0800 [thread overview]
Message-ID: <87wpefakpe.fsf@ericabrahamsen.net> (raw)
In-Reply-To: 7b792dd9-491a-b442-f837-e85326a6c924@siege-engine.com
Eric Ludlam <eric@siege-engine.com> writes:
> On 12/29/2016 02:02 PM, Eric Abrahamsen wrote:
>> I can't be the first one to be bitten by this...
>>
>> When developing using EIEIO objects, backtraces and edebug messages
>> can be very difficult to use. In edebug, if you're lucky, you get the
>> #<object-class I'm an object> representation, but if you're unlucky,
>> you get the vector. In backtraces, you always get the vector.
>>
>> For large objects, or those involving recursive data structures, this
>> makes error reporting frustrating, to put it delicately. It can take
>> the printer a good couple seconds to barf up the representation of an
>> object, and when it does it makes a huge mess of the minibuffer
>> and/or *Message* buffer.
>
> Hi Eric,
>
> CEDET includes a 'data-debug' package. If you enable that it provides a
> way to navigate giant data structures as you might get with EIEIO. It
> is also a part of Emacs now, though I'm not that familiar with how it
> all was merged.
>
> I have this in my .emacs file to take advantage of it:
>
> (require 'data-debug)
> (global-set-key "\M-:" 'data-debug-eval-expression)
That's interesting, thanks! I'll play with it a bit, it might be nice to
add the slot names in with the values.
> I also include this for eieio:
>
> (add-hook 'edebug-setup-hook
> (lambda ()
> (defalias 'edebug-prin1-to-string 'eieio-edebug-prin1-to-string)))
>
> though I'm not sure if something equivalent is enabled by default
> during the EIEIO merge.
We did end up enabling this by default, as an advice on
`edebug-prin1-to-string'. It's a great relief when it works, which it
only does sometimes (perhaps related to how deeply nested the objects
are in the data being printed? hard to tell).
> In the CEDET repository, you can get cedet-edebug.el. It includes
> these two snippets that bind "A" to data debug.
>
> ;;;###autoload
> (add-hook 'edebug-setup-hook
> (lambda ()
> (require 'cedet-edebug)
> ;; I suspect this isn't the best way to do this, but when
> ;; cust-print was used on my system all my objects
> ;; appeared as "#1 =" which was not useful. This allows
> ;; edebug to print my objects in the nice way they were
> ;; meant to with `object-print' and `class-name'
> (defalias 'edebug-prin1-to-string 'cedet-edebug-prin1-to-string)
> ;; Add a fancy binding into EDEBUG's keymap for ADEBUG.
> (define-key edebug-mode-map "A" 'data-debug-edebug-expr)
> ))
>
> ;;; DEBUG MODE TOO
> ;; This seems like as good a place as any to stick this hack.
> ;;;###autoload
> (add-hook 'debugger-mode-hook
> (lambda ()
> (require 'cedet-edebug)
> ;; Add a fancy binding into the debug mode map for ADEBUG.
> (define-key debugger-mode-map "A" 'data-debug-edebug-expr)
> ))
>
>
> Eric
These are all good for me as a developer, but I would also like to
protect users from backtraces that might, ahem, arise from my code. Do
you have any opinion on the discussion in
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25295 ? Anything would be
welcome.
Thanks for your message!
Eric
next prev parent reply other threads:[~2016-12-31 20:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-29 19:02 Improving representation of EIEIO objects in backtraces/error messages Eric Abrahamsen
2016-12-29 20:32 ` Eli Zaretskii
2016-12-29 20:54 ` Eric Abrahamsen
2016-12-30 7:45 ` Eli Zaretskii
2016-12-31 19:48 ` Eric Ludlam
2016-12-31 20:48 ` Eric Abrahamsen [this message]
2017-01-08 1:51 ` Eric Ludlam
2017-01-08 17:24 ` Eric Abrahamsen
2017-01-12 0:47 ` Eric Ludlam
2017-01-12 1:36 ` Eric Abrahamsen
2017-01-12 1:47 ` Noam Postavsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wpefakpe.fsf@ericabrahamsen.net \
--to=eric@ericabrahamsen.net \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).