Index: objfiles.c =================================================================== RCS file: /cvs/src/src/gdb/objfiles.c,v retrieving revision 1.92 diff -u -p -u -r1.92 objfiles.c --- objfiles.c 17 Aug 2009 11:16:13 -0000 1.92 +++ objfiles.c 20 Aug 2009 20:37:22 -0000 @@ -823,6 +823,24 @@ preferred_obj_section (struct obj_sectio return b; } +/* Return 1 if SECTION should be inserted into the section map. + We want to insert only non-overlay and non-TLS section. */ + +static int +insert_section_p (const struct bfd *abfd, + const struct bfd_section *section) +{ + const bfd_vma lma = bfd_section_lma (abfd, section); + + if (lma != 0 && lma != bfd_section_vma (abfd, section)) + /* This is an overlay section. */ + return 0; + if ((bfd_get_section_flags (abfd, section) & SEC_THREAD_LOCAL) != 0) + return 0; + + return 1; +} + /* Update PMAP, PMAP_SIZE with non-TLS sections from all objfiles. */ static void @@ -837,24 +855,18 @@ update_section_map (struct obj_section * map = *pmap; xfree (map); -#define insert_p(objf, sec) \ - ((bfd_get_section_flags ((objf)->obfd, (sec)->the_bfd_section) \ - & SEC_THREAD_LOCAL) == 0) - map_size = 0; ALL_OBJSECTIONS (objfile, s) - if (insert_p (objfile, s)) + if (insert_section_p (objfile->obfd, s->the_bfd_section)) map_size += 1; map = xmalloc (map_size * sizeof (*map)); i = 0; ALL_OBJSECTIONS (objfile, s) - if (insert_p (objfile, s)) + if (insert_section_p (objfile->obfd, s->the_bfd_section)) map[i++] = s; -#undef insert_p - qsort (map, map_size, sizeof (*map), qsort_cmp); /* With separate debuginfo files, we may have up to two (almost)