unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Patch: debug-instrumented predicate
@ 2021-10-04 15:20 Arthur Miller
  2021-10-04 16:24 ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Arthur Miller @ 2021-10-04 15:20 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 423 bytes --]


For tooling purpose I would like to have a reliable check to see if a symbol is
instrumented for debugger or not.

I have seen that internal code in debug.el uses advice
'debug--implement-debug-on-entry' for instrumented symbols, but I am not sure if
it can be used as a stable check long-term. Suggested patch uses it, but if it
is considered internal and subject of change, please add a way to have a stable
predicate.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-Debug-Instrumented-Predicate.patch --]
[-- Type: text/x-patch, Size: 874 bytes --]

From 16574a7f6f9e2797fe68e06508189daafbb8c005 Mon Sep 17 00:00:00 2001
From: Arthur Miller <arthur.miller@live.com>
Date: Mon, 4 Oct 2021 15:48:13 +0200
Subject: [PATCH 2/2] Debug Instrumented Predicate

* lisp/emacs-lisp/debug.el (debug-instrumented-p): New function.
---
 lisp/emacs-lisp/debug.el | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index 0592db85df..8d7e150362 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -683,6 +683,10 @@ debug-on-entry
               '((depth . -100)))
   function)
 
+(defun debug-instrumented-p (function)
+  "Whether FUNCTION has been instrumented for debug."
+  (advice-member-p #'debug--implement-debug-on-entry function))
+
 (defun debug--function-list ()
   "List of functions currently set for debug on entry."
   (let ((funs '()))
-- 
2.33.0


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

end of thread, other threads:[~2021-10-04 22:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-04 15:20 Patch: debug-instrumented predicate Arthur Miller
2021-10-04 16:24 ` Stefan Monnier
2021-10-04 19:25   ` Arthur Miller
2021-10-04 20:00     ` Stefan Monnier
2021-10-04 21:58       ` Arthur Miller
2021-10-04 22:14         ` Stefan Monnier
2021-10-04 22:56           ` Arthur Miller

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).