summaryrefslogtreecommitdiff
path: root/gdb/objfiles.h
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-04-08 20:04:42 +0000
committerTom Tromey <tromey@redhat.com>2013-04-08 20:04:42 +0000
commit65cf3563597713173bb688287a21666ec66e722d (patch)
tree81c99cb31198d4095c8f7aad732cc2255683225f /gdb/objfiles.h
parent7cbd4a934e9cf3808e1199c62e65b4c25b24b4e5 (diff)
downloadbinutils-gdb-65cf3563597713173bb688287a21666ec66e722d.tar.gz
* coffread.c (cs_to_section): Use gdb_bfd_section_index.
* elfread.c (record_minimal_symbol, elf_symtab_read): Use gdb_bfd_section_index. * gdb_bfd.c (gdb_bfd_section_index, gdb_bfd_count_sections): New functions. * gdb_bfd.h (gdb_bfd_section_index, gdb_bfd_count_sections): Declare. * machoread.c (macho_symtab_add_minsym, macho_symfile_offsets): Update. * objfiles.c (add_to_objfile_sections_full): New function. (add_to_objfile_sections): Use it. (build_section_table): Rewrite. (objfile_relocate1): Use gdb_bfd_section_index. Update. * objfiles.h (obj_section_offset): Use gdb_bfd_section_index. (struct objfile) <sections>: Update comment. (ALL_OBJFILE_OSECTIONS): Skip sections where the_bfd_section is NULL. (ALL_OBJSECTIONS): Use it. * solib-dsbt.c (dsbt_relocate_main_executable): Update. * solib-frv.c (frv_relocate_main_executable): Update. * solib-target.c (solib_target_relocate_section_addresses): Use gdb_bfd_section_index. * symfile.c (build_section_addr_info_from_section_table): Use gdb_bfd_section_index. (build_section_addr_info_from_bfd, place_section): Likewise. * symtab.c (fixup_section): Update. * xcoffread.c (find_targ_sec): Use gdb_bfd_section_index.
Diffstat (limited to 'gdb/objfiles.h')
-rw-r--r--gdb/objfiles.h21
1 files changed, 13 insertions, 8 deletions
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 9646bbd3604..1fbb2558a23 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -24,6 +24,7 @@
#include "symfile.h" /* For struct psymbol_allocation_list. */
#include "progspace.h"
#include "registry.h"
+#include "gdb_bfd.h"
struct bcache;
struct htab;
@@ -123,7 +124,7 @@ struct obj_section
/* Relocation offset applied to S. */
#define obj_section_offset(s) \
- (((s)->objfile->section_offsets)->offsets[(s)->the_bfd_section->index])
+ (((s)->objfile->section_offsets)->offsets[gdb_bfd_section_index ((s)->objfile->obfd, (s)->the_bfd_section)])
/* The memory address of section S (vma + offset). */
#define obj_section_addr(s) \
@@ -349,9 +350,10 @@ struct objfile
among other things, is used to map pc addresses into sections.
SECTIONS points to the first entry in the table, and
SECTIONS_END points to the first location past the last entry
- in the table. The table is stored on the objfile_obstack.
- There is no particular order to the sections in this table, and it
- only contains sections we care about (e.g. non-empty, SEC_ALLOC). */
+ in the table. The table is stored on the objfile_obstack. The
+ sections are indexed by the BFD section index; but the
+ structure data is only valid for certain sections
+ (e.g. non-empty, SEC_ALLOC). */
struct obj_section *sections, *sections_end;
@@ -576,7 +578,12 @@ extern void default_iterate_over_objfiles_in_search_order
ALL_OBJFILE_MSYMBOLS (objfile, m)
#define ALL_OBJFILE_OSECTIONS(objfile, osect) \
- for (osect = objfile->sections; osect < objfile->sections_end; osect++)
+ for (osect = objfile->sections; osect < objfile->sections_end; osect++) \
+ if (osect->the_bfd_section == NULL) \
+ { \
+ /* Nothing. */ \
+ } \
+ else
/* Traverse all obj_sections in all objfiles in the current program
space.
@@ -612,9 +619,7 @@ extern void default_iterate_over_objfiles_in_search_order
? ((objfile) = (objfile)->next, \
(objfile) != NULL ? (osect) = (objfile)->sections_end : 0) \
: 0)) \
- for ((osect) = (objfile)->sections; \
- (osect) < (objfile)->sections_end; \
- (osect)++)
+ ALL_OBJFILE_OSECTIONS (objfile, osect)
#define SECT_OFF_DATA(objfile) \
((objfile->sect_index_data == -1) \