From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.help Subject: Re: How to debug strange value changes of a variable? Date: Wed, 31 Dec 2014 22:09:25 +0100 Message-ID: <87bnmj7chm.fsf@web.de> References: <87mw64ocjp.fsf@mbork.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1420060206 2727 80.91.229.3 (31 Dec 2014 21:10:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 31 Dec 2014 21:10:06 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 31 22:09:58 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Y6QWk-0001pO-FV for geh-help-gnu-emacs@m.gmane.org; Wed, 31 Dec 2014 22:09:58 +0100 Original-Received: from localhost ([::1]:41376 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6QWj-0000E5-ME for geh-help-gnu-emacs@m.gmane.org; Wed, 31 Dec 2014 16:09:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6QWZ-0000Dy-1n for help-gnu-emacs@gnu.org; Wed, 31 Dec 2014 16:09:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y6QWV-0003Hv-Sf for help-gnu-emacs@gnu.org; Wed, 31 Dec 2014 16:09:47 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:36416) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6QWV-0003Ho-LF for help-gnu-emacs@gnu.org; Wed, 31 Dec 2014 16:09:43 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Y6QWU-0001dE-2f for help-gnu-emacs@gnu.org; Wed, 31 Dec 2014 22:09:42 +0100 Original-Received: from ip-90-187-49-79.web.vodafone.de ([90.187.49.79]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 31 Dec 2014 22:09:42 +0100 Original-Received: from michael_heerdegen by ip-90-187-49-79.web.vodafone.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 31 Dec 2014 22:09:42 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 38 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: ip-90-187-49-79.web.vodafone.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:ZeT9aQca3VrDCFTmPreSo1XBLxg= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:101810 Archived-At: Marcin Borkowski 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.