Compiler option | What it does | When to use it |
Debugging symbols option (usually –g) | Generates debugging information in the symbol table. | Before debugging any program with NextGen TotalView for HPC. |
Optimization option (usually –O) | Rearranges code to optimize your program's execution. Some compilers let you use the –O option with the ‑g option, but we advise against doing this before using the debugger as unexpected results often occur. | After you finish debugging your program. |
Compiler | Compiler Command Line |
GCC C | gcc -g source.c |
GCC C++ | g++ -g source.cxx |
clang C | clang -g source.c |
clang C++ | clang++ -gsource.cxx |
Oracle Studio C | cc -g source.c |
Oracle Studio C++ | CC -g source.cxx |
Intel C++ Compiler | icc -g source.cxx |
PGI CC | pgcc -g source.c |
PGI C++ | pgc++ -gsource.cxx |
Compiler | Compiler Command Line |
Absoft Fortran 77 | f77 -g program .f f77 -g program.for |
Absoft Fortran 90 | f90 -g program.f90 |
Absoft Fortran 95 | f95 -g program.f95 |
G77 | g77 -g program.f |
Intel Fortran Compiler | ifort -g program.f |
Lahey/Fujitsu Fortran | lf95 -g program.f |
PGI Fortran 77 | pgf77 -g program.f |
PGI Fortran 90 | pgf90 -g program.f |
Compiler | Compiler Command Line |
GCC C | gcc -g program.c |
GCC C++ | g++ -g program.cxx |
G77 | g77 -g program.f |
Compiler | Compiler Command Line |
Absoft Fortran 77 | f77 -gprogram .f f77 -gprogram.for |
Absoft Fortran 90 | f90 -gprogram.f90 |
Absoft Fortran 95 | f95 -g program.f95 |
GCC C | gcc -g program.c |
GCC C++ | g++ -gprogram.cxx |
GCC Fortran | gfortran -gprogram.f |
clang C | clang -g source.c |
clang C++ | clang++ -gsource.cxx |
Intel C++ Compiler | icc -g source.cxx |
Intel Fortran Compiler | ifort -g program.f |