Add support for FreeBSD/i386 ELF.
[deliverable/binutils-gdb.git] / gdb / somread.c
index 489a33095aba5393346cd7c0c72f882308d76828..b1370abffa0a386c693107f4a61e5ca483e31fc0 100644 (file)
@@ -366,7 +366,7 @@ som_symfile_read (objfile, mainline)
   do_pxdb (symfile_bfd_open (objfile->name));
 
   init_minimal_symbol_collection ();
-  back_to = make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
+  back_to = make_cleanup_discard_minimal_symbols ();
 
   /* Read in the import list and the export list.  Currently
      the export list isn't used; the import list is used in
@@ -465,17 +465,37 @@ som_symfile_offsets (objfile, addrs)
      struct section_addr_info *addrs;
 {
   int i;
+  CORE_ADDR text_addr;
 
   objfile->num_sections = SECT_OFF_MAX;
   objfile->section_offsets = (struct section_offsets *)
     obstack_alloc (&objfile->psymbol_obstack, SIZEOF_SECTION_OFFSETS);
 
+  /* FIXME: ezannoni 2000-04-20 The section names in SOM are not
+     .text, .data, etc, but $TEXT$, $DATA$,... We should initialize
+     SET_OFF_* from bfd. (See default_symfile_offsets()). But I don't
+     know the correspondence between SOM sections and GDB's idea of
+     section names. So for now we default to what is was before these
+     changes.*/
+  objfile->sect_index_text = 0;
+  objfile->sect_index_data = 1;
+  objfile->sect_index_bss = 2;
+  objfile->sect_index_rodata = 3;
+
   /* First see if we're a shared library.  If so, get the section
      offsets from the library, else get them from addrs.  */
   if (!som_solib_section_offsets (objfile, objfile->section_offsets))
     {
+      /* Note: Here is OK to compare with ".text" because this is the
+         name that gdb itself gives to that section, not the SOM
+         name. */
+      for (i = 0; i < SECT_OFF_MAX && addrs->other[i].name; i++)
+       if (strcmp (addrs->other[i].name, ".text") == 0)
+         break;
+      text_addr = addrs->other[i].addr;
+
       for (i = 0; i < SECT_OFF_MAX; i++)
-       ANOFFSET (objfile->section_offsets, i) = addrs -> text_addr;
+       ANOFFSET (objfile->section_offsets, i) = text_addr;
     }
 }
 
This page took 0.02382 seconds and 4 git commands to generate.