aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib-som.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-04-08 20:08:21 +0000
committerTom Tromey <tromey@redhat.com>2013-04-08 20:08:21 +0000
commit36192a8d549d934534b43e9be4948d90daa6981c (patch)
tree32fa671aec7b68e82241ed3dc6fec5f40e0da403 /gdb/solib-som.c
parent65cf3563597713173bb688287a21666ec66e722d (diff)
downloadgdb-36192a8d549d934534b43e9be4948d90daa6981c.zip
gdb-36192a8d549d934534b43e9be4948d90daa6981c.tar.gz
gdb-36192a8d549d934534b43e9be4948d90daa6981c.tar.bz2
PR symtab/8423:
* solib-som.c (som_solib_section_offsets): Use BFD section indices. Set offsets for all sections. * somread.c (som_symtab_read): Compute BFD section for symbol. Use prim_record_minimal_symbol_and_info. (som_symfile_read): Fix comment. (struct find_section_offset_arg): New. (find_section_offset, set_section_index): New functions. (som_symfile_offsets): Use set_section_index to compute section indices. bfd/ * som.c (bfd_section_from_som_symbol): No longer static. * som.h (bfd_section_from_som_symbol): Declare.
Diffstat (limited to 'gdb/solib-som.c')
-rw-r--r--gdb/solib-som.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/gdb/solib-som.c b/gdb/solib-som.c
index ff7fbaa..650e3df 100644
--- a/gdb/solib-som.c
+++ b/gdb/solib-som.c
@@ -840,13 +840,12 @@ som_solib_section_offsets (struct objfile *objfile,
if (strstr (objfile->name, so_list->so_name))
{
asection *private_section;
+ struct obj_section *sect;
/* The text offset is easy. */
offsets->offsets[SECT_OFF_TEXT (objfile)]
= (so_list->lm_info->text_addr
- so_list->lm_info->text_link_addr);
- offsets->offsets[SECT_OFF_RODATA (objfile)]
- = ANOFFSET (offsets, SECT_OFF_TEXT (objfile));
/* We should look at presumed_dp in the SOM header, but
that's not easily available. This should be OK though. */
@@ -859,10 +858,28 @@ som_solib_section_offsets (struct objfile *objfile,
offsets->offsets[SECT_OFF_BSS (objfile)] = 0;
return 1;
}
- offsets->offsets[SECT_OFF_DATA (objfile)]
- = (so_list->lm_info->data_start - private_section->vma);
- offsets->offsets[SECT_OFF_BSS (objfile)]
- = ANOFFSET (offsets, SECT_OFF_DATA (objfile));
+ if (objfile->sect_index_data != -1)
+ {
+ offsets->offsets[SECT_OFF_DATA (objfile)]
+ = (so_list->lm_info->data_start - private_section->vma);
+ if (objfile->sect_index_bss != -1)
+ offsets->offsets[SECT_OFF_BSS (objfile)]
+ = ANOFFSET (offsets, SECT_OFF_DATA (objfile));
+ }
+
+ ALL_OBJFILE_OSECTIONS (objfile, sect)
+ {
+ flagword flags = bfd_get_section_flags (objfile->obfd,
+ sect->the_bfd_section);
+
+ if ((flags & SEC_CODE) != 0)
+ offsets->offsets[sect->the_bfd_section->index]
+ = offsets->offsets[SECT_OFF_TEXT (objfile)];
+ else
+ offsets->offsets[sect->the_bfd_section->index]
+ = offsets->offsets[SECT_OFF_DATA (objfile)];
+ }
+
return 1;
}
so_list = so_list->next;