aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2008-08-20 11:21:44 +0000
committerPedro Alves <palves@redhat.com>2008-08-20 11:21:44 +0000
commitf1f6aadf8c572a21149a59d65adc49f2df5feeb6 (patch)
tree9b51311b5d16685c2c5201142c196a33a7c157b2 /gdb/objfiles.h
parent* Makefile.in: Remove page break; OpenBSD make chokes on them. (diff)
downloadbinutils-gdb-f1f6aadf8c572a21149a59d65adc49f2df5feeb6.tar.gz
binutils-gdb-f1f6aadf8c572a21149a59d65adc49f2df5feeb6.tar.bz2
binutils-gdb-f1f6aadf8c572a21149a59d65adc49f2df5feeb6.zip
* objfiles.h (struct obj_section): Remove addr and endaddr fields.
(obj_section_offset, obj_section_addr, obj_section_endaddr): New macros. * objfiles.c (add_to_objfile_sections): Don't set addr, endaddr and offset. Use size_t instead of unsigned long. (build_objfile_section_table): Use size_t instead of unsigned long. (objfile_relocate): Don't relocate s->addr and s->endaddr, they're gone. (find_pc_sect_section): Use obj_section_addr and obj_section_endaddr. * symfile.c (symfile.c): Remove code that maps sections offsets in "addr" to the object's sections. * blockframe.c (find_pc_partial_function): Use obj_section_endaddr. * gcore.c (gcore_create_callback): Use obj_section_addr and obj_section_endaddr. * maint.c (print_objfile_section_info): Likewise. * printcmd.c (sym_info): Use obj_section_addr and obj_section_endaddr. * symtab.c (fixup_section): Likewise.
Diffstat (limited to 'gdb/objfiles.h')
-rw-r--r--gdb/objfiles.h42
1 files changed, 17 insertions, 25 deletions
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 56a00f1b5a1..16fcb8d1256 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -110,34 +110,11 @@ struct entry_info
};
-/* Sections in an objfile.
-
- It is strange that we have both this notion of "sections"
- and the one used by section_offsets. Section as used
- here, (currently at least) means a BFD section, and the sections
- are set up from the BFD sections in allocate_objfile.
-
- The sections in section_offsets have their meaning determined by
- the symbol format, and they are set up by the sym_offsets function
- for that symbol file format.
-
- I'm not sure this could or should be changed, however. */
+/* Sections in an objfile. The section offsets are stored in the
+ OBJFILE. */
struct obj_section
{
- CORE_ADDR addr; /* lowest address in section */
- CORE_ADDR endaddr; /* 1+highest address in section */
-
- /* This field is being used for nefarious purposes by syms_from_objfile.
- It is said to be redundant with section_offsets; it's not really being
- used that way, however, it's some sort of hack I don't understand
- and am not going to try to eliminate (yet, anyway). FIXME.
-
- It was documented as "offset between (end)addr and actual memory
- addresses", but that's not true; addr & endaddr are actual memory
- addresses. */
- CORE_ADDR offset;
-
struct bfd_section *the_bfd_section; /* BFD section pointer */
/* Objfile this section is part of. */
@@ -147,6 +124,21 @@ struct obj_section
int ovly_mapped;
};
+/* Relocation offset applied to S. */
+#define obj_section_offset(s) \
+ (((s)->objfile->section_offsets)->offsets[(s)->the_bfd_section->index])
+
+/* The memory address of section S (vma + offset). */
+#define obj_section_addr(s) \
+ (bfd_get_section_vma ((s)->objfile->abfd, s->the_bfd_section) \
+ + obj_section_offset (s))
+
+/* The one-passed-the-end memory address of section S
+ (vma + size + offset). */
+#define obj_section_endaddr(s) \
+ (bfd_get_section_vma ((s)->objfile->abfd, s->the_bfd_section) \
+ + bfd_get_section_size ((s)->the_bfd_section) \
+ + obj_section_offset (s))
/* The "objstats" structure provides a place for gdb to record some
interesting information about its internal state at runtime, on a