Subject: Re: bug#10580: 24.0.92; gdb initialization takes more than one minute at 100% CPU

From: Chong Yidong <[email-masked]>
Date: Mon, 07 May 2012 10:53:52 +0800

Dov Grobgeld <[email-masked]> writes:

> The *input/output of a.out* is empty.
>
> It seems that I was wrong about read_key_sequence(). It doesn't
> "return early".

During this time, is Emacs responsive to user commands, i.e. does it
work normally apart from taking 100% CPU?  Or is it just unresponsive?

Also, what is your gdb version?

Also, please set a breakpoint at process.c:4896, which should be the
line

		  struct Lisp_Process *p = XPROCESS (proc);

as well as the function exec_sentinel().  See if Emacs hits each
breakpoint, and step through it for the next several steps.  In
exec_sentinel, please show the Lisp values of the `proc' and `reason'
variables (i.e. `pp proc' and `pp reason'.)

Basically, gdb-mi.el allocates a pty and passes it to the gdb process,
which hooks the pty up to the debugged process's input/output.  That's
what the "1-inferior-tty-set /dev/pts/9" gdb command does.  Emacs then
listens for input/output on the pty.  Recently I fixed a bug in which
Emacs would use 100% CPU due to Emacs getting an EIO error on that pty
and then spinning; this fix involved setting up a sentinel that closes
the pty when Emacs gets EIO; it's possible the fix is not working for
you, though I don't know why.  The other possibility is that the program
you are debugging does something strange with its input/output stream.

Thanks.