[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: idea: debug-on-entry to any function matching regexp
From: |
Matt Swift |
Subject: |
Re: idea: debug-on-entry to any function matching regexp |
Date: |
Tue, 18 Feb 2003 03:11:28 -0500 |
User-agent: |
Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2 |
>> "D" == Dan wrote:
D> Feature request: debug on entry to function whose name is a regular
D> expression. E.g. I don't know which of them it is, I just want any
D> entry into any function with 'canlock' in the name to call up the
D> debugger.
You are probably going to go to Nested Debugger Hell if you do that,
because all those functions are probably going to call each other
lots, and you are going to go down and down.... This function will
take you there. It might work for your purposes without being too
annoying.
(defun re-debug-on-entry (regexp)
"Debug functions matching REGEXP on entry.
Return new value of `debug-function-list'."
(mapatoms
(function (lambda (sym)
(if (string-match regexp (symbol-name sym))
;; Brute force.
;; Elegant soln. would duplicate most of
;; `debug-on-entry'
(condition-case nil
(debug-on-entry sym)
(error)
)))))
debug-function-list)
;; Try it out:
(re-debug-on-entry "delete-.*")
(cancel-debug-on-entry)