我正在使用带有gdb和gdb-many-windows的emacs 23.1.1.
我的问题是,是否可以强制gdb始终使用主源窗口来逐步执行代码.会发生的事情是,当我在堆栈帧中移动时,如果我碰巧将源文件放在另一个emacs帧中,则emacs会将该帧带到前台,同时将gud帧留在背景中并使用键盘焦点.
我想做的是强制emacs/gdb使用主源窗口进行所有跟踪,即使有另一个框架具有相同的源文件放置在某处.
有任何想法吗?
我的emacs版本是24.3。所以我不太确定以下建议是否能解决您的问题:
(defadvice gud-display-line (before one-source-window activate)
"Always use the same window to show source code."
(let ((buf (get-file-buffer true-file)))
(when (and buf gdb-source-window)
(set-window-buffer gdb-source-window buf))))
Run Code Online (Sandbox Code Playgroud)
我在旧源中
找到了gud-display-linearg : http ://www.mit.edu/~mkgray/stuff/ath/afs/oldfiles/project/silk/root/afs/athena.mit.edu/contrib/xemacs/ OldFiles/share/xemacs-packages/lisp/debug/gdb.eltrue-file
此外,gdb-source-window可以在有关 23.1 的讨论中找到:
https://groups.google.com/forum/#!topic /gnu.emacs.bug/KS6bhNeJ9rc
因此,看起来我使用的东西应该在23.1中可用。
为了避免窗口分裂,您可以尝试以下方法:
(defadvice gud-display-line (around one-source-window activate)
"Always use the same window to show source code."
(let ((buf (get-file-buffer true-file)))
(when (and buf gdb-source-window)
(set-window-buffer gdb-source-window buf)))
(let (split-width-threshold split-width-threshold)
ad-do-it
))
Run Code Online (Sandbox Code Playgroud)