bug-gnu-emacs
[Top][All Lists]
Advanced

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

Re: debug-on-call


From: Kevin Rodgers
Subject: Re: debug-on-call
Date: Tue, 18 Feb 2003 11:15:22 -0700
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Dan Jacobson wrote:

"K" == Kevin Rodgers <address@hidden> writes:


K> Dan Jacobson wrote:

I wanted to have emacs stop if it ever called a function, but no:
debug-on-entry: Function base64-encode-region is a primitive

I don't need to debug inside that function. All I wanted was to see a
backtrace so I can tell the layers of stuff calling that function.


K> (defadvice base64-encode-region (before debug activate)
K>    "Debug (when called from an Emacs Lisp function)."
K>    (debug))

OK, maybe this could be the guts of the new debug-on-call function, or
at least documented as what to do when debug-on-entry isn't usable...


Please find attached a tentative user (i.e. non-integrated) implementation.

Of course an antidote should also be provided to turn it off.


Yep, but I haven't gotten that far yet.


P.S. Kev, your References:
<address@hidden> does not give my
original post the fame and glory of its original Message-ID causing
its thread to be broken 'in many newsreaders'.


That's odd, google finds it under that Message-ID.  I used

        http://www.google.com/advanced_group_search?hl=en

to find

        From: Dan Jacobson <address@hidden>
        Newsgroups: gnu.emacs.bug
        Subject: debug-on-call
        Date: 01 Feb 2003 03:03:22 +0800
        Lines: 23
        Sender: news <address@hidden>
        Approved: address@hidden
        Message-ID: <address@hidden>
        Reply-To: Dan Jacobson <address@hidden>
        NNTP-Posting-Host: monty-python.gnu.org

Did you try reading
this group via NNTP of gmane.org for maximal comfort?

I primarily read gnu.emacs.bug and only check gmane.emacs.bug (both via

NNTPSERVER=news.cis.dfn.de) to make sure I don't miss any articles.


--
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;";>Kevin Rodgers</a>
(defadvice debug-on-entry (around advise-primitive activate)
  "If an error is signalled because FUNCTION is a primitive, query the user
whether to debug Lisp calls via `defadvice'."
  (condition-case condition-data
      ad-do-it
    (error (let ((error-message (format "Function %s is a primitive"
                                        (ad-get-arg 0))))
             (if (and (equal (car (cdr condition-data)) error-message)
                      (interactive-p)
                      (yes-or-no-p
                       (concat error-message
                               "; debug Lisp calls via defadvice? ")))
                 (eval `(defadvice ,(ad-get-arg 0) (before debug activate)
                          "Debug (when called from an Emacs Lisp function)."
                          (debug)))
               (signal 'error (cdr condition-data)))))))

;; (defadvice cancel-debug-on-entry (around advise-primitive activate)
;;   ...)

reply via email to

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