[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: g77/fort77 and gdb



On Tue, Sep 28, 1999 at 01:42:37PM +0100, H C Pumphrey wrote:

> Does anyone know whether it is possible to get gdb to work with Fortran? 

The free software support for running Fortran under a debugger is pretty 
poor.

> (g77 or fort77) The documentation says it should work (with certain
> caveats e.g. you can't see data in a common block, which is more feature

> in order to look at the code I get an error. For g77 it is:

> ../../../../libf2c/libF77/main.c:46: No such file or directory
> (which there certainly isn't)

That's odd - I don't get that on a "Hello, world!" program here.  I get
the same error as with fort77.  In any case...

> while for fort77 it is:

> Can't find a default source file

Try setting a breakpoint on the first line of code and running - it
works for me, although I don't get the same error you get with g77.

What's happening is that gdb doesn't know about the startup code in
lib[fg]2c and thinks the program starts in the main() in the library.
Since it doesn't (or shouldn't) have any debugging information on this
it complains.  Once it gets into your code, which does have debugging
information everything is as fine as it's likely to get.

There is a program avalible on sunsite called f2c-stabs which is
supposed to help with debugging - it runs within Emacs and attempts 
to paper over some of the cracks by knowing things about the way f2c
generated code works.  I don't think anyone has been interested enough
to package it.

-- 
Mark Brown  mailto:broonie@tardis.ed.ac.uk   (Trying to avoid grumpiness)
            http://www.tardis.ed.ac.uk/~broonie/
EUFS        http://www.eusa.ed.ac.uk/societies/filmsoc/

Attachment: pgpsXc4ca2rnp.pgp
Description: PGP signature


Reply to: