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

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

Re: How to debug strange value changes of a variable?


From: Michael Heerdegen
Subject: Re: How to debug strange value changes of a variable?
Date: Wed, 31 Dec 2014 22:09:25 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Marcin Borkowski <mbork@wmi.amu.edu.pl> writes:

> Now somehow mu4e (I know it is to blame, since in stock message-mode,
> with emacs -Q, and without mu4e, everything works as expected!) messes
> around with the value of this variable /after the first increment/ (or
> so it seems: it looks like that after some initialization - including
> incf'ing that variable from its inital value of -1 - it somehow comes
> back to its original (default) value).  I'd like to check what function
> and when changes its value.  Is there any way to use Edebug (or anything
> else) for this?

Are you sure you reference the variable's value with the same buffer
current?  That's important of course.

Also note that changing a buffer's major mode removes all buffer local
bindings in the current buffer.  That could maybe happen in your case.

> I know about edebug-set-global-break-condition, but this doesn't help a
> lot: it can stop when the variable has some value, but does not tell me
> /which/ piece of code changed it.

Indeed, that is not much helpful in this case, unless you instrument all
code that could be responsible, but that may slow down things
drastically.

Did you define the variable we speak about by yourself?  If you did,
normally only your own code should change the variables binding.

> (A similar question is to find out what calls such-and-such function.
> This one seems easier: I can just instrument the said function and then
> press `d' in Edebug to see the backtrace.  Am I right?)

Yes, you could.  But for such questions, the ordinary debugger is IMHO
much simpler and more helpful (`debug-on-entry').  Load the elisp source
files before using it to avoid seeing byte code in the debugger output.


Michael.




reply via email to

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