From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.bugs Subject: bug#10580: 24.0.92; gdb initialization takes more than one minute at 100% CPU Date: Mon, 07 May 2012 14:26:14 +0800 Message-ID: <87zk9kv75l.fsf@gnu.org> References: <20253.9861.848886.122482@fencepost.gnu.org> <87aa1mj69x.fsf@gnu.org> <87havtvpeb.fsf@gnu.org> <874nrsem67.fsf@gnu.org> <874nrswme9.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1336372032 7472 80.91.229.3 (7 May 2012 06:27:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 7 May 2012 06:27:12 +0000 (UTC) Cc: 10580@debbugs.gnu.org To: Dov Grobgeld Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon May 07 08:27:11 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SRHPZ-0008KE-Qv for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 May 2012 08:27:09 +0200 Original-Received: from localhost ([::1]:54843 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRHPZ-0007in-47 for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 May 2012 02:27:09 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58047) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRHPV-0007iX-NS for bug-gnu-emacs@gnu.org; Mon, 07 May 2012 02:27:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SRHPU-0004pp-0p for bug-gnu-emacs@gnu.org; Mon, 07 May 2012 02:27:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38017) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRHPT-0004pl-TT for bug-gnu-emacs@gnu.org; Mon, 07 May 2012 02:27:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SRHRO-0007oe-G3 for bug-gnu-emacs@gnu.org; Mon, 07 May 2012 02:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 07 May 2012 06:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10580 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10580-submit@debbugs.gnu.org id=B10580.133637210729999 (code B ref 10580); Mon, 07 May 2012 06:29:02 +0000 Original-Received: (at 10580) by debbugs.gnu.org; 7 May 2012 06:28:27 +0000 Original-Received: from localhost ([127.0.0.1]:39051 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SRHQo-0007no-T5 for submit@debbugs.gnu.org; Mon, 07 May 2012 02:28:27 -0400 Original-Received: from fencepost.gnu.org ([208.118.235.10]:44716 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SRHQm-0007ng-4Y for 10580@debbugs.gnu.org; Mon, 07 May 2012 02:28:25 -0400 Original-Received: from [155.69.19.224] (port=52420 helo=ulysses) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1SRHOo-00048Y-NC; Mon, 07 May 2012 02:26:23 -0400 In-Reply-To: <874nrswme9.fsf@gnu.org> (Chong Yidong's message of "Mon, 07 May 2012 14:11:42 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.96 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:59832 Archived-At: Actually, try the following patch instead (apparently gdb has some issues with printing errno). Apply the patch, then when Emacs is taking 100% CPU do an interrupt and set the breakpoint at process.c:4855, then when the breakpoint triggers do n p nread p errno and step through the subsequent if/else blocks. Thanks. Basically, the 100% CPU appears to be because Emacs' select() call keeps getting worken up by the pty attached to your program. But, for some reason, no actual output being read from that pty. These debugging steps are trying to figure out if some uncaught errno is being reported by the pty read. === modified file 'src/process.c' *** src/process.c 2012-04-20 06:39:29 +0000 --- src/process.c 2012-05-07 06:21:39 +0000 *************** *** 4822,4827 **** --- 4822,4829 ---- && !FD_ISSET (channel, &non_process_wait_mask)) { int nread; + int saved_errno = 0; + struct Lisp_Process *pp; /* If waiting for this channel, arrange to return as soon as no more input to be processed. No more *************** *** 4847,4852 **** --- 4849,4859 ---- buffered-ahead character if we have one. */ nread = read_process_output (proc, channel); + + pp = XPROCESS (proc); + if (pp->pid == -2) + saved_errno = errno; + if (nread > 0) { /* Since read_process_output can run a filter,