First page Back Continue Last page Overview Graphics
- Start gdb, load the program and wait at prompt for instructions.
gdb programname corefile
- Start gdb, load the program, load the core file
gdb programname pid
- Start gdb, attach to running program, pause program
The first way of using gdb is to run your program through gdb; that is great when you know your program is broken and you know where to start looking.
When you have a core file then the 2nd way comes in useful. Actually just loading gdb this way and typing 'where' will tell you most of the time why your program dumped core; although sometimes your program can go so badly wrong it can overwrite the stack so gdb can't figure it out.
Finally you can attach to a running program - say a program appears to have done something wrong but is still running. Try attaching to something like
a text editor.