all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: help-gnu-emacs@gnu.org
Subject: Re: How to debug strange value changes of a variable?
Date: Wed, 31 Dec 2014 22:09:25 +0100	[thread overview]
Message-ID: <87bnmj7chm.fsf@web.de> (raw)
In-Reply-To: 87mw64ocjp.fsf@mbork.pl

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	other threads:[~2014-12-31 21:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-31  1:03 How to debug strange value changes of a variable? Marcin Borkowski
2014-12-31 21:09 ` Michael Heerdegen [this message]
2015-01-01  0:23   ` Marcin Borkowski
2015-01-01 14:00     ` Alex Kost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bnmj7chm.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.