* gdb.java/configure.in (AC_INIT): Use jmisc.exp.
[deliverable/binutils-gdb.git] / gdb / pa64solib.c
index b0b4645d29f01004ec525db9f43c9780301eecab..88ff67e941e1047ddf5fa92fe6296d4c5de2dbfd 100644 (file)
 /* Defined in exec.c; used to prevent dangling pointer bug.  */
 extern struct target_ops exec_ops;
 
-static CORE_ADDR
-  bfd_lookup_symbol PARAMS ((bfd *, char *));
+static CORE_ADDR bfd_lookup_symbol (bfd *, char *);
 /* This lives in hppa-tdep.c. */
-extern struct unwind_table_entry *find_unwind_entry PARAMS ((CORE_ADDR pc));
+extern struct unwind_table_entry *find_unwind_entry (CORE_ADDR pc);
 
 /* These ought to be defined in some public interface, but aren't.  They
    identify dynamic linker events.  */
@@ -121,18 +120,18 @@ dld_cache_t;
 
 static dld_cache_t dld_cache;
 
-static void pa64_sharedlibrary_info_command PARAMS ((char *, int));
+static void pa64_sharedlibrary_info_command (char *, int);
 
-static void pa64_solib_sharedlibrary_command PARAMS ((char *, int));
+static void pa64_solib_sharedlibrary_command (char *, int);
 
-static void * pa64_target_read_memory PARAMS ((void *, CORE_ADDR, size_t, int));
+static void *pa64_target_read_memory (void *, CORE_ADDR, size_t, int);
 
-static boolean read_dld_descriptor PARAMS ((struct target_ops *));
+static boolean read_dld_descriptor (struct target_ops *);
 
-static boolean read_dynamic_info PARAMS ((asection *, dld_cache_t *));
+static boolean read_dynamic_info (asection *, dld_cache_t *);
 
-static void add_to_solist PARAMS ((boolean, char *, struct load_module_desc *,
-                                  CORE_ADDR, struct target_ops *));
+static void add_to_solist (boolean, char *, struct load_module_desc *,
+                          CORE_ADDR, struct target_ops *);
 
 /* When examining the shared library for debugging information we have to
    look for HP debug symbols, stabs and dwarf2 debug symbols.  */
@@ -226,7 +225,9 @@ pa64_solib_add_solib_objfile (so, name, from_tty, text_addr)
   bfd *tmp_bfd;
   asection *sec;
   obj_private_data_t *obj_private;
+  struct section_addr_info section_addrs;
 
+  memset (&section_addrs, 0, sizeof (section_addrs));
   /* We need the BFD so that we can look at its sections.  We open up the
      file temporarily, then close it when we are done.  */
   tmp_bfd = bfd_openr (name, gnutarget);
@@ -270,7 +271,9 @@ pa64_solib_add_solib_objfile (so, name, from_tty, text_addr)
   tmp_bfd = NULL;
 
   /* Now let the generic code load up symbols for this library.  */
-  so->objfile = symbol_file_add (name, from_tty, text_addr, 0, 0, 0, 0, 1);
+  section_addrs.other[0].addr = text_addr;
+  section_addrs.other[0].name = ".text";
+  so->objfile = symbol_file_add (name, from_tty, &section_addrs, 0, OBJF_SHARED);
   so->abfd = so->objfile->obfd;
 
   /* Mark this as a shared library and save private data.  */
@@ -324,9 +327,9 @@ pa64_solib_load_symbols (so, name, from_tty, text_addr, target)
       return;
     }
 
-  ANOFFSET (so->objfile->section_offsets, SECT_OFF_TEXT)
+  ANOFFSET (so->objfile->section_offsets, SECT_OFF_TEXT (so->objfile))
     = so->pa64_solib_desc.text_base;
-  ANOFFSET (so->objfile->section_offsets, SECT_OFF_DATA)
+  ANOFFSET (so->objfile->section_offsets, SECT_OFF_DATA (so->objfile))
     = so->pa64_solib_desc.data_base;
 
   /* Relocate all the sections based on where they got loaded.  */
@@ -334,13 +337,13 @@ pa64_solib_load_symbols (so, name, from_tty, text_addr, target)
     {
       if (p->the_bfd_section->flags & SEC_CODE)
        {
-         p->addr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_TEXT);
-         p->endaddr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_TEXT);
+         p->addr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_TEXT (so->objfile));
+         p->endaddr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_TEXT (so->objfile));
        }
       else if (p->the_bfd_section->flags & SEC_DATA)
        {
-         p->addr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_DATA);
-         p->endaddr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_DATA);
+         p->addr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_DATA (so->objfile));
+         p->endaddr += ANOFFSET (so->objfile->section_offsets, SECT_OFF_DATA (so->objfile));
        }
     }
 
@@ -357,49 +360,12 @@ pa64_solib_load_symbols (so, name, from_tty, text_addr, target)
   status = target_read_memory (text_addr, buf, 4);
   if (status != 0)
     {
-      int old, new;
-      int update_coreops;
-      int update_execops;
-
-      /* We must update the to_sections field in the core_ops structure
-        here, otherwise we dereference a potential dangling pointer
-        for each call to target_read/write_memory within this routine.  */
-      update_coreops = core_ops.to_sections == target->to_sections;
-
-      /* Ditto exec_ops (this was a bug).  */
-      update_execops = exec_ops.to_sections == target->to_sections;
-
+      int new, old;
+      
       new = so->sections_end - so->sections;
-      /* Add sections from the shared library to the core target.  */
-      if (target->to_sections)
-       {
-         old = target->to_sections_end - target->to_sections;
-         target->to_sections = (struct section_table *)
-           xrealloc ((char *) target->to_sections,
-                     ((sizeof (struct section_table)) * (old + new)));
-       }
-      else
-       {
-         old = 0;
-         target->to_sections = (struct section_table *)
-           xmalloc ((sizeof (struct section_table)) * new);
-       }
-      target->to_sections_end = (target->to_sections + old + new);
-
-      /* Update the to_sections field in the core_ops structure
-        if needed, ditto exec_ops.  */
-      if (update_coreops)
-       {
-         core_ops.to_sections = target->to_sections;
-         core_ops.to_sections_end = target->to_sections_end;
-       }
-
-      if (update_execops)
-       {
-         exec_ops.to_sections = target->to_sections;
-         exec_ops.to_sections_end = target->to_sections_end;
-       }
 
+      old = target_resize_to_sections (target, new);
+      
       /* Copy over the old data before it gets clobbered.  */
       memcpy ((char *) (target->to_sections + old),
              so->sections,
@@ -828,7 +794,7 @@ pa64_sharedlibrary_info_command (ignore, from_tty)
 
   if (exec_bfd == NULL)
     {
-      printf_unfiltered ("no exec file.\n");
+      printf_unfiltered ("No executable file.\n");
       return;
     }
 
This page took 0.026731 seconds and 4 git commands to generate.