Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs, GDB, and multiple X windows

Tags:

emacs

gdb

I use gdb-many-windows in emacs for my debugging.

Recently, I discovered how to move a buffer to another X window using C-x 5 2.

I find it convenient: since I use multiple displays, I can have one window with source and variables, and gdb's command line in another window.

But my problem is when I perform a step-by-step in gdb: when it opens another source file, it does that in the same window where the command line is located, while I expect it to be updated in the other window.

Does anybody know how to tweak gdb or emacs to do that? Thanks,

like image 638
piwi Avatar asked Jun 18 '12 13:06

piwi


People also ask

What is the GDB-windows option in Emacs?

This is really useful - Emacs separates out the source code, the program output, the interpreter into separate windows so you can navigate your program more easily. However, there's even more that Emacs can show in separate windows by navigating to the GUD menu and then GDB-Windows option:

Why does m-x GDB start with two windows?

If the variable gdb-many-windows is nil (the default), M-x gdb normally displays only the GUD interaction buffer. However, if the variable gdb-show-main is also non- nil , it starts with two windows: one displaying the GUD interaction buffer, and the other showing the source for the main function of the program you are debugging.

How do I switch between many windows in gdb?

To toggle between the many windows layout and a simple layout with just the GUD interaction buffer and a source file, type M-x gdb-many-windows .

How do I debug a program in Emacs?

Step through a program using the step (execute line by line, entering any function calls) and next (execute line by line, skipping over function calls). If you're debugging inside of Emacs, gdb will draw an arrow before the to-be-executed line of your source file.


1 Answers

The value display-buffer-reuse-frames does address exactly this "issue". Session-wide setting in configuration file:

(setq-default display-buffer-reuse-frames t)
like image 85
piwi Avatar answered Nov 02 '22 23:11

piwi