[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Emacs mode for GDB

From: Nick Roberts
Subject: Emacs mode for GDB
Date: Mon, 20 May 2002 23:36:57 +0100

I am writing a mode for Emacs that allows it to act as a GUI for gdb. 

It is based on an earlier file called gdba.el which may not be familiar to
some members of this mailing list since, as far as I know, most GNU/Linux
distributions only included it in the source package of gdb and not the binary
one. gdba.el has a stack buffer, breakpoints buffer and separate input/output
buffer for the program being debugged among other features. It uses a feature
of gdb called annotations. Although Emacs uses the gdb option `-annotations=1'
(or `-fullname') in gud.el, this option only generates one annotation (to tell
gud where it has stopped). The option used here, `-annotations=2', has many
more and this makes it more powerful.

The mode I am writing extends gdba.el and uses features of Emacs 21 that
weren't available to it such as the toolbar and breakpoint icons (or
characters for a text-only terminal) in the display margin.

Before I develop this mode further, I would be grateful for some feedback to
help ensure it is a mode that people actually want to use. I have therefore
placed a tar file with the lisp code and associated files at 
http://nick.uklinux.net/gdbel-0.1.tgz for anyone who is able to spend some
time to look at it and give comment.

There is also a screenshot of Emacs using this mode at



Brief description of mode

This mode works best in X using the full screen. You can see its features if
you run gdb using a simple C program that calls another procedure and prints
some output :

After a short delay the following layout should appear (key-bindings given in
relevant buffer) :

                            gdb  toolbar
GUD buffer (I/O of gdb)           | Locals buffer
Source buffer                     | Input/Output (of debugee) buffer
                                  | (comint-mode)
Stack buffer                      | Breakpoints buffer
[mouse-2]   gud-frames-select     | SPC    gud-toggle-bp-this-line
                                  |   g    gud-goto-bp-this-line
                                  |   d    gud-delete-bp-this-line

All the buffers share the toolbar and source should always display in the same
window e.g after typing g on a breakpoint in the breakpoints buffer. The GUI
interacts with the GUD buffer eg breakpoint icons are displayed not only by
setting a break with gud-break but also by typing break in the GUD buffer.

There are also a couple of interactive lisp functions e.g
gdb-restore-windows - to restore the layout if its lost.
gdb-quit            - to delete (most) of the buffers used by gdb.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]