From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Nick Roberts Newsgroups: gmane.emacs.devel Subject: Re: gdbui hang Date: Tue, 11 May 2004 23:43:05 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <16545.22265.561216.75019@nick.uklinux.net> References: <16543.48815.692499.486290@nick.uklinux.net> <87fza8qewy.fsf-monnier+emacs@gnu.org> <16545.16531.713274.678978@nick.uklinux.net> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1084317539 32115 80.91.224.253 (11 May 2004 23:18:59 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 11 May 2004 23:18:59 +0000 (UTC) Cc: emacs-devel@gnu.org, Miles Bader Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed May 12 01:18:49 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BNgWP-0002FJ-00 for ; Wed, 12 May 2004 01:18:49 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BNgWP-0007wV-00 for ; Wed, 12 May 2004 01:18:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BNgVi-0001ec-Il for emacs-devel@quimby.gnus.org; Tue, 11 May 2004 19:18:06 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.34) id 1BNgUu-0000cI-8V for emacs-devel@gnu.org; Tue, 11 May 2004 19:17:16 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.34) id 1BNgUA-00088l-0G for emacs-devel@gnu.org; Tue, 11 May 2004 19:17:03 -0400 Original-Received: from [199.232.41.8] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1BNgU9-000885-LQ; Tue, 11 May 2004 19:16:29 -0400 Original-Received: from [194.247.51.3] (helo=nick.uklinux.net) by mx20.gnu.org with esmtp (Exim 4.34) id 1BNg0c-0000IM-CS; Tue, 11 May 2004 18:46:02 -0400 Original-Received: by nick.uklinux.net (Postfix, from userid 501) id 144AB75FDE; Tue, 11 May 2004 23:43:05 +0100 (BST) Original-To: Stefan Monnier In-Reply-To: X-Mailer: VM 6.97 under Emacs 21.2.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:23192 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:23192 > In general I think the add-hook should not be global but only apply to the > *gud* buffer. kill-buffer-hook *is* a global variable, though. gud-kill-buffer-hook does only apply to the *gud* buffer though the condition (eq (current-buffer) gud-comint-buffer). What's there to make local? > But I must say that I don't understand at all what the > current gud-kill-buffer-hook is doing: > > % grep -nH gud-minor-mode-type *.el > gud.el:2504:(defvar gud-minor-mode-type nil) > gud.el:2512: (if (eq gud-minor-mode-type 'gdba) > gud.el:2549: (setq gud-minor-mode-type gud-minor-mode))) > > It's a variable used in the process sentinel but only set when > a gud-minor-mode buffer is killed. Sounds pretty odd, yet there's no > comment explaniing what going on. Sounds like a bug (or some left over > code). I wrote that code, a while back. Here's my logic: gud-sentinel needs to do different things depending on whether gdb is run with "-fullname" (gud-minor-mode = 'gdb) or "-annotate=3" or (gud-minor-mode = 'gdba). gud-sentinel is executed after the buffer is killed and so can't deduce which case it is dealing with. However, gud-kill-buffer-hook is run before the buffer is killed, so it is used to store gud-minor-mode in the variable gud-minor-mode-type. > > Shall I commit this change? > > Given that it changes the current behavior in ways I don't understand > (because I don't understand the current behavior), I can't tell. > But you might want to check that `get-buffer-process' returns non-nil. How about: (defun gud-kill-buffer-hook () (when (eq (current-buffer) gud-comint-buffer) (setq gud-minor-mode-type gud-minor-mode) (condition-case nil (kill-process (get-buffer-process gud-comint-buffer)) (error nil)))) Nick