#include "symfile.h" /* For struct psymbol_allocation_list. */
#include "progspace.h"
#include "registry.h"
+#include "gdb_bfd.h"
struct bcache;
struct htab;
/* 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) \
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;
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.
? ((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) \