[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to debug hang?
Re: How to debug hang?
Sat, 18 Nov 2006 17:37:57 +1100
Gnus/5.11 (Gnus v5.11) Emacs/22.0.90 (gnu/linux)
Perry Smith <address@hidden> writes:
> On Nov 17, 2006, at 8:50 PM, David Abrahams wrote:
> I'm trying to debug some kind of a hang that occurs when I try to use
> a font-lock mode I'm developing. I can't get control back by hitting
> `C-g'. I suspected it was a bad (combinatoric) regexp, but I added
> advice before and after re-search-forward that emitted enter/exit
> messages, and when the hang occurs I am seeing an exit message, so I'm
> guessing that's not it. I'm quite stumped now; hoping someone can
> offer a clue.
> Check out debug-on-quit. If that doesn't work, try debug-on-signal and then
> the emacs from a separate window. I'm not sure what that will do to your
> There is also debug-on-entry if you have a routine that is called during the
> but it doesn't sounds like you do.
> The other thing you might try is run emacs from a "terminal" (xterm or
> It use to be that emacs would hook the quit signal to control-g would actually
> generate a quit unix signal so it happened immediately (via the tty code that
> I so
> know and love :-) and not via some polling process. Its been a long time
> I've used it and I don't know if it is still hooked up that way or not.
> But, while that might get you into the debugger, usually I'm too lost to
> figure out
> why it is hanging, what is looping, why is it not finishing, etc.
> There is a message facility that might help too -- good ole printf debug
> technology. (The function is called "message".) It puts lines into the ever
> present *Messages* buffer. So, if you ever do get control back, you can see
> Good luck.
another alternative is to use edebug. You can instrument some
functions and then trace/step through your code. I suspect you will
find an infinite loop in there somewhere.
Also, be wary of regular exprressions which are not anchored well. I
remember someone quite a while back who thought they were having
problems with the system hanging, but it turned out that their RE was
not well anchored and so it was taking a really long time for the RE
to do its work - made things look like the system was hung, but in
fact it just hadn't finished trying all the possible RE combinations
and subsequent backtracking.
tcross (at) rapttech dot com dot au