all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to debug hang?
@ 2006-11-18  2:50 David Abrahams
  2006-11-18  4:13 ` Perry Smith
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: David Abrahams @ 2006-11-18  2:50 UTC (permalink / raw)
  Cc: emacs-devel


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.

Thanks,

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to debug hang?
  2006-11-18  2:50 How to debug hang? David Abrahams
@ 2006-11-18  4:13 ` Perry Smith
  2006-11-18 18:23   ` David Abrahams
       [not found] ` <mailman.776.1163823268.2155.help-gnu-emacs@gnu.org>
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Perry Smith @ 2006-11-18  4:13 UTC (permalink / raw)
  Cc: help-gnu-emacs, emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 1783 bytes --]

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.

Perry Smith ( pedz@easesoftware.com )
Ease Software, Inc. ( http://www.easesoftware.com )

Low cost SATA Disk Systems for IBMs p5, pSeries, and RS/6000 AIX systems



[-- Attachment #1.2: Type: text/html, Size: 6872 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to debug hang?
       [not found] ` <mailman.776.1163823268.2155.help-gnu-emacs@gnu.org>
@ 2006-11-18  6:37   ` Tim X
  0 siblings, 0 replies; 9+ messages in thread
From: Tim X @ 2006-11-18  6:37 UTC (permalink / raw)


Perry Smith <pedz@easesoftware.com> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to debug hang?
  2006-11-18  2:50 How to debug hang? David Abrahams
  2006-11-18  4:13 ` Perry Smith
       [not found] ` <mailman.776.1163823268.2155.help-gnu-emacs@gnu.org>
@ 2006-11-18  8:58 ` martin rudalics
  2006-11-18  9:04   ` Ralf Angeli
       [not found]   ` <mailman.781.1163841008.2155.help-gnu-emacs@gnu.org>
  2006-11-18 10:37 ` Eli Zaretskii
  3 siblings, 2 replies; 9+ messages in thread
From: martin rudalics @ 2006-11-18  8:58 UTC (permalink / raw)
  Cc: help-gnu-emacs, emacs-devel

 > 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.

If a (presumed) bug in font-locking makes Emacs hang during redisplay,
the latter won't be able to display your message.  You could try to
write your messages to a dribble file.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to debug hang?
  2006-11-18  8:58 ` martin rudalics
@ 2006-11-18  9:04   ` Ralf Angeli
       [not found]   ` <mailman.781.1163841008.2155.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Ralf Angeli @ 2006-11-18  9:04 UTC (permalink / raw)
  Cc: help-gnu-emacs

* martin rudalics (2006-11-18) writes:

> If a (presumed) bug in font-locking makes Emacs hang during redisplay,
> the latter won't be able to display your message.

In such a case I usually disable global font locking and call
`font-lock-fontify-region' manually.

-- 
Ralf

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to debug hang?
  2006-11-18  2:50 How to debug hang? David Abrahams
                   ` (2 preceding siblings ...)
  2006-11-18  8:58 ` martin rudalics
@ 2006-11-18 10:37 ` Eli Zaretskii
  2006-11-21 20:11   ` David Abrahams
  3 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2006-11-18 10:37 UTC (permalink / raw)


> From: David Abrahams <dave@boost-consulting.com>
> Date: Fri, 17 Nov 2006 21:50:27 -0500
> 
> 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.

The file etc/DEBUG in the Emacs distribution has a suggestion for this
case; search for "If Emacs hangs".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to debug hang?
  2006-11-18  4:13 ` Perry Smith
@ 2006-11-18 18:23   ` David Abrahams
  0 siblings, 0 replies; 9+ messages in thread
From: David Abrahams @ 2006-11-18 18:23 UTC (permalink / raw)
  Cc: help-gnu-emacs, emacs-devel

Perry Smith <pedz@easesoftware.com> 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.

Thanks.  Good-ol'-GDB turned out to be the ticket, and it shows me to
be doing regexp matching during the "hang;" oh joy.  Gotta love those
ambiguous grammars!

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to debug hang?
       [not found]   ` <mailman.781.1163841008.2155.help-gnu-emacs@gnu.org>
@ 2006-11-19 19:32     ` Stefan Monnier
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2006-11-19 19:32 UTC (permalink / raw)


>> If a (presumed) bug in font-locking makes Emacs hang during redisplay,
>> the latter won't be able to display your message.

> In such a case I usually disable global font locking and call
> `font-lock-fontify-region' manually.

Hmm.. I usually find it sufficient to turn off jit-lock.


        Stefan

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to debug hang?
  2006-11-18 10:37 ` Eli Zaretskii
@ 2006-11-21 20:11   ` David Abrahams
  0 siblings, 0 replies; 9+ messages in thread
From: David Abrahams @ 2006-11-21 20:11 UTC (permalink / raw)


Eli Zaretskii <eliz@gnu.org> writes:

>> From: David Abrahams <dave@boost-consulting.com>
>> Date: Fri, 17 Nov 2006 21:50:27 -0500
>> 
>> 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.
>
> The file etc/DEBUG in the Emacs distribution has a suggestion for this
> case; search for "If Emacs hangs".

Thanks, very useful.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-11-21 20:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-18  2:50 How to debug hang? David Abrahams
2006-11-18  4:13 ` Perry Smith
2006-11-18 18:23   ` David Abrahams
     [not found] ` <mailman.776.1163823268.2155.help-gnu-emacs@gnu.org>
2006-11-18  6:37   ` Tim X
2006-11-18  8:58 ` martin rudalics
2006-11-18  9:04   ` Ralf Angeli
     [not found]   ` <mailman.781.1163841008.2155.help-gnu-emacs@gnu.org>
2006-11-19 19:32     ` Stefan Monnier
2006-11-18 10:37 ` Eli Zaretskii
2006-11-21 20:11   ` David Abrahams

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.