daily update
[deliverable/binutils-gdb.git] / gdb / corelow.c
index 05c3e4ea0c6202320eac5e89167b75255c1230c1..ecd99f61cebee57a450b53a8888bffd21e2a59c5 100644 (file)
@@ -19,8 +19,6 @@
 
 #include "defs.h"
 #include "arch-utils.h"
-#include <string.h>
-#include <errno.h>
 #include <signal.h>
 #include <fcntl.h>
 #ifdef HAVE_SYS_FILE_H
@@ -28,6 +26,7 @@
 #endif
 #include "frame.h"             /* required by inferior.h */
 #include "inferior.h"
+#include "infrun.h"
 #include "symtab.h"
 #include "command.h"
 #include "bfd.h"
@@ -39,7 +38,6 @@
 #include "symfile.h"
 #include "exec.h"
 #include "readline/readline.h"
-#include "gdb_assert.h"
 #include "exceptions.h"
 #include "solib.h"
 #include "filenames.h"
@@ -83,8 +81,6 @@ static struct core_fns *sniff_core_bfd (bfd *);
 
 static int gdb_check_format (bfd *);
 
-static void core_open (char *, int);
-
 static void core_close (struct target_ops *self);
 
 static void core_close_cleanup (void *ignore);
@@ -274,7 +270,7 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
 /* This routine opens and sets up the core file bfd.  */
 
 static void
-core_open (char *filename, int from_tty)
+core_open (const char *arg, int from_tty)
 {
   const char *p;
   int siggy;
@@ -284,9 +280,10 @@ core_open (char *filename, int from_tty)
   int scratch_chan;
   int flags;
   volatile struct gdb_exception except;
+  char *filename;
 
   target_preopen (from_tty);
-  if (!filename)
+  if (!arg)
     {
       if (core_bfd)
        error (_("No core file specified.  (Use `detach' "
@@ -295,7 +292,7 @@ core_open (char *filename, int from_tty)
        error (_("No core file specified."));
     }
 
-  filename = tilde_expand (filename);
+  filename = tilde_expand (arg);
   if (!IS_ABSOLUTE_PATH (filename))
     {
       temp = concat (current_directory, "/",
@@ -737,7 +734,7 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
 
          size = bfd_section_size (core_bfd, section);
          if (offset >= size)
-           return 0;
+           return TARGET_XFER_EOF;
          size -= offset;
          if (size > len)
            size = len;
@@ -870,12 +867,10 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
       return TARGET_XFER_E_IO;
 
     default:
-      if (ops->beneath != NULL)
-       return ops->beneath->to_xfer_partial (ops->beneath, object,
-                                             annex, readbuf,
-                                             writebuf, offset, len,
-                                             xfered_len);
-      return TARGET_XFER_E_IO;
+      return ops->beneath->to_xfer_partial (ops->beneath, object,
+                                           annex, readbuf,
+                                           writebuf, offset, len,
+                                           xfered_len);
     }
 }
 
@@ -978,7 +973,8 @@ core_has_registers (struct target_ops *ops)
 /* Implement the to_info_proc method.  */
 
 static void
-core_info_proc (struct target_ops *ops, char *args, enum info_proc_what request)
+core_info_proc (struct target_ops *ops, const char *args,
+               enum info_proc_what request)
 {
   struct gdbarch *gdbarch = get_current_arch ();
 
@@ -999,14 +995,12 @@ init_core_ops (void)
     "Use a core file as a target.  Specify the filename of the core file.";
   core_ops.to_open = core_open;
   core_ops.to_close = core_close;
-  core_ops.to_attach = find_default_attach;
   core_ops.to_detach = core_detach;
   core_ops.to_fetch_registers = get_core_registers;
   core_ops.to_xfer_partial = core_xfer_partial;
   core_ops.to_files_info = core_files_info;
   core_ops.to_insert_breakpoint = ignore;
   core_ops.to_remove_breakpoint = ignore;
-  core_ops.to_create_inferior = find_default_create_inferior;
   core_ops.to_thread_alive = core_thread_alive;
   core_ops.to_read_description = core_read_description;
   core_ops.to_pid_to_str = core_pid_to_str;
This page took 0.025048 seconds and 4 git commands to generate.