2000-05-10 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>
Thu, 11 May 2000 00:36:17 +0000 (00:36 +0000)
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>
Thu, 11 May 2000 00:36:17 +0000 (00:36 +0000)
        * solib.c (symbol_add_stub): Remember the index and the name of
        the section with the lowest address. Use this data (instead of
        data from .text) to pass info into symbol_file_add.

        * elfread.c (record_minimal_symbol_and_info): Use the section
        where the symbol lives to get the index, instead of guessing.

gdb/ChangeLog
gdb/elfread.c
gdb/solib.c

index 8ad00244d6d46dc491d190a8d464ede427a59602..795486a4dd5a70fd56662fec0371c000a6bdcaee 100644 (file)
@@ -1,3 +1,12 @@
+2000-05-10  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+        * solib.c (symbol_add_stub): Remember the index and the name of
+        the section with the lowest address. Use this data (instead of
+        data from .text) to pass info into symbol_file_add.
+
+        * elfread.c (record_minimal_symbol_and_info): Use the section 
+       where the symbol lives to get the index, instead of guessing.
+
 2000-05-10  Michael Snyder  <msnyder@seadog.cygnus.com>
        Make Sparc a Multi-Arch target.  Discard PARAMS macro (require ANSI).
        * sparc-tdep.c: include arch-utils.h.
index 85b04ec7bbe5ec1df95f78cae9258ef2da961592..60f7988029b03ea3aa1c5494d9df21eb8998d3c8 100644 (file)
@@ -191,18 +191,16 @@ record_minimal_symbol_and_info (name, address, ms_type, info, bfd_section,
     {
     case mst_text:
     case mst_file_text:
-      section = SECT_OFF_TEXT (objfile);
+      section = bfd_section->index;
 #ifdef SMASH_TEXT_ADDRESS
       SMASH_TEXT_ADDRESS (address);
 #endif
       break;
     case mst_data:
     case mst_file_data:
-      section = SECT_OFF_DATA (objfile);
-      break;
     case mst_bss:
     case mst_file_bss:
-      section = SECT_OFF_BSS (objfile);
+      section = bfd_section->index;
       break;
     default:
       section = -1;
index be007b11d0427f1cdf7b5b37cd62f76b39cb2115..1094277d517dcaa63ddecf6d40b9e930997de12c 100644 (file)
@@ -1165,10 +1165,10 @@ symbol_add_stub (arg)
      PTR arg;
 {
   register struct so_list *so = (struct so_list *) arg;  /* catch_errs bogon */
-  CORE_ADDR text_addr = 0;
   struct section_addr_info *sap;
-  int i;
-  asection *text_section;
+  CORE_ADDR lowest_addr = 0;
+  int lowest_index;
+  asection *lowest_sect = NULL;
 
   /* Have we already loaded this shared object?  */
   ALL_OBJFILES (so->objfile)
@@ -1179,32 +1179,33 @@ symbol_add_stub (arg)
 
   /* Find the shared object's text segment.  */
   if (so->textsection)
-    text_addr = so->textsection->addr;
+    {
+      lowest_addr = so->textsection->addr;
+      lowest_sect = bfd_get_section_by_name (so->abfd, ".text");
+      lowest_index = lowest_sect->index;
+    }
   else if (so->abfd != NULL)
     {
-      asection *lowest_sect;
-
-      /* If we didn't find a mapped non zero sized .text section, set up
-         text_addr so that the relocation in symbol_file_add does no harm.  */
+      /* If we didn't find a mapped non zero sized .text section, set
+         up lowest_addr so that the relocation in symbol_file_add does
+         no harm.  */
       lowest_sect = bfd_get_section_by_name (so->abfd, ".text");
       if (lowest_sect == NULL)
        bfd_map_over_sections (so->abfd, find_lowest_section,
                               (PTR) &lowest_sect);
       if (lowest_sect)
-       text_addr = bfd_section_vma (so->abfd, lowest_sect)
-         + LM_ADDR (so);
+       {
+         lowest_addr = bfd_section_vma (so->abfd, lowest_sect)
+           + LM_ADDR (so);
+         lowest_index = lowest_sect->index;
+       }
     }
 
   sap = build_section_addr_info_from_section_table (so->sections,
                                                     so->sections_end);
 
-  /* Look for the index for the .text section in the sap structure. */
-  text_section = bfd_get_section_by_name (so->abfd, ".text");
-  for (i = 0; i < MAX_SECTIONS && sap->other[i].name; i++)
-    if (sap->other[i].sectindex == text_section->index)
-      break;
-  
-  sap->other[i].addr = text_addr;
+  sap->other[lowest_index].addr = lowest_addr;
+
   so->objfile = symbol_file_add (so->so_name, so->from_tty,
                                 sap, 0, OBJF_SHARED);
   free_section_addr_info (sap);
This page took 0.029372 seconds and 4 git commands to generate.