all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Backtraces to use macro information from edebug-specs?
@ 2009-02-13 21:40 Tobias C. Rittweiler
  2009-02-14  1:53 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias C. Rittweiler @ 2009-02-13 21:40 UTC (permalink / raw
  To: emacs-devel


Let's take the following code

  (defun foo (list)
    (destructuring-bind (key slot1 slot2) list
      (case key
        (:foo (quux slot1)
              (:bar (quux slot2))))))

  (defun quux (x)
    (error "QUUX -- %S" x))

Now evaluating

  (foo '(:foo 23 42))

results in the following backtrace

  Debugger entered--Lisp error: (error "QUUX -- 23")
    signal(error ("QUUX -- 23"))
    error("QUUX -- %S" 23)
    quux(23)
    (cond ((eql key ...) (quux slot1) (:bar ...)))
    (case key (:foo (quux slot1) (:bar ...)))
    (let* ((--cl-rest-- list) (key ...) (slot1 ...) (slot2 ...)) (case ...)
    (progn (let* (... ... ... ...) (case key ...)))
    (destructuring-bind (key slot1 slot2) list (case key (:foo ... ...)))
    foo((:foo 23 42))

Given the information form edebug-specs (which are defined for all `cl'
macros), it may perhaps be possible to find out that

  `quux(23)' comes from the body of case, but `(cond ((eql ...' doesn't.

  `(case key ...' appears in the body of destructuring-bind, but the
  `(let* ... ' and `(progn ...' do not.

As a result the backtrace could be presented as follows

  Debugger entered--Lisp error: (error "QUUX -- 23")
    signal(error ("QUUX -- 23"))
    error("QUUX -- %S" 23)
    quux(23)
      (cond ((eql key ...) (quux slot1) (:bar ...)))
    (case key (:foo (quux slot1) (:bar ...)))
      (let* ((--cl-rest-- list) (key ...) (slot1 ...) (slot2 ...)) (case ...)
      (progn (let* (... ... ... ...) (case key ...)))
    (destructuring-bind (key slot1 slot2) list (case key (:foo ... ...)))
    foo((:foo 23 42))

Of course, they may be better ways to do this, depending on how much
debug information is available.

Has anyone worked on something like that?

  -T.





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Backtraces to use macro information from edebug-specs?
  2009-02-13 21:40 Backtraces to use macro information from edebug-specs? Tobias C. Rittweiler
@ 2009-02-14  1:53 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2009-02-14  1:53 UTC (permalink / raw
  To: Tobias C. Rittweiler; +Cc: emacs-devel

> Given the information form edebug-specs (which are defined for all `cl'
> macros), it may perhaps be possible to find out that

>   `quux(23)' comes from the body of case, but `(cond ((eql ...' doesn't.

>   `(case key ...' appears in the body of destructuring-bind, but the
>   `(let* ... ' and `(progn ...' do not.

> As a result the backtrace could be presented as follows

>   Debugger entered--Lisp error: (error "QUUX -- 23")
>     signal(error ("QUUX -- 23"))
>     error("QUUX -- %S" 23)
>     quux(23)
>       (cond ((eql key ...) (quux slot1) (:bar ...)))
>     (case key (:foo (quux slot1) (:bar ...)))
>       (let* ((--cl-rest-- list) (key ...) (slot1 ...) (slot2 ...)) (case ...)
>       (progn (let* (... ... ... ...) (case key ...)))
>     (destructuring-bind (key slot1 slot2) list (case key (:foo ... ...)))
>     foo((:foo 23 42))

> Of course, they may be better ways to do this, depending on how much
> debug information is available.

> Has anyone worked on something like that?

Not that I know.


        Stefan





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-02-14  1:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-13 21:40 Backtraces to use macro information from edebug-specs? Tobias C. Rittweiler
2009-02-14  1:53 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.