emacs-devel
[Top][All Lists]
Advanced

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

Re: How to debug modification to a variable value?


From: alin.s
Subject: Re: How to debug modification to a variable value?
Date: Tue, 26 Jan 2010 07:52:23 -0800 (PST)


I suggest you to use the WATCH in gdb for modifications of the variable,
AWATCH for reading of the variable, etc.

To detect the location of the variable is easy: install a breakpoint in
make-variable-buffer-local that stops when exactly the variable you are
interested about is set, then see there the location of tg-schema-alist.
Afterward you can use the x* functions from .gdbinit of emacs to debug your
problem...






Tassilo Horn-5 wrote:
> 
> Hi all,
> 
> today I had some strange problems with a major mode we use at my
> institute, and that I created and maintain.  This mode defines some
> buffer-local variable:
> 
> --8<---------------cut here---------------start------------->8---
> (defvar tg-schema-alist nil
>   "The schema of the current TG file.")
> (make-variable-buffer-local 'tg-schema-alist)
> --8<---------------cut here---------------end--------------->8---
> 
> This variable is set once, when a new graph is loaded (whatever that
> means, but there is only one function that setqs the variable).
> 
> Also, there's a function, which refreshes some font-locking stuff when
> saving.  This function is added to `after-save-hook' locally.
> 
> --8<---------------cut here---------------start------------->8---
> after-save-hook is a variable defined in `files.el'.
> Its value is 
> (t greql-set-fontlock-types-regex)
> 
> Local in buffer method-calls-per-activity.greql; global value is nil
> --8<---------------cut here---------------end--------------->8---
> 
> Now, my problem was that under some circumstances after saving, the
> buffer-local value of `tg-schema-alist' was gone, i.e. set to nil.
> 
> I double-checked `greql-set-fontlock-types-regex' that it doesn't modify
> `tg-schema-alist', and it doesn't.  I also removed all destructive
> function calls in there, although it operates only on a list created by
> `mapcar', and that's a copy anyway, right?
> 
> Till now, I couldn't reproduce this behavior.  After restarting emacs,
> the problem was gone first.  Suddenly, it appeared again.  Maybe it has
> something to do with using the same buffer in many frames (tty and X),
> but I cannot tell for sure...
> 
> So what I need is some way to be put in the debugger when the value of
> `tg-schema-alist' is modified.  Is that feasible?  I tried adding an
> after advice to `setq' which does exactly that, but that screwed my
> emacs instance.  I guess it's no good idea to advice such primitives...
> 
> Bye,
> Tassilo
> 
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/How-to-debug-modification-to-a-variable-value--tp27313386p27324834.html
Sent from the Emacs - Dev mailing list archive at Nabble.com.





reply via email to

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