* Makefile.in (ALLDEPFILES): Remove alphanbsd-nat.c.
[deliverable/binutils-gdb.git] / gdb / irix5-nat.c
index b8ca2a523d9296df2ee51bed06e5480dc98f5381..459abe3879c8cd35912aab67734c74d80d3c7eba 100644 (file)
@@ -1,6 +1,6 @@
 /* Native support for the SGI Iris running IRIX version 5, for GDB.
-   Copyright 1988, 89, 90, 91, 92, 93, 94, 95, 96, 98, 1999
-   Free Software Foundation, Inc.
+   Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998,
+   1999, 2000, 2001 Free Software Foundation, Inc.
    Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU
    and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin.
    Implemented for Irix 4.x by Garrett A. Wollman.
@@ -27,6 +27,7 @@
 #include "inferior.h"
 #include "gdbcore.h"
 #include "target.h"
+#include "regcache.h"
 
 #include "gdb_string.h"
 #include <sys/time.h>
@@ -180,12 +181,22 @@ get_longjmp_target (CORE_ADDR *pc)
   return 1;
 }
 
+/* Provide registers to GDB from a core file.
+
+   CORE_REG_SECT points to an array of bytes, which were obtained from
+   a core file which BFD thinks might contain register contents. 
+   CORE_REG_SIZE is its size.
+
+   Normally, WHICH says which register set corelow suspects this is:
+     0 --- the general-purpose register set
+     2 --- the floating-point register set
+   However, for Irix 5, WHICH isn't used.
+
+   REG_ADDR is also unused.  */
+
 static void
-fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
-     char *core_reg_sect;
-     unsigned core_reg_size;
-     int which;                        /* Unused */
-     CORE_ADDR reg_addr;       /* Unused */
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
+                     int which, CORE_ADDR reg_addr)
 {
   if (core_reg_size == REGISTER_BYTES)
     {
@@ -399,7 +410,7 @@ solib_map_sections (void *arg)
   bfd *abfd;
 
   filename = tilde_expand (so->so_name);
-  old_chain = make_cleanup (free, filename);
+  old_chain = make_cleanup (xfree, filename);
 
   scratch_chan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0,
                        &scratch_pathname);
@@ -423,7 +434,7 @@ solib_map_sections (void *arg)
     }
   /* Leave bfd open, core_xfer_memory and "info files" need it.  */
   so->abfd = abfd;
-  abfd->cacheable = true;
+  abfd->cacheable = 1;
 
   if (!bfd_check_format (abfd, bfd_object))
     {
@@ -764,8 +775,7 @@ xfer_link_map_member (struct so_list *so_list_ptr, struct link_map *lm)
  */
 
 static struct so_list *
-find_solib (so_list_ptr)
-     struct so_list *so_list_ptr;      /* Last lm or NULL for first one */
+find_solib (struct so_list *so_list_ptr)
 {
   struct so_list *so_list_next = NULL;
   struct link_map *lm = NULL;
@@ -852,14 +862,14 @@ symbol_add_stub (void *arg)
    SYNOPSIS
 
    void solib_add (char *arg_string, int from_tty,
-   struct target_ops *target)
+   struct target_ops *target, int readsyms)
 
    DESCRIPTION
 
  */
 
 void
-solib_add (char *arg_string, int from_tty, struct target_ops *target)
+solib_add (char *arg_string, int from_tty, struct target_ops *target, int readsyms)
 {
   register struct so_list *so = NULL;  /* link map state variable */
 
@@ -870,6 +880,9 @@ solib_add (char *arg_string, int from_tty, struct target_ops *target)
   int count;
   int old;
 
+  if (!readsyms)
+    return;
+
   if ((re_err = re_comp (arg_string ? arg_string : ".")) != NULL)
     {
       error ("Invalid regexp: %s", re_err);
@@ -1047,10 +1060,11 @@ clear_solib (void)
     {
       if (so_list_head->sections)
        {
-         free ((PTR) so_list_head->sections);
+         xfree (so_list_head->sections);
        }
       if (so_list_head->abfd)
        {
+         remove_target_sections (so_list_head->abfd);
          bfd_filename = bfd_get_filename (so_list_head->abfd);
          if (!bfd_close (so_list_head->abfd))
            warning ("cannot close \"%s\": %s",
@@ -1062,9 +1076,9 @@ clear_solib (void)
 
       next = so_list_head->next;
       if (bfd_filename)
-       free ((PTR) bfd_filename);
-      free (so_list_head->so_name);
-      free ((PTR) so_list_head);
+       xfree (bfd_filename);
+      xfree (so_list_head->so_name);
+      xfree (so_list_head);
       so_list_head = next;
     }
   debug_base = 0;
@@ -1214,7 +1228,7 @@ solib_create_inferior_hook (void)
   stop_signal = TARGET_SIGNAL_0;
   do
     {
-      target_resume (-1, 0, stop_signal);
+      target_resume (pid_to_ptid (-1), 0, stop_signal);
       wait_for_inferior ();
     }
   while (stop_signal != TARGET_SIGNAL_TRAP);
@@ -1241,8 +1255,7 @@ solib_create_inferior_hook (void)
      and will put out an annoying warning.
      Delaying the resetting of stop_soon_quietly until after symbol loading
      suppresses the warning.  */
-  if (auto_solib_add)
-    solib_add ((char *) 0, 0, (struct target_ops *) 0);
+  solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
   stop_soon_quietly = 0;
 }
 
@@ -1264,7 +1277,7 @@ static void
 sharedlibrary_command (char *args, int from_tty)
 {
   dont_repeat ();
-  solib_add (args, from_tty, (struct target_ops *) 0);
+  solib_add (args, from_tty, (struct target_ops *) 0, 1);
 }
 
 void
@@ -1276,13 +1289,13 @@ _initialize_solib (void)
            "Status of loaded shared object libraries.");
 
   add_show_from_set
-    (add_set_cmd ("auto-solib-add", class_support, var_zinteger,
+    (add_set_cmd ("auto-solib-add", class_support, var_boolean,
                  (char *) &auto_solib_add,
                  "Set autoloading of shared library symbols.\n\
-If nonzero, symbols from all shared object libraries will be loaded\n\
-automatically when the inferior begins execution or when the dynamic linker\n\
-informs gdb that a new library has been loaded.  Otherwise, symbols\n\
-must be loaded manually, using `sharedlibrary'.",
+If \"on\", symbols from all shared object libraries will be loaded\n\
+automatically when the inferior begins execution, when the dynamic linker\n\
+informs gdb that a new library has been loaded, or when attaching to the\n\
+inferior.  Otherwise, symbols must be loaded manually, using `sharedlibrary'.",
                  &setlist),
      &showlist);
 }
This page took 0.043426 seconds and 4 git commands to generate.