Next  |  Prev  |  Top  |  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 F 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  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

Download stkintro.pdf
Visit the book (DRAFT) containing this material.
[How to cite and copy this work] 
``Introduction to the Synthesis Tool Kit (STK)'', by Julius O. Smith III, Music 420 Reader (updated Appendices O and P of the text).
Copyright © 2006-01-16 by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA  [Automatic-links disclaimer]