Next: , Up: Debuggers


32.6.1 Starting GUD

There are several commands for starting a debugger, each corresponding to a particular debugger program.

M-x gdb <RET> file <RET>
Run GDB as a subprocess of Emacs. By default, this operates in graphical mode; See GDB Graphical Interface. Graphical mode does not support any other debuggers.
M-x dbx <RET> file <RET>
Similar, but run DBX instead of GDB.
M-x xdb <RET> file <RET>
Similar, but run XDB instead of GDB. Use the variable gud-xdb-directories to specify directories to search for source files.
M-x sdb <RET> file <RET>
Similar, but run SDB instead of GDB.

Some versions of SDB do not mention source file names in their messages. When you use them, you need to have a valid tags table (see Tags) in order for GUD to find functions in the source code. If you have not visited a tags table or the tags table doesn't list one of the functions, you get a message saying ‘The sdb support requires a valid tags table to work’. If this happens, generate a valid tags table in the working directory and try again.

M-x bashdb <RET> file <RET>
Run the bash debugger to debug file, a shell script.
M-x perldb <RET> file <RET>
Run the Perl interpreter in debug mode to debug file, a Perl program.
M-x jdb <RET> file <RET>
Run the Java debugger to debug file.
M-x pdb <RET> file <RET>
Run the Python debugger to debug file.

Each of these commands takes one argument: a command line to invoke the debugger. In the simplest case, specify just the name of the executable file you want to debug. You may also use options that the debugger supports. However, shell wildcards and variables are not allowed. GUD assumes that the first argument not starting with a ‘-’ is the executable file name.