Question

I have a fortran program that calls some dependent .o object files. I would like to be able to step across files when debugging, is this possible?

the compilation routine goes something like this:

gfortran -g -o analyze.x analyze.o active.o analysis.o angles.o attach.o basefile.o beeman.o bicubic.o

where analyze.x is the executable. All of the .o files have been compiled using the -g flag as well. When i do (gdb) break main and then attempt to step through the program, most of the subroutines take place in the object files. I was wondering if it is possible to be able to step through the object file code as well.

Était-ce utile?

La solution

This will work only if the object files linked into the executable have debug information in them, i.e. have been compiled with the -g option. So, this should work:

# Compile all Fortran and C files with debug info
gfortran -g -c *.f90
gcc -g -c *.c
# Link everything together
gfortran -g -o myexe *.o
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top