gdb and g77

Dave Love d.love@dl.ac.uk
Tue Jun 15 02:46:00 GMT 1999


>>>>> "JCB" == craig  <craig@jcb-sc.com> writes:

 JCB> But we now have info suggesting that gdb interprets debug records
 JCB> from Fortran compilers *other* than g77 (with back ends other than
 JCB> gcc, I assume) *correctly*.

The gdb support was written for a compiler with different conventions
from g77.  (I sent a copy of the paper on it a while back.)  I started
working on changes long ago but couldn't get a response from bug-gdb
about incorporating changes and no-one else seemed interested, so I
dropped it and probably no longer have the work.

 JCB> Yup.  I don't know what various debug formats should look like,
 JCB> especially in the area of multi-dimensional arrays.

I can't remember the details, but array references are quite
broken, particularly for dummy args.  They're interpreted as function
calls in Fortran mode and can crash gdb in C mode with assumed-size
arrays; e.g. in something like this, look at a and b in foo with
`print' and `whatis'.

      real a(3)
      data a /1,2,3/
      call foo(a, a)
      end
      subroutine foo(a, b)
      real a(3), b(*)
      print *, a(1), b(1)
      end

 >> We should also review the stabs & dwarf2 specs to make sure they
 >> do not specify something dumb like requiring the compiler to emit
 >> records with reversed subscripts :-)

 JCB> Indeed.  Reviewing the specs is one of the requirements for
 JCB> working on this -- which is why I haven't just dived into the
 JCB> code yet, I've got too many *other* things to review at the
 JCB> moment!

Generally there are Fortran-specific stabs and DWARFism which should
probably be emitted but aren't (for COMMON in particular).  Also
name-mangling needs treating.

For stabs, the online ( http://docs.sun.com/ ) Sun Fortran docs explain
how they deal with Fortran and one can generate sample assembler.
AFAIR, gdb works reasonably well with SunPro f77 (stabs) but doesn't
with MIPSpro (DWARF, at least now).

 JCB> So I'd very much appreciate anyone with some understanding (and
 JCB> time) helping find the culprit....

I don't know about this case, but I think the job needs doing
properly, and that's a fair amount of work.  I presume that changes
could now be got into gdb, at least.


More information about the Gcc mailing list