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 14:11:42 +0800

Dov Grobgeld <[email-masked]> writes:

> I put breakpoints at the lines that you indicated, but as you
> suspected, the breakpoints are only reached when I exit gdb with the
> "quit" command.
>
> What's next? Thanks again for looking into this.

Please apply the following patch, then, when Emacs is taking 100% CPU,
set a breakpoint at process.c:4854, i.e. at

		if (p->pid == -2)
		  ;

This captures the state just after Emacs calls read_process_output on
the pty passed to your program.  If this breakpoint is triggered, please
report the value of nread and errno, and step through to the end of the
subsequent if/else block and report the gdb session.  Thanks.

=== modified file 'src/process.c'
*** src/process.c	2012-04-20 06:39:29 +0000
--- src/process.c	2012-05-07 06:09:25 +0000
***************
*** 4847,4852 ****
--- 4847,4859 ----
  		 buffered-ahead character if we have one.  */
  
  	      nread = read_process_output (proc, channel);
+ 
+ 	      {
+ 		struct Lisp_Process *p = XPROCESS (proc);
+ 		if (p->pid == -2)
+ 		  ;
+ 	      }
+ 
  	      if (nread > 0)
  		{
  		  /* Since read_process_output can run a filter,