Index: minsyms.c =================================================================== RCS file: /cvs/src/src/gdb/minsyms.c,v retrieving revision 1.47 diff -u -p -r1.47 minsyms.c --- minsyms.c 17 Oct 2006 20:17:44 -0000 1.47 +++ minsyms.c 16 Nov 2006 23:16:22 -0000 @@ -679,6 +679,18 @@ prim_record_minimal_symbol_and_info (con SYMBOL_VALUE_ADDRESS (msymbol) = address; SYMBOL_SECTION (msymbol) = section; + if (bfd_section == NULL) + { + struct obj_section *osec; + ALL_OBJFILE_OSECTIONS (objfile, osec) + { + if (osec->the_bfd_section->index == section) + { + bfd_section = osec->the_bfd_section; + break; + } + } + } SYMBOL_BFD_SECTION (msymbol) = bfd_section; MSYMBOL_TYPE (msymbol) = ms_type; Index: coffread.c =================================================================== RCS file: /cvs/src/src/gdb/coffread.c,v retrieving revision 1.63 diff -u -p -r1.63 coffread.c --- coffread.c 17 Dec 2005 22:33:59 -0000 1.63 +++ coffread.c 16 Nov 2006 23:16:25 -0000 @@ -699,6 +699,9 @@ coff_symtab_read (long symtab_offset, un long fcn_line_ptr = 0; int val; CORE_ADDR tmpaddr; + /* Avoid unnecessary lookups. */ + int cached_sec = -1; + struct bfd_section* cached_bfd_section = NULL; /* Work around a stdio bug in SunOS4.1.1 (this makes me nervous.... it's hard to know I've really worked around it. The fix should be @@ -926,9 +929,22 @@ coff_symtab_read (long symtab_offset, un if (cs->c_name[0] != '@' /* Skip tdesc symbols */ ) { struct minimal_symbol *msym; + if (cached_sec != sec) + { + struct obj_section *osec; + cached_sec = sec; + ALL_OBJFILE_OSECTIONS (objfile, osec) + { + if (osec->the_bfd_section->index == sec) + { + cached_bfd_section = osec->the_bfd_section; + break; + } + } + } msym = prim_record_minimal_symbol_and_info (cs->c_name, tmpaddr, ms_type, NULL, - sec, NULL, objfile); + sec, cached_bfd_section, objfile); if (msym) COFF_MAKE_MSYMBOL_SPECIAL (cs->c_sclass, msym); }