2007-10-25 Wu Zhou Carlos Eduardo Seo Joel Brobecker * dwarf2read.c (read_partial_die): check the value of DW_AT_calling_convention in Fortran programs. Index: src/gdb/dwarf2read.c =================================================================== --- src.orig/gdb/dwarf2read.c +++ src/gdb/dwarf2read.c @@ -5616,6 +5616,19 @@ read_partial_die (struct partial_die_inf case DW_AT_byte_size: part_die->has_byte_size = 1; break; + case DW_AT_calling_convention: + /* In Fortran programs compiled with XLF, the only way we have found + so far to identify the main procedure is by using the fact that + the calling convention is different from the other procedures: + The DW_AT_calling_convention attribute is set to DW_CC_program. + + This is not the intent of this attribute as documented in the + DWARF standard, but we haven't found any other distinctive + characteristic of the main procedure, so we check the calling + convention for Fortran compilation units. */ + if ((DW_UNSND (&attr) == DW_CC_program) && (cu->language == language_fortran)) + set_main_name (part_die->name); + break; default: break; }