------- Comment #19 from steven at gcc dot gnu dot org 2006-10-14 14:17 ------- Someone should make gdb understand the DW_AT_calling_convention attribute. This is the bit necessary to make it work for Fortran. I considered stealing a bit on FUNCTION_DECL to mark it as the main program but it seems to me that this hard-coded solution should be acceptable as well (but, your thoughts?).
Index: dwarf2out.c =================================================================== --- dwarf2out.c (revision 117672) +++ dwarf2out.c (working copy) @@ -11105,11 +11105,18 @@ add_calling_convention_attribute (dw_die { enum dwarf_calling_convention value = DW_CC_normal; - value = targetm.dwarf_calling_convention (type); + if (is_fortran ()) + { + /* The subroutine named MAIN__ is the main program for Fortran. */ + const char *subroutine_name = get_AT_string (subr_die, DW_AT_name); + if (strcmp (subroutine_name, "MAIN__") == 0) + value = DW_CC_program; + } + else + value = targetm.dwarf_calling_convention (type); - /* Only add the attribute if the backend requests it, and - is not DW_CC_normal. */ - if (value && (value != DW_CC_normal)) + /* Only add the attribute if it is not DW_CC_normal. */ + if (value != DW_CC_normal) add_AT_unsigned (subr_die, DW_AT_calling_convention, value); } -- steven at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |steven at gcc dot gnu dot | |org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=1427