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#11273: 24.0.94; quitting gdb Date: Thu, 19 Apr 2012 16:27:49 +0800 Message-ID: <87mx68yvlm.fsf@gnu.org> References: <87y5ps99xp.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1334824141 13243 80.91.229.3 (19 Apr 2012 08:29:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 19 Apr 2012 08:29:01 +0000 (UTC) Cc: 11273@debbugs.gnu.org To: sds@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Apr 19 10:29:00 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 1SKmjb-0003WD-MD for geb-bug-gnu-emacs@m.gmane.org; Thu, 19 Apr 2012 10:28:59 +0200 Original-Received: from localhost ([::1]:44308 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKmjb-0000H9-26 for geb-bug-gnu-emacs@m.gmane.org; Thu, 19 Apr 2012 04:28:59 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:40262) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKmjT-0000GG-Qa for bug-gnu-emacs@gnu.org; Thu, 19 Apr 2012 04:28:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SKmjN-0000k7-IA for bug-gnu-emacs@gnu.org; Thu, 19 Apr 2012 04:28:51 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39810) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKmjN-0000k3-EP for bug-gnu-emacs@gnu.org; Thu, 19 Apr 2012 04:28:45 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SKmje-0007tr-If for bug-gnu-emacs@gnu.org; Thu, 19 Apr 2012 04: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: Thu, 19 Apr 2012 08:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11273 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11273-submit@debbugs.gnu.org id=B11273.133482410630306 (code B ref 11273); Thu, 19 Apr 2012 08:29:02 +0000 Original-Received: (at 11273) by debbugs.gnu.org; 19 Apr 2012 08:28:26 +0000 Original-Received: from localhost ([127.0.0.1]:40839 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SKmj0-0007si-Tb for submit@debbugs.gnu.org; Thu, 19 Apr 2012 04:28:26 -0400 Original-Received: from fencepost.gnu.org ([208.118.235.10]:47370 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SKmiv-0007sR-2r for 11273@debbugs.gnu.org; Thu, 19 Apr 2012 04:28:21 -0400 Original-Received: from [155.69.17.55] (port=47293 helo=ulysses) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1SKmib-0003wk-7d; Thu, 19 Apr 2012 04:27:57 -0400 In-Reply-To: <87y5ps99xp.fsf@gnu.org> (Sam Steingold's message of "Wed, 18 Apr 2012 14:22:42 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.95 (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:59248 Archived-At: Sam Steingold writes: > I start gdb on an interactive process (clisp) which I then exit. > Now, I quit gdb too, but I am still left with a bunch of gdb windows and > emacs running at 100% cpu because > (process-status "gdb-inferior") > => run > even though it actually does not run (according to ps). > (delete-process "gdb-inferior") fixes that, but this should not be > necessary. > > 1. BUG: even though the gdb-inferior process is not running, it is > reported as running and emacs takes 100% cpu. This seems to be a combination of two bugs in the process code. The situation is as follows: gdb-mi creates a pty process in the "gdb-inferior" buffer, and hooks that pty up to the main gdb process. The first bug is that it's necessary to explicitly call delete-process on pty processes. The gdb-mi code did not explicitly do this. Normally, when you kill a buffer Emacs offers to kill its processes, but this is ineffective for ptys, as the kill_buffer_processes() code calls kill-process, not delete-process. You can show this problem with the following code unrelated to gdb: M-: (start-process "foo" (current-buffer) nil) RET C-x k RET yes RET M-x list-processes RET Even though the pty's buffer is killed, and the user was prompted whether to kill the process and answered yes, the pty is still "running". I don't know whether we should fix this general bug for 24.1---Stefan, any opinion? In the meantime, I installed a workaround to explicitly call delete-process on the pty in the sentinel of the main gdb process. Here is the second bug. Uunder some circumstances, when the gdb process exits, the sentinel doesn't get run. You can see this by instrumenting the `gud-sentinel' function, starting `M-x gdb', issuing an "r" command, then "q". The sentinel is never called, even though list-processes confirms that the gdb process is now dead. I have no idea why this happens, but according to a debugging session it appears that the select() call in process.c:4457 always returns a value >=0, so that status_notify() is never called. Maybe this has to do with the presence of the gdb-inferior pty?