This commit was generated by cvs2svn to track changes on a CVS vendor
[binutils-gdb.git] / gdb / osfsolib.c
index 753960852039bb033e70cc9c8bf2978c5c86f3cf..34b809d8717e595881375f94603125d88225f36d 100644 (file)
@@ -36,7 +36,7 @@
 #include "command.h"
 #include "target.h"
 #include "frame.h"
-#include "gnu-regex.h"
+#include "gdb_regex.h"
 #include "inferior.h"
 #include "language.h"
 #include "gdbcmd.h"
@@ -113,7 +113,7 @@ static ldr_process_t fake_ldr_process;
 
 /* Called by ldr_* routines to read memory from the current target.  */
 
-static int ldr_read_memory PARAMS ((CORE_ADDR, char *, int, int));
+static int ldr_read_memory (CORE_ADDR, char *, int, int);
 
 static int
 ldr_read_memory (memaddr, myaddr, len, readstring)
@@ -173,34 +173,25 @@ struct so_list
 
 static struct so_list *so_list_head;   /* List of known shared objects */
 
-extern int
-fdmatch PARAMS ((int, int));   /* In libiberty */
+extern int fdmatch (int, int); /* In libiberty */
 
 /* Local function prototypes */
 
-static void
-sharedlibrary_command PARAMS ((char *, int));
+static void sharedlibrary_command (char *, int);
 
-static void
-info_sharedlibrary_command PARAMS ((char *, int));
+static void info_sharedlibrary_command (char *, int);
 
-static int
-symbol_add_stub PARAMS ((char *));
+static int symbol_add_stub (char *);
 
-static struct so_list *
-  find_solib PARAMS ((struct so_list *));
+static struct so_list *find_solib (struct so_list *);
 
-static struct link_map *
-  first_link_map_member PARAMS ((void));
+static struct link_map *first_link_map_member (void);
 
-static struct link_map *
-  next_link_map_member PARAMS ((struct so_list *));
+static struct link_map *next_link_map_member (struct so_list *);
 
-static void
-xfer_link_map_member PARAMS ((struct so_list *, struct link_map *));
+static void xfer_link_map_member (struct so_list *, struct link_map *);
 
-static int
-solib_map_sections PARAMS ((char *));
+static int solib_map_sections (char *);
 
 /*
 
@@ -578,7 +569,9 @@ symbol_add_stub (arg)
 {
   register struct so_list *so = (struct so_list *) arg;                /* catch_errs bogon */
   CORE_ADDR text_addr = 0;
+  struct section_addr_info section_addrs;
 
+  memset (&section_addrs, 0, sizeof (section_addrs));
   if (so->textsection)
     text_addr = so->textsection->addr;
   else if (so->abfd != NULL)
@@ -591,14 +584,15 @@ symbol_add_stub (arg)
       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);
+                              (PTR) &lowest_sect);
       if (lowest_sect)
        text_addr = bfd_section_vma (so->abfd, lowest_sect) + LM_OFFSET (so);
     }
 
+  section_addrs.other[0].addr = text_addr;
+  section_addrs.other[0].name = ".text";
   so->objfile = symbol_file_add (so->so_name, so->from_tty,
-                                text_addr,
-                                0, 0, 0, 0, 1);
+                                &section_addrs, 0, OBJF_SHARED);
   return (1);
 }
 
@@ -655,38 +649,10 @@ solib_add (arg_string, from_tty, target)
 
       if (count)
        {
-         int update_coreops;
-
-         /* 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;
-
-         /* Reallocate the target's section table including the new size.  */
-         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)) * (count + old));
-           }
-         else
-           {
-             old = 0;
-             target->to_sections = (struct section_table *)
-               xmalloc ((sizeof (struct section_table)) * count);
-           }
-         target->to_sections_end = target->to_sections + (count + old);
-
-         /* Update the to_sections field in the core_ops structure
-            if needed.  */
-         if (update_coreops)
-           {
-             core_ops.to_sections = target->to_sections;
-             core_ops.to_sections_end = target->to_sections_end;
-           }
-
          /* Add these section table entries to the target's table.  */
+
+         old = target_resize_to_sections (target, count);
+         
          while ((so = find_solib (so)) != NULL)
            {
              if (so->so_name[0])
@@ -758,7 +724,7 @@ info_sharedlibrary_command (ignore, from_tty)
 
   if (exec_bfd == NULL)
     {
-      printf_unfiltered ("No exec file.\n");
+      printf_unfiltered ("No executable file.\n");
       return;
     }
   while ((so = find_solib (so)) != NULL)