Next  |  Prev  |  Up  |  Top  |  Index  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search


Executing gdb from Emacs

A great advantage to using gdb in emacs is that it works the same on all platforms (Linux, Windows, etc.), and it displays the source in a separate emacs buffer window. As you single-step the program, a pointer shows you which line of source code will be executed next.

Section A.4 described compiling your program from within emacs, which makes it very quick to correct syntax errors and other compile-time problems.

To start gdb within emacs, say M-x gdb <Enter>, edit the gdb execution line, if necessary, and type <Enter> again. A gdb buffer window is created by emacs, and you will see the (gdb) prompt. Set a breakpoint (if not already provided by your .gdbinit file), and type r <Enter> to run the program. When the program stops, a second emacs buffer window will be created containing the source code with a pointer ``=>'' indicating the next line of code to be executed. This is your first breakpoint.

In the source display window within emacs, a breakpoint can be set for the line containing the cursor by typing C-x <space>.


Next  |  Prev  |  Up  |  Top  |  Index  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

[How to cite and copy this work] 
``Physical Audio Signal Processing for Virtual Musical Instruments and Digital Audio Effects'', by Julius O. Smith III, (December 2005 Edition).
Copyright © 2006-07-01 by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA  [Automatic-links disclaimer]