From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: How to debug hang? Date: Sat, 18 Nov 2006 17:37:57 +1100 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <87lkm9l0oq.fsf@lion.rapttech.com.au> References: <87irhdcvt8.fsf@pereiro.luannocracy.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1163832033 24236 80.91.229.2 (18 Nov 2006 06:40:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 18 Nov 2006 06:40:33 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Nov 18 07:40:32 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GlJsM-0006Qi-77 for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Nov 2006 07:40:30 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GlJsL-0001qp-RF for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Nov 2006 01:40:29 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!sn-xt-sjc-05!sn-xt-sjc-11!sn-xt-sjc-07!sn-post-sjc-02!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.90 (gnu/linux) Cancel-Lock: sha1:h/V6ttnshDfR7VC/giw/JpmzBtg= Original-X-Complaints-To: abuse@supernews.com Original-Lines: 55 Original-Xref: shelby.stanford.edu gnu.emacs.help:143172 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:38789 Archived-At: Perry Smith writes: > On Nov 17, 2006, at 8:50 PM, David Abrahams wrote: > > Hi, > > 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 kill > the emacs from a separate window.  I'm not sure what that will do to your context. > > There is also debug-on-entry if you have a routine that is called during the hang > but it doesn't sounds like you do. > > The other thing you might try is run emacs from a "terminal" (xterm or similar).  > 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 since > 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 what > happened. > > 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. HTH Tim -- tcross (at) rapttech dot com dot au