2006-07-21 Frederic Riss * dwarf2read.c (struct dwarf2_per_objfile): Add has_section_at_zero field. (dwarf2_has_info): Initialize dwarf2_per_objfile->has_section_at_zero. (dwarf2_get_pc_bounds): Use dwarf2_per_objfile->has_section_at_zero instead of HAS_RELOC test. (read_partial_die): Ditto. Index: dwarf2read.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2read.c,v retrieving revision 1.200 diff -u -p -r1.200 dwarf2read.c --- dwarf2read.c 12 Jul 2006 21:14:57 -0000 1.200 +++ dwarf2read.c 20 Jul 2006 16:24:42 -0000 @@ -180,6 +180,10 @@ struct dwarf2_per_objfile /* A chain of compilation units that are currently read in, so that they can be freed later. */ struct dwarf2_per_cu_data *read_in_chain; + + /* A flag indicating wether this objfile has a section loaded at a + VMA of 0. */ + int has_section_at_zero; }; static struct dwarf2_per_objfile *dwarf2_per_objfile; @@ -1083,6 +1087,7 @@ int dwarf2_has_info (struct objfile *objfile) { struct dwarf2_per_objfile *data; + asection *lower_sect = NULL; /* Initialize per-objfile state. */ data = obstack_alloc (&objfile->objfile_obstack, sizeof (*data)); @@ -1090,6 +1095,10 @@ dwarf2_has_info (struct objfile *objfile set_objfile_data (objfile, dwarf2_objfile_data_key, data); dwarf2_per_objfile = data; + bfd_map_over_sections (objfile->obfd, find_lowest_section, &lower_sect); + if (lower_sect && bfd_section_vma (objfile->obfd, lower_sect) == 0) + data->has_section_at_zero = 1; + dwarf_info_section = 0; dwarf_abbrev_section = 0; dwarf_line_section = 0; @@ -1099,7 +1108,7 @@ dwarf2_has_info (struct objfile *objfile dwarf_eh_frame_section = 0; dwarf_ranges_section = 0; dwarf_loc_section = 0; - + bfd_map_over_sections (objfile->obfd, dwarf2_locate_sections, NULL); return (dwarf_info_section != NULL && dwarf_abbrev_section != NULL); } @@ -3177,7 +3186,7 @@ dwarf2_get_pc_bounds (struct die_info *d labels are not in the output, so the relocs get a value of 0. If this is a discarded function, mark the pc bounds as invalid, so that GDB will ignore it. */ - if (low == 0 && (bfd_get_file_flags (obfd) & HAS_RELOC) == 0) + if (low == 0 && !dwarf2_per_objfile->has_section_at_zero) return 0; *lowpc = low; @@ -5505,7 +5514,7 @@ read_partial_die (struct partial_die_inf if (has_low_pc_attr && has_high_pc_attr && part_die->lowpc < part_die->highpc && (part_die->lowpc != 0 - || (bfd_get_file_flags (abfd) & HAS_RELOC))) + || dwarf2_per_objfile->has_section_at_zero)) part_die->has_pc_info = 1; return info_ptr; }