Index: ./gdb/xcoffread.c =================================================================== --- ./gdb.orig/xcoffread.c +++ ./gdb/xcoffread.c @@ -1019,6 +1019,7 @@ { bfd *abfd = objfile->obfd; char *raw_auxptr; /* Pointer to first raw aux entry for sym. */ + int aux_entry = 0; /* Aux entry index to be read. */ struct coff_symfile_info *xcoff = XCOFF_DATA (objfile); char *strtbl = xcoff->strtbl; char *debugsec = xcoff->debugsec; @@ -1034,7 +1035,7 @@ unsigned int max_symnum; int just_started = 1; int depth = 0; - int fcn_start_addr = 0; + CORE_ADDR fcn_start_addr = 0; struct coff_symbol fcn_stab_saved = { 0 }; @@ -1156,7 +1158,7 @@ } if ((cs->c_sclass == C_EXT || cs->c_sclass == C_HIDEXT) - && cs->c_naux == 1) + && (cs->c_naux == 1 || cs->c_naux == 2)) { /* Dealing with a symbol with a csect entry. */ @@ -1166,9 +1168,24 @@ #define CSECT_SMTYP(PP) (SMTYP_SMTYP(CSECT(PP).x_smtyp)) #define CSECT_SCLAS(PP) (CSECT(PP).x_smclas) + /* We need to read the second auxillary entry for each + static function section named .text if compiled with + xlc -qfuncsect. If explicitly defined as a function, + reading the first auxillary entry suffices. GCC produces + only one auxillary entry for every .text section.*/ + + if ((cs->c_naux == 2) && !ISFCN (cs->c_type)) + { + raw_auxptr += coff_data (abfd)->local_auxesz; + aux_entry = 1; + } /* Convert the auxent to something we can access. */ - bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass, - 0, cs->c_naux, &main_aux); + + bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass, + aux_entry, cs->c_naux, &main_aux); + + if (ISFCN (cs->c_type)) + goto function_entry_point; switch (CSECT_SMTYP (&main_aux)) { @@ -1197,8 +1214,23 @@ approach does not work! GCC (and I think xlc) seem to put all the code in the unnamed program csect. */ + /* If a debugee is compiled with GCC using the option + --ffunction-sections or with xlc -qfuncsect, + every function in the source file is assigned a + seperate ".text" section. This results in completion + of the symtabs with default filename "_start_" + instead of pst->filename. if so, explicitly assign + the filename and start the symbol table again. */ + + if (!strcmp (filestring, " _start_ ")) + { + filestring = pst -> filename; + goto complete_symbol_table; + } + if (last_csect_name) { + complete_symbol_table: complete_symtab (filestring, file_start_addr); cur_src_end_addr = file_end_addr; end_symtab (file_end_addr, objfile,