gdb

2009 Mar 01


Internals
(PDF)
GDB
Commands
GDB
& emacs
Invoking
GDB
Books External
Links

GDB is a debugger. The purpose of a debugger to see what is going on inside another program while it executes, or at the moment it crashed. GDB can:

GDB is free software protected by the GNU General Public License (GPL). GPL gives you the freedom to copy or modify a licensed program and the freedom to distribute further copies.

Supported Languages include: C, C++, Fortran, Java, Modula-2, Assembler.


Invoking GDB - Command Line Switches and Parameters

Note: gdb looks for 2nd param in following order: core, pid.

Note that command line arguments are procesed in order, and this can matter!

Switch Abrev
w/param
Meaning
F i l e s
-command -x file Execute gdb commands from file
-core -c file Read core from file
-directory -d directory Add directory to path to search for source files
-exec -e file Read executable from file
-mapped -m Warning not supported on all systems.
If memory mapped files are available on the system
through the mmap system call, this option will
cause the symbols to be written to a reusable file
named program.sysm. Future gdb sessions
notice this file and read it. This file is host dependent.
-readnow -r Read each symbol file's entire stable now,
rather than incrementally as needed.
-symbols -s file Read symbol table from file
  -se file Read symbol table and executable from file
M o d e s
  -b bps Set line speed (baud rate) of serial interface
used by gdb for remote debugging to bps.
-batch   Run in batch mode. Exit with status 0 after all commans
specified with .gdbinit (provied no -n and -x.
Exit with non zeroo status if an error occurs.
  -cd directory Use directory rather than current directory
-fullname -f Emacs sets this option to run gdb as a subprocess.
It tells gdb to output the full filename and line number
in a standard fashion each time a stack frame is displayed.
It is two \032 char followed by file name, line number, and
character position separated by colons and a newline.
-quiet -q Do not print introductory and copyright messages.
They are normally suppressed in batch mode.
  -tty device Run using device for your program's stdin and stdout.

GDB commands

Cmnd Abrev Meaning
O v e r a l l
quit q Exit gdb (or type EOF, usually ^d)
  make make_args Invoke make with specified arguments.
Same as: shell make make_args.
  shell command string Invokes a shell to execute command string.
If it exists, the environment varaible SHELL
will specify the shell, else gdb uses sh.

Books


External Links

Commercial and Free GUI Versions


2005-2009