...
More information: https://www.gnu.org/software/gdb/
Code Block |
---|
$ cc -g prog.c
$ gdb ./a.out
...
(gdb) list
(gdb) stop at 10
(gdb) run
(gdb) print variable
...
(gdb) quit
|
By default your jobs will not produce coredump files when they crash. To generate corefiles you need:
Code Block |
---|
$ ulimit -c unlimited # For bash
$ limit coredumpsize unlimited # For tcsh |
Also if you are using the Intel Fortran compiler, you will will need:
Code Block |
---|
$ export decfort_dump_flag=y # For bash
$ setenv decfort_dump_flag y # For tcsh |
To use the coredump file, enter:
Code Block |
---|
$ cc -g prog.c
$ gdb
$ gdb ./a.out /path/to/the/coredumpfile
...
(gdb) where
(gdb) bt
(gdb) frame number
(gdb) list
(gdb) info locals
(gdb) print variable
...
(gdb) quit |
Coredump files can take up a lot of disk space – be careful not to generate them if you are not going to use them.