This is the mail archive of the
mailing list for the GCC project.
[Bug java/1427] gcj should generate N_MAIN stab or DW_AT_entry_point dwarf2 debug info
- From: "woodzltc at sources dot redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Nov 2005 03:04:43 -0000
- Subject: [Bug java/1427] gcj should generate N_MAIN stab or DW_AT_entry_point dwarf2 debug info
- References: <firstname.lastname@example.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #18 from woodzltc at sources dot redhat dot com 2005-11-15 03:04 -------
(In reply to comment #8)
> Dwarf2 has DW_AT_entry_point for the same thing as the stabs N_MAIN.
I am now believing that DW_CC_program is for this purpose in DWARF. Please
have a look at the following two excerpted paragraphs in section 3.3.1 of DWARF
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.
==== End of the excerpt ====
Although it is intended to support Fortran main programs. But I think that it
might also be ok for java as well.
If my understanding is right, I think the fix is not that hard (at least for
gfortran). Here is my thought: when gfortran trying to emit symbol MAIN__, we
can add an extra attribute DW_AT_calling_convention and set it to
DW_CC_program. Then in gdb's dwarf2reader, we can add a routine to find out
the symbol whose DW_AT_calling_convention is DW_CC_program, and set it to the
I am not familar with the gfortran code, if anyone could code the above patch
in gfortran's side, I could try to code in the gdb's side. But if anyone is
willing to point out where to emit DWARF debuginfo for MAIN__ in gfortran's
source, I am very happy to have a try in gfortran.
For java, the process might be the same.