Include common-defs.h instead of defs.h/server.h in shared code
[deliverable/binutils-gdb.git] / gdb / corefile.c
index 048669b9d2e68613596d5a94c8f7841a1f2e2f73..1617392372d80cc752f590fcc6c978720a7917f2 100644 (file)
@@ -18,8 +18,6 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
-#include <string.h>
-#include <errno.h>
 #include <signal.h>
 #include <fcntl.h>
 #include "inferior.h"
@@ -39,7 +37,6 @@
 /* Local function declarations.  */
 
 extern void _initialize_core (void);
-static void call_extra_exec_file_hooks (char *filename);
 
 /* You can have any number of hooks for `exec_file_command' command to
    call.  If there's only one hook, it is set in exec_file_display
@@ -50,7 +47,7 @@ static void call_extra_exec_file_hooks (char *filename);
    only one hook could be set, and which called
    deprecated_exec_file_display_hook directly.  */
 
-typedef void (*hook_type) (char *);
+typedef void (*hook_type) (const char *);
 
 hook_type deprecated_exec_file_display_hook;   /* The original hook.  */
 static hook_type *exec_file_extra_hooks;       /* Array of additional
@@ -87,7 +84,7 @@ core_file_command (char *filename, int from_tty)
    functions.  */
 
 static void
-call_extra_exec_file_hooks (char *filename)
+call_extra_exec_file_hooks (const char *filename)
 {
   int i;
 
@@ -99,7 +96,7 @@ call_extra_exec_file_hooks (char *filename)
    This is called from the x-window display code.  */
 
 void
-specify_exec_file_hook (void (*hook) (char *))
+specify_exec_file_hook (void (*hook) (const char *))
 {
   hook_type *new_array;
 
@@ -204,7 +201,7 @@ memory_error_message (enum target_xfer_status err,
         bounds.  */
       return xstrprintf (_("Cannot access memory at address %s"),
                         paddress (gdbarch, memaddr));
-    case TARGET_XFER_E_UNAVAILABLE:
+    case TARGET_XFER_UNAVAILABLE:
       return xstrprintf (_("Memory at address %s unavailable."),
                         paddress (gdbarch, memaddr));
     default:
@@ -233,7 +230,7 @@ memory_error (enum target_xfer_status err, CORE_ADDR memaddr)
     case TARGET_XFER_E_IO:
       exception = MEMORY_ERROR;
       break;
-    case TARGET_XFER_E_UNAVAILABLE:
+    case TARGET_XFER_UNAVAILABLE:
       exception = NOT_AVAILABLE_ERROR;
       break;
     }
@@ -260,13 +257,10 @@ read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
                                    memaddr + xfered, len - xfered,
                                    &xfered_len);
 
-      if (status == TARGET_XFER_EOF)
-       memory_error (TARGET_XFER_E_IO, memaddr + xfered);
+      if (status != TARGET_XFER_OK)
+       memory_error (status == TARGET_XFER_EOF ? TARGET_XFER_E_IO : status,
+                     memaddr + xfered);
 
-      if (TARGET_XFER_STATUS_ERROR_P (status))
-       memory_error (status, memaddr + xfered);
-
-      gdb_assert (status == TARGET_XFER_OK);
       xfered += xfered_len;
       QUIT;
     }
This page took 0.025222 seconds and 4 git commands to generate.