* gdb/defs.h: unconditionally include <fcntl.h>, and
[deliverable/binutils-gdb.git] / gdb / corelow.c
index 75f9419081b8da128d4be4e3f70f328ef5e7972c..226b48b50574b1ed62d4446130831e22e0abc64c 100644 (file)
@@ -1,8 +1,8 @@
 /* Core dump and executable file functions below target vector, for GDB.
 
-   Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
-   1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation,
-   Inc.
+   Copyright (C) 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
+   1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -18,8 +18,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
 
 #include "defs.h"
 #include "arch-utils.h"
 #include "symfile.h"
 #include "exec.h"
 #include "readline/readline.h"
-#include "observer.h"
 #include "gdb_assert.h"
 #include "exceptions.h"
+#include "solib.h"
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
 
 #ifndef O_LARGEFILE
 #define O_LARGEFILE 0
@@ -73,10 +70,6 @@ struct gdbarch *core_gdbarch = NULL;
 
 static void core_files_info (struct target_ops *);
 
-#ifdef SOLIB_ADD
-static int solib_add_stub (void *);
-#endif
-
 static struct core_fns *sniff_core_bfd (bfd *);
 
 static int gdb_check_format (bfd *);
@@ -212,6 +205,8 @@ core_close (int quitting)
          comments in clear_solib in solib.c. */
 #ifdef CLEAR_SOLIB
       CLEAR_SOLIB ();
+#else
+      clear_solib ();
 #endif
 
       name = bfd_get_filename (core_bfd);
@@ -237,19 +232,6 @@ core_close_cleanup (void *ignore)
   core_close (0/*ignored*/);
 }
 
-#ifdef SOLIB_ADD
-/* Stub function for catch_errors around shared library hacking.  FROM_TTYP
-   is really an int * which points to from_tty.  */
-
-static int
-solib_add_stub (void *from_ttyp)
-{
-  SOLIB_ADD (NULL, *(int *) from_ttyp, &current_target, auto_solib_add);
-  re_enable_breakpoints_in_shlibs ();
-  return 0;
-}
-#endif /* SOLIB_ADD */
-
 /* Look for sections whose names start with `.reg/' so that we can extract the
    list of threads in a core file.  */
 
@@ -299,7 +281,7 @@ core_open (char *filename, int from_tty)
   filename = tilde_expand (filename);
   if (filename[0] != '/')
     {
-      temp = concat (current_directory, "/", filename, NULL);
+      temp = concat (current_directory, "/", filename, (char *)NULL);
       xfree (filename);
       filename = temp;
     }
@@ -315,7 +297,9 @@ core_open (char *filename, int from_tty)
   if (scratch_chan < 0)
     perror_with_name (filename);
 
-  temp_bfd = bfd_fdopenr (filename, gnutarget, scratch_chan);
+  temp_bfd = bfd_fopen (filename, gnutarget, 
+                       write_files ? FOPEN_RUB : FOPEN_RB,
+                       scratch_chan);
   if (temp_bfd == NULL)
     perror_with_name (filename);
 
@@ -369,7 +353,7 @@ core_open (char *filename, int from_tty)
 
   /* This is done first, before anything has a chance to query the
      inferior for information such as symbols.  */
-  observer_notify_inferior_created (&core_ops, from_tty);
+  post_create_inferior (&core_ops, from_tty);
 
   p = bfd_core_file_failing_command (core_bfd);
   if (p)
@@ -395,12 +379,6 @@ core_open (char *filename, int from_tty)
       /* Fetch all registers from core file.  */
       target_fetch_registers (-1);
 
-      /* Add symbols and section mappings for any shared libraries.  */
-#ifdef SOLIB_ADD
-      catch_errors (solib_add_stub, &from_tty, (char *) 0,
-                   RETURN_MASK_ALL);
-#endif
-
       /* Now, set up the frame cache, and print the top of stack.  */
       flush_cached_frames ();
       select_frame (get_current_frame ());
@@ -534,8 +512,8 @@ core_files_info (struct target_ops *t)
 \f
 static LONGEST
 core_xfer_partial (struct target_ops *ops, enum target_object object,
-                  const char *annex, void *readbuf,
-                  const void *writebuf, ULONGEST offset, LONGEST len)
+                  const char *annex, gdb_byte *readbuf,
+                  const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
 {
   switch (object)
     {
This page took 0.025909 seconds and 4 git commands to generate.