aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile.c
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2010-02-03 14:13:16 +0000
committerTristan Gingold <gingold@adacore.com>2010-02-03 14:13:16 +0000
commitac8035ab9e1b8839f04ede4ff7f96e9c86c896cb (patch)
treea5110cf99082f1ba824bacf96099dffc478bd9e5 /gdb/symfile.c
parentbe52b7566d327cea0584ccded6271dd1e1439dd1 (diff)
downloadgdb-ac8035ab9e1b8839f04ede4ff7f96e9c86c896cb.zip
gdb-ac8035ab9e1b8839f04ede4ff7f96e9c86c896cb.tar.gz
gdb-ac8035ab9e1b8839f04ede4ff7f96e9c86c896cb.tar.bz2
2010-02-03 Tristan Gingold <gingold@adacore.com>
* symfile.h (struct sym_fns): Add sym_relocate field. (default_symfile_relocate): New prototype. (symfile_relocate_debug_section): First argument is now an objfile. * symfile.c (default_symfile_relocate): Rename from symfile_relocate_debug_section, first argument is now an objfile. (symfile_relocate_debug_section): New function. * coffread.c (coff_sym_fns): Set sym_relocate field. * somread.c (som_sym_fns): Ditto. * mipsread.c (ecoff_sym_fns): Ditto. * machoread.c (macho_sym_fns): Ditto. * elfread.c (elf_sym_fns): Ditto. * dwarf2read.c (dwarf2_read_section): Ditto. * xcoffread.c (xcoff_sym_fns): Ditto. * dbxread.c (aout_sym_fns): Ditto. (dbx_psymtab_to_symtab): Adjust call to symfile_relocate_debug_section. (elfstab_build_psymtabs): Ditto.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r--gdb/symfile.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c
index bc52406..efa341d 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -3627,6 +3627,27 @@ symfile_dummy_outputs (bfd *abfd, asection *sectp, void *dummy)
sectp->output_offset = 0;
}
+/* Default implementation for sym_relocate. */
+
+
+bfd_byte *
+default_symfile_relocate (struct objfile *objfile, asection *sectp,
+ bfd_byte *buf)
+{
+ bfd *abfd = objfile->obfd;
+
+ /* We're only interested in sections with relocation
+ information. */
+ if ((sectp->flags & SEC_RELOC) == 0)
+ return NULL;
+
+ /* We will handle section offsets properly elsewhere, so relocate as if
+ all sections begin at 0. */
+ bfd_map_over_sections (abfd, symfile_dummy_outputs, NULL);
+
+ return bfd_simple_get_relocated_section_contents (abfd, sectp, buf, NULL);
+}
+
/* Relocate the contents of a debug section SECTP in ABFD. The
contents are stored in BUF if it is non-NULL, or returned in a
malloc'd buffer otherwise.
@@ -3642,18 +3663,12 @@ symfile_dummy_outputs (bfd *abfd, asection *sectp, void *dummy)
debug section. */
bfd_byte *
-symfile_relocate_debug_section (bfd *abfd, asection *sectp, bfd_byte *buf)
+symfile_relocate_debug_section (struct objfile *objfile,
+ asection *sectp, bfd_byte *buf)
{
- /* We're only interested in sections with relocation
- information. */
- if ((sectp->flags & SEC_RELOC) == 0)
- return NULL;
-
- /* We will handle section offsets properly elsewhere, so relocate as if
- all sections begin at 0. */
- bfd_map_over_sections (abfd, symfile_dummy_outputs, NULL);
+ gdb_assert (objfile->sf->sym_relocate);
- return bfd_simple_get_relocated_section_contents (abfd, sectp, buf, NULL);
+ return (*objfile->sf->sym_relocate) (objfile, sectp, buf);
}
struct symfile_segment_data *