unofficial mirror of emacs-devel@gnu.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
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ 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] 7+ 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
  2006-11-18  8:58 ` martin rudalics
  2006-11-18 10:37 ` Eli Zaretskii
  2 siblings, 1 reply; 7+ 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] 7+ 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  8:58 ` martin rudalics
  2006-11-18  9:04   ` Ralf Angeli
  2006-11-18 10:37 ` Eli Zaretskii
  2 siblings, 1 reply; 7+ 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] 7+ messages in thread

* Re: How to debug hang?
  2006-11-18  8:58 ` martin rudalics
@ 2006-11-18  9:04   ` Ralf Angeli
  0 siblings, 0 replies; 7+ 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] 7+ 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  8:58 ` martin rudalics
@ 2006-11-18 10:37 ` Eli Zaretskii
  2006-11-21 20:11   ` David Abrahams
  2 siblings, 1 reply; 7+ 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] 7+ 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; 7+ 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] 7+ 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; 7+ 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] 7+ messages in thread

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

Thread overview: 7+ 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
2006-11-18  8:58 ` martin rudalics
2006-11-18  9:04   ` Ralf Angeli
2006-11-18 10:37 ` Eli Zaretskii
2006-11-21 20:11   ` David Abrahams

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).