I am debugging a program that outputs 8 or more lines of display and requires input. So my IO window has to be say 10 rows or so in height. But I also want to see the source code AND of course the gdb input window.

What is the easiest way to present this? To have 3 windows? 1 for gdb, 1 for console and the other for the source code? If so how do I get 3 windows?

Or if I could somehow get the gdb io window to be a separate console window that might be even better.

  • Do you want to split your Emacs frame into multiple windows? There's C-x 2 and C-x 3. You can adjust window sizes with C-x {, C-x }, C-x ^ and C-x -. You can also have multiple Emacs frames connected to the same Emacs instance.
    – user12563
    Commented Sep 22, 2018 at 13:43

2 Answers 2


For anyone else's benefit, you can use gdb-many-windows like:

  1. Compile your executable (don't forget to compile with the -g flag).
  2. m-x gdb
  3. m-x gdb-many-windows

You then get the same sort of environment as you would find in developer IDE's.

Some links: https://www.gnu.org/software/emacs/manual/html_node/emacs/GDB-User-Interface-Layout.html https://undo.io/resources/gdb-watchpoint/using-gdb-emacs/


To create a new console window you can do C-x 5 b with an existing buffer or C-x 5 f to open a file. To switch between the different consoles you can do C-x 5 o You can then split each of the consoles into different frames horizontally by C-x 2 or vertically by C-x 3

  • C-x 5 b, like C-x b and C-x 4 b, is not just for an existing buffer. It's also for creating a new buffer.
    – Drew
    Commented Sep 16, 2020 at 1:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.