I have a very large program (~1k subroutines) that is mostly fortran, compiled with pgf77, and some c, compiled with gcc. The main subroutine is in c (in main.c) and it calls the initial fortran subroutine that then does all the work.
In the main.c file, I also use feenableexcept to turn on floating point exceptions, and install a signal handler to catch sigsegv & sigpfe. The handler then uses glibc’s backtrace() function to get a backtrace of the crash location. I tested this (backtrace stuff) using pure c, and a c/fortran setup using gfortran/gcc, and both produced a backtrace. When I try (with simple test code) with pgf77/gcc, the backtrace doesn’t return any info except the address for the signal handler.
Is there a way to get this information? Do I have to have a certain compiler flag? I’m compiling with:
gcc -g -c file.c
pgf77 -g -c file.f
and I’m linking with:
pgf77 -g -lm -Mnomain *.o
Also, is there a library I can include to link with gcc? For gfortran I can just link with -lgfortran.