summaryrefslogtreecommitdiff
path: root/gdb/solib-som.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-04-08 20:08:20 +0000
committerTom Tromey <tromey@redhat.com>2013-04-08 20:08:20 +0000
commite01d62fba5477f54d9006c2564ce56bc31b528f7 (patch)
tree9aded2ff8d736a05555ada8335457107a481fafb /gdb/solib-som.c
parente78df53764c2576f39a433ed9f16d270f11e1b05 (diff)
downloadgdb-e01d62fba5477f54d9006c2564ce56bc31b528f7.tar.gz
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 ff7fbaa1ffb..650e3dfead4 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;