2000-07-03 Christopher Faylor <cgf@cygnus.com>
[deliverable/binutils-gdb.git] / gdb / irix5-nat.c
index 35445f7bf1d72241567768d440b89a84ef7b8e7c..ea37b8c23b47132f8fdb958b22d395c68ec52430 100644 (file)
 #include <sys/procfs.h>
 #include <setjmp.h>            /* For JB_XXX.  */
 
-static void
-fetch_core_registers PARAMS ((char *, unsigned int, int, CORE_ADDR));
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
+static void fetch_core_registers (char *, unsigned int, int, CORE_ADDR);
 
 /* Size of elements in jmpbuf */
 
@@ -278,7 +280,7 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
 #include "objfiles.h"
 #include "command.h"
 #include "frame.h"
-#include "gnu-regex.h"
+#include "gdb_regex.h"
 #include "inferior.h"
 #include "language.h"
 #include "gdbcmd.h"
@@ -342,38 +344,27 @@ static CORE_ADDR breakpoint_addr; /* Address where end bkpt is set */
 
 /* Local function prototypes */
 
-static void
-sharedlibrary_command PARAMS ((char *, int));
+static void sharedlibrary_command (char *, int);
 
-static int
-enable_break PARAMS ((void));
+static int enable_break (void);
 
-static int
-disable_break PARAMS ((void));
+static int disable_break (void);
 
-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 (void *);
 
-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 CORE_ADDR
-  locate_base PARAMS ((void));
+static CORE_ADDR locate_base (void);
 
-static int
-solib_map_sections PARAMS ((char *));
+static int solib_map_sections (void *);
 
 /*
 
@@ -403,8 +394,7 @@ solib_map_sections PARAMS ((char *));
  */
 
 static int
-solib_map_sections (arg)
-     char *arg;
+solib_map_sections (void *arg)
 {
   struct so_list *so = (struct so_list *) arg; /* catch_errors bogon */
   char *filename;
@@ -469,6 +459,7 @@ solib_map_sections (arg)
   /* Free the file names, close the file now.  */
   do_cleanups (old_chain);
 
+  /* must be non-zero */
   return (1);
 }
 
@@ -573,12 +564,13 @@ first_link_map_member ()
     return NULL;
 
   /* Get first list entry.  */
-  lladdr = (CORE_ADDR) listp;
+  /* The MIPS Sign extends addresses. */
+  lladdr = host_pointer_to_address (listp);
   read_memory (lladdr, (char *) &list_old, sizeof (struct obj_list));
 
   /* The first entry in the list is the object file we are debugging,
      so skip it.  */
-  next_lladdr = (CORE_ADDR) list_old.next;
+  next_lladdr = host_pointer_to_address (list_old.next);
 
 #ifdef HANDLE_NEW_OBJ_LIST
   if (list_old.data == NEW_OBJ_INFO_MAGIC)
@@ -638,7 +630,7 @@ next_link_map_member (so_list_ptr)
          status = target_read_memory (lm->l_lladdr,
                                       (char *) &list_old,
                                       sizeof (struct obj_list));
-         next_lladdr = (CORE_ADDR) list_old.next;
+         next_lladdr = host_pointer_to_address (list_old.next);
        }
 #ifdef HANDLE_NEW_OBJ_LIST
       else if (lm->l_variant == OBJ_LIST_32)
@@ -691,7 +683,7 @@ xfer_link_map_member (so_list_ptr, lm)
 
   new_lm->l_variant = OBJ_LIST_OLD;
   new_lm->l_lladdr = lladdr;
-  new_lm->l_next = (CORE_ADDR) list_old.next;
+  new_lm->l_next = host_pointer_to_address (list_old.next);
 
 #ifdef HANDLE_NEW_OBJ_LIST
   if (list_old.data == NEW_OBJ_INFO_MAGIC)
@@ -827,12 +819,13 @@ find_solib (so_list_ptr)
 /* A small stub to get us past the arg-passing pinhole of catch_errors.  */
 
 static int
-symbol_add_stub (arg)
-     char *arg;
+symbol_add_stub (void *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)
@@ -845,14 +838,17 @@ 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].name = ".text";
+  section_addrs.other[0].addr = text_addr;
   so->objfile = symbol_file_add (so->so_name, so->from_tty,
-                                text_addr,
-                                0, 0, 0, 0, 0);
+                                &section_addrs, 0, 0);
+  /* must be non-zero */
   return (1);
 }
 
@@ -908,37 +904,8 @@ 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;
-           }
-
+         old = target_resize_to_sections (target, count);
+         
          /* Add these section table entries to the target's table.  */
          while ((so = find_solib (so)) != NULL)
            {
@@ -1010,7 +977,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)
@@ -1343,9 +1310,11 @@ must be loaded manually, using `sharedlibrary'.",
 
 static struct core_fns irix5_core_fns =
 {
-  bfd_target_unknown_flavour,
-  fetch_core_registers,
-  NULL
+  bfd_target_unknown_flavour,          /* core_flavour */
+  default_check_format,                        /* check_format */
+  default_core_sniffer,                        /* core_sniffer */
+  fetch_core_registers,                        /* core_read_registers */
+  NULL                                 /* next */
 };
 
 void
This page took 0.0258 seconds and 4 git commands to generate.