So you are saying that calling gdb-display-source-buffer instead of
display-buffer will not by itself help here, because display-buffer is
called under the hood anyway, and might decide to create a new window
instead of reusing an existing one?
`gdb-goto-breakpoint` first calls `gdb-display-source-buffer` which will look for the right window to display. If `gdb-display-source-buffer` can’t find the right window, it will return nil. In that case `gdb-goto-breakpoint` will use `display-buffer` to show the buffer. So, if there _is_ a right window, gdb-mi will do the right thing, and `display-buffer` is not used.
If so, what would be the correct solution of this issue?
As for the issue where gbd-mi creates new window when it doesn’t need to, my fix is to make `gud-display-line` behaves like `gdb-goto-breakpoint`: try `gdb-display-source-buffer` first (when gdb-mi is enabled), then try `display-buffer`; instead of simply using `display-buffer`.