emacs-devel
[Top][All Lists]
Advanced

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

Re: Difficulty using M-x gdb


From: Konstantin Kharlamov
Subject: Re: Difficulty using M-x gdb
Date: Sat, 04 Feb 2023 00:35:11 +0300
User-agent: Evolution 3.46.3

On Wed, 2023-02-01 at 09:53 -0500, Michael Welsh Duggan wrote:
> I have used "M-x gud-gdb" to run gdb for many years.  I used it for
> quite a while after the gdb-mi interface was added due to its ability to
> debug the same program multiple times at the same time in the same
> Emacs.  I don't need that capability right now. 
> 
> Due to a bug in `gud-gdb` (#61162) I am trying to switch to "M-x gdb"
> instead.  Unfortunately, I can't really figure out how to make this work
> in a way that makes sense to me.  `gdb-many-windows` being nil is the
> default, and the default should be reasonably easy to use (one would
> hope), but I am having the following problem:
> 
> When I step through a program, the interface keeps track of where I am
> in the source buffer.  But, when the program produces output, it
> replaces the source buffer window with an input/output buffer window
> which is dedicated.  The only way I have found out to display the source
> buffer again is to use "M-x gdb-restore-windows".  In code that is doing
> a fair amount of output, this is very tedious.
> 
> What is right way to handle this?  If it requires customization, why is
> customization needed to make this fairly common case work well?  Is
> there a way to make output go the interaction buffer?  Maybe most
> importantly, this input/output buffer/window doesn't seem to be
> mentioned in the Emacs documentation at all.
> 
> I have my suspicions that, once I get used to the new interface, I might
> like using it, but right now I'm having difficulty figuring out what
> habits I need to relearn.

FWIW, I have the following code in my config that fixes the behavior you
mention.

    ;; Force gdb-mi to not dedicate any windows
    (advice-add 'gdb-display-buffer
            :around (lambda (orig-fun &rest r)
                  (let ((window (apply orig-fun r)))
                (set-window-dedicated-p window nil)
                window)))

With that said, neither I think it's a useful default behavior to replace a
window with a source code file with the one that shows app output.



reply via email to

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