This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problems while debugging fortran


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Daniel Jacobowitz wrote:
> On Thu, Oct 25, 2007 at 08:30:38AM -0700, Jim Blandy wrote:
>> This comment isn't right.  The Fortran main program expects to have
>> its arguments passed to it differently than other subroutines or
>> functions; that's what DW_AT_calling_convention is meant to express.
>> The comment should say something like:
>>
>>   /* DWARF doesn't provide a way to identify a program's entry point.
>>      However, the Fortran main program receives its arguments via a
>>      special calling convention; we look for that to recognize the
>>      program's entry point.  */
>
> Have we concluded that this is true?  If so, is there any reason we
> should not make gfortran generate this attribute?  And if so, why
> not GNAT or GCJ too?
>
> The only thing we risk (that I can think of) in treating DW_CC_program
> as a marker for main is that if the architecture required
> DW_CC_program to indicate calling convention on a per-function basis
> we would fail to implement "print main()" correctly.  I don't think
> that matters.
>
The DWARF3 spec says:

'If the semantics of the language of the compilation unit containing
the subroutine entry distinguishes between ordinary subroutines and
subroutines that can serve as the "main program", that is, subroutines
that cannot be called directly according to the ordinary calling
conventions, then the debugging information entry for such a
subroutine _may_ have a calling convention attribute whose value is
the constant DW_CC_program.

The DW_CC_program value is intended to support Fortran main programs.
It is not intended as a way of finding the entry address for the program.'

So, it's a suggestion by the DWARF spec. I was investigating the DWARF
info generated by gfortran and found out that this compiler doesn't
generate DW_AT_calling_convention. Instead, it replaces the name of
the "main program" by MAIN__ . Therefore, I think we should restrict
this only to XLF.

What's your opinion?


- --
Carlos Eduardo Seo
Software Engineer
IBM Linux Technology Center
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHIMD1qvq7Aov/qQARAl46AJ9ODvLeHzL2rpcwvXMWVzpLxmaM1wCfePEN
XFp9dC4zv7b7ChzwKUcQyRk=
=6NPq
-----END PGP SIGNATURE-----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]