emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gdbui hang


From: Stefan Monnier
Subject: Re: gdbui hang
Date: 11 May 2004 19:23:00 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>> 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?

Se the `local' arg of ad-hook.

>> 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.

Ah I see.  [ Reminds me that I'd like to add property lists to processes. ]
But in this particular case, I guess the best approach is to merge
gdb-reset into gud-reset so the sentinel doesn't have to care about the
difference between various gud-minor-mode.

BTW: the regexp "^\*.+*$" in gdb-reset should probably be "\\`\\*.+\\*\\'"
[ or even thrown away and replaced with something like a buffer-local variable
`gud-auxiliary-buffer' which would be set to non-nil (better yet: to the
main *gud* buffer) in those *foo* buffers. ]

> (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))))

Sure.  Except I'd add the hook buffer-locally so you don't need to check
(eq (current-buffer) gud-comint-buffer).


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]