Subject: bug#22374: 24.4; Buffers of previously open files appear in gud interaction window instead of source window in many-windows mode

From: Michael Buksas <[email-masked]>
Date: Thu, 14 Jan 2016 16:59:19 -0700

If a file is open before running gdb and many-windows mode, and is not
currently visible in the source code window, switching to
the file by clicking or pressing enter on a line in the stack frame
window will cause the buffer to appear in the gud interaction window,
and not in the source window.

To reproduce:

1) Create a test code test.cpp containing:

int main() { while (1) { } return 0; }

2) Compile with debugging symbols

 > gcc test.cpp -g

3) Run emacs:

 > emacs -Q

4) Open test.cpp in emacs.

5) Run gdb and select a.out if necessary.

6) Enter many-windows mode with M-x many-windows-mode

7) Start the program in the gud interaction window:

 > (gdb) start

8) Switch to a different buffer in the source window. e.g. *scratch*

9) Middle-click the single line in the stack frame window.

The buffer for file test.cpp will appear in the gud interaction window,
instead of the source window.

If you omit step 4. The file test.cpp will appear in the source window.

Thanks!

In GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.9)
of 2015-03-21 on kissel, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11701000
System Description: Ubuntu 15.04

Configured using:
`configure --build x86_64-linux-gnu --prefix=/usr
--sharedstatedir=/var/lib --libexecdir=/usr/lib
--localstatedir=/var/lib --infodir=/usr/share/info
--mandir=/usr/share/man --with-pop=yes
--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
--build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
--libexecdir=/usr/lib --localstatedir=/var/lib
--infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
--with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
'CFLAGS=-g -O2 -fstack-protector-strong -Wformat
-Werror=format-security -Wall' CPPFLAGS=-D_FORTIFY_SOURCE=2
'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro''

Important settings:
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix

Major mode: Frames [thread 1]

Minor modes in effect:
gdb-many-windows: t
tooltip-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
buffer-read-only: t
line-number-mode: t
transient-mark-mode: t

Recent input:
<help-echo> M-x g d b <return> <return> M-x g d b -
m a n y - w i n <tab> <return> r u n <return> C-c C-c
<help-echo> <help-echo> <help-echo> <down-mouse-2>
<mouse-2> <help-echo> <help-echo> <down-mouse-1> <mouse-1>
C-x b <return> <help-echo> <help-echo> <down-mouse-2>
<mouse-2> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> M-x
r e p o r t - a m <backspace> <backspace> e m a c s
- b u g <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Target doesn't support non-stop mode. Turning it off.
Gdb-Many-Windows mode enabled
Switched to thread 1

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
help-fns mail-prsvr mail-utils cus-start cus-load gdb-mi bindat json gud
easy-mmode comint ansi-color ring cc-langs cl-loaddefs cl-lib cc-mode
cc-fonts easymenu cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs time-date tooltip electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode prog-mode register page

-- 
Michael Buksas
Stellar Science, LLC
[email-masked]
www.stellarscience.com