University of Virginia Department of
    Computer Science

Capabilities

The purpose of a debugger such as GDB is to allow you to see what is going on ``inside'' another program while it executes-or what another program was doing at the moment it crashed.

GDB can do four main kinds of things (plus other things in support of these) to help you catch bugs in the act:

You can use GDB to debug programs written in C, C++, and Modula-2. Fortran support will be added when a GNU Fortran compiler is ready.

How to start gdb

GDB is invoked with the shell command gdb. Once started, it reads commands from the terminal until you tell it to exit with the GDB command quit. You can get online help from gdb itself by using the command help.

You can run gdb with no arguments or options; but the most usual way to start GDB is with one argument or two, specify- ing an executable program as the argument:

     gdb program
You can also start with both an executable program and a core file specified:
     gdb program core
You can, instead, specify a process ID as a second argument, if you want to debug a running process:
     gdb program 1234
would attach GDB to process 1234 (unless you also have a file named `1234'; GDB does check for a core file first).

Most Frequently Needed GDB Commands

Options

Some command line options are the following...

See also



HelpNet
HelpNet was created by the 1995 incoming graduate class. It is only occasionally updated.
Department of Computer Science
School of Engineering, University of Virginia
151 Engineer's Way, P.O. Box 400740
Charlottesville, Virginia 22904-4740

(434) 982-2200  Fax: (434) 982-2214
Web Comments: webteam@cs.virginia.edu
Admissions Inquiries: inquiry@cs.virginia.edu
Site directory, Other addresses
Server statistics
© Created by the CS Web Team