emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Improving representation of EIEIO objects in backtraces/error messag


From: Eric Ludlam
Subject: Re: Improving representation of EIEIO objects in backtraces/error messages
Date: Sat, 31 Dec 2016 14:48:32 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

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)

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.

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]