emacs-devel
[Top][All Lists]
Advanced

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

Re: Patch: debug-instrumented predicate


From: Arthur Miller
Subject: Re: Patch: debug-instrumented predicate
Date: Mon, 04 Oct 2021 23:58:26 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Concrete use-case would be to offer a user some kind of gui to instrument or 
>> remove
>> instrumentation for debug/edebug/profile/trace.
>
> W.r.t *removal* of debug/profile/trace, this could be done by offering
> a generic removal GUI for advice.

Njah, advice already has add/remove which can be connected to a gui button or
what not. However any generic interface always need a specialisation for a case
at hand anyway, at least a different label on a button. But we are drifting
away.

Edebug, debug, elp and trace already have means to add and remove 
instrumentation.
I ask/suggest for an API to discover if instrumentation is installed or not.

What they don't offer, except for trace, is an API to check if instrumentation
is on or off. Debug is trivial, see the attached patch; trace has
trase-is-traced, elp has private elp--instrumented-p which I suggested to make 
public.
The only one that truly is missing a mean to test for on/off state is edebug.


> It wouldn't cover the case where the user wants to add such
> instrumentation, tho.

No, it wouldn't, but it does not have to; see comment above.

> And currently, that wouldn't cover Edebug because Edebug doesn't install its
> instrumented code with `advice-add`.

No edebug does it by other means; it instruments function with wrapped code. I
have posted example of how helpful.el does check, and I have also attached a
patch that uses different method to check for on/off state based on built-in
function as posted with patch.

I don't know which one is more efficient, but I don't like neither of those two,
I don't think any of suggested solutions is efficient. Also they both rely on
internal state that can change whenever.

Since we already talk edebug, I think there is a bug. I meant to report it
when I have done patch to fix it, but I haven't had time with that yet:

When a function is instrumented for edebug, edebug adds some properties into
symbols property list. However when instrumentation is removed, edebug leaves
those properties to scrap behind; that inclusive the position in buffer where it
was active. IMO it is a bug; it shouldn't leave scrap behind. It would also be
trivial to check if a funciton is instrumented or not, if those properties were
removed when instrumentation is removed.

Unless I misunderstand the purpose why properties are left behind after
instrumentation is removed :).



reply via email to

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