unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* how to debug an emacs hang?
@ 2004-05-18 23:38 John Owens
  2004-05-19  0:03 ` Miles Bader
  2004-05-20 22:59 ` John Owens
  0 siblings, 2 replies; 6+ messages in thread
From: John Owens @ 2004-05-18 23:38 UTC (permalink / raw)


I've been running the same emacs (the released version of NT emacs
21.3) for quite some time, but recently it started hanging while I'm
composing a mail message (via vm-mail), and I made it also hang when
editing a HTML file. It hangs for about a minute (to the point where
it doesn't even refresh) and eventually all my text suddenly appears
and it's all back to normal. Hitting C-g does not seem to do anything
while it is hanging.

I'd like to figure out how/where it's hanging, but I don't know how I
might do so. Suggestions?

JDO

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

* Re: how to debug an emacs hang?
  2004-05-18 23:38 how to debug an emacs hang? John Owens
@ 2004-05-19  0:03 ` Miles Bader
  2004-05-19  7:08   ` Eli Zaretskii
  2004-05-20 22:59 ` John Owens
  1 sibling, 1 reply; 6+ messages in thread
From: Miles Bader @ 2004-05-19  0:03 UTC (permalink / raw)
  Cc: emacs-devel

On Tue, May 18, 2004 at 04:38:08PM -0700, John Owens wrote:
> I'd like to figure out how/where it's hanging, but I don't know how I
> might do so. Suggestions?

Run emacs in gdb, preferably from the src directory where you compiled emacs:

   $ cd ~/emacs-build/src
   $ gdb ./emacs

[There's a special .gdbinit file in that directory that defines handy emacs
debugging commands.]

When it hangs, hit C-z or something to exit to the debugger (you can't use
C-c like usual when debugging emacs, because emacs' standard .gdbinit file
changes gdb's SIGINT handling to make C-g work properly on ttys).

Then look at a C backtrace ("backtrace") and lisp backtrace ("xbacktrace")
to see what's up.

For more fun, do the above from another emacs session using emacs' `M-x gdb'
command.

-Miles
-- 
Any man who is a triangle, has thee right, when in Cartesian Space, to
have angles, which when summed, come to know more, nor no less, than
nine score degrees, should he so wish.  [TEMPLE OV THEE LEMUR]

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

* Re: how to debug an emacs hang?
  2004-05-19  0:03 ` Miles Bader
@ 2004-05-19  7:08   ` Eli Zaretskii
  2004-05-19  7:48     ` Jason Rumney
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2004-05-19  7:08 UTC (permalink / raw)
  Cc: john_owens, emacs-devel

> Date: Tue, 18 May 2004 20:03:46 -0400
> From: Miles Bader <miles@gnu.org>
> 
> On Tue, May 18, 2004 at 04:38:08PM -0700, John Owens wrote:
> > I'd like to figure out how/where it's hanging, but I don't know how I
> > might do so. Suggestions?
> 
> Run emacs in gdb, preferably from the src directory where you compiled emacs:
> 
>    $ cd ~/emacs-build/src
>    $ gdb ./emacs
> 
> [There's a special .gdbinit file in that directory that defines handy emacs
> debugging commands.]

The OP runs the Windows port, so this advice will probably not help.
(John, is that an MSVC build or a MinGW build?  "M-x emacs-version
RET" should tell you.)

The file etc/DEBUG has near its end some hints about debugging Emacs
on MS-Windows; I suggest that John reads that.  The text there doesn't
say how to interrupt Emacs (the equivalent of C-z on Posix platforms),
so perhaps someone here who knows how to do that could help you.

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

* Re: how to debug an emacs hang?
  2004-05-19  7:08   ` Eli Zaretskii
@ 2004-05-19  7:48     ` Jason Rumney
  0 siblings, 0 replies; 6+ messages in thread
From: Jason Rumney @ 2004-05-19  7:48 UTC (permalink / raw)
  Cc: john_owens, emacs-devel, Miles Bader

Eli Zaretskii <eliz@gnu.org> writes:

> The OP runs the Windows port, so this advice will probably not help.
> (John, is that an MSVC build or a MinGW build?  "M-x emacs-version
> RET" should tell you.)

The Windows binary release is compiled with MinGW, so gdb will
work. If the OP has compiled with MSVC himself, then he will have the
equivalent debugger.

> The file etc/DEBUG has near its end some hints about debugging Emacs
> on MS-Windows; I suggest that John reads that.  The text there doesn't
> say how to interrupt Emacs (the equivalent of C-z on Posix platforms),
> so perhaps someone here who knows how to do that could help you.

The MSVC debugger has a break command. I don't know the keyboard
equivalent, but it is in the menu.

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

* Re: how to debug an emacs hang?
  2004-05-18 23:38 how to debug an emacs hang? John Owens
  2004-05-19  0:03 ` Miles Bader
@ 2004-05-20 22:59 ` John Owens
  2004-05-22 19:09   ` Kai Grossjohann
  1 sibling, 1 reply; 6+ messages in thread
From: John Owens @ 2004-05-20 22:59 UTC (permalink / raw)


John Owens <john_owens@yahoo.com> writes:

> I've been running the same emacs (the released version of NT emacs
> 21.3) for quite some time, but recently it started hanging while I'm
> composing a mail message (via vm-mail), and I made it also hang when
> editing a HTML file. It hangs for about a minute (to the point where
> it doesn't even refresh) and eventually all my text suddenly appears
> and it's all back to normal. Hitting C-g does not seem to do anything
> while it is hanging.
>
> I'd like to figure out how/where it's hanging, but I don't know how I
> might do so. Suggestions?

Thank you all for the kind replies. I am using a precompiled version
from Ted Jump ["GNU Emacs 21.3.1 (i386-msvc-nt5.1.2600) of 2003-03-25
on TJUMP20"], clearly a MSVC compile and not a debug one. I've never
actually built one myself on Windows (but have on OS X). 

The hope was that it would be possible to set a variable that would
actually catch some signal and give a backtrace, but that does not
seem to be available (or such is my understanding from your replies).
Also it happens infrequently enough that running a debug build would
probably annoy me. :) However, I appreciate the pointer to the
etc/DEBUG docs and will give those a try.

The codebase has probably progressed enough since 21.3 was released
that I'm probably better off just getting a new CVS build and seeing
if the problem is still present, and if so, debugging it instead. (I'm
running a CVS build on OS X currently.) One difficulty with that
approach is that if I'm getting source from CVS it's always a little
dicey to make sure I have a stable version, since I might have got new
files in the middle of a checkin. Given the maturity of the 21.3.50
tree, maybe it's getting about time to at least mark a set of files as
"alpha1", "alpha2", etc. just to make sure they're stable.

Thanks again for the replies.

JDO

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

* Re: how to debug an emacs hang?
  2004-05-20 22:59 ` John Owens
@ 2004-05-22 19:09   ` Kai Grossjohann
  0 siblings, 0 replies; 6+ messages in thread
From: Kai Grossjohann @ 2004-05-22 19:09 UTC (permalink / raw)


John Owens <john_owens@yahoo.com> writes:

> One difficulty with that approach is that if I'm getting source from
> CVS it's always a little dicey to make sure I have a stable version,
> since I might have got new files in the middle of a checkin.

I'm surprised, I can't remember that this ever happened to me.  Did
it happen to you?

You could run "cvs update" again after a few seconds, and if nothing
changes then you guess that you're not in the middle of a checkin.

Kai

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

end of thread, other threads:[~2004-05-22 19:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-18 23:38 how to debug an emacs hang? John Owens
2004-05-19  0:03 ` Miles Bader
2004-05-19  7:08   ` Eli Zaretskii
2004-05-19  7:48     ` Jason Rumney
2004-05-20 22:59 ` John Owens
2004-05-22 19:09   ` Kai Grossjohann

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