gdb/
[deliverable/binutils-gdb.git] / gdb / corefile.c
index 1741e9c40bad612497a3ad87d17e44570c00b1bf..e940e3cba3f2aa2d684e4b27a4ec4d45c6f3cd5d 100644 (file)
@@ -1,7 +1,6 @@
 /* Core dump and executable file functions above target vector, for GDB.
 
-   Copyright (C) 1986-1987, 1989, 1991-1994, 1996-2001, 2003, 2006-2012
-   Free Software Foundation, Inc.
+   Copyright (C) 1986-2013 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -34,6 +33,7 @@
 #include "gdb_stat.h"
 #include "completer.h"
 #include "exceptions.h"
+#include "observer.h"
 
 /* Local function declarations.  */
 
@@ -60,7 +60,7 @@ static int exec_file_hook_count = 0;          /* Size of array.  */
 
 bfd *core_bfd = NULL;
 
-/* corelow.c target (if included for this gdb target).  */
+/* corelow.c target.  It is never NULL after GDB initialization.  */
 
 struct target_ops *core_target;
 \f
@@ -72,8 +72,7 @@ core_file_command (char *filename, int from_tty)
 {
   dont_repeat ();              /* Either way, seems bogus.  */
 
-  if (core_target == NULL)
-    error (_("GDB can't read core files on this machine."));
+  gdb_assert (core_target != NULL);
 
   if (!filename)
     (core_target->to_detach) (core_target, filename, from_tty);
@@ -203,18 +202,18 @@ memory_error (int status, CORE_ADDR memaddr)
        bounds.  */
     throw_error (MEMORY_ERROR,
                 _("Cannot access memory at address %s"),
-                paddress (target_gdbarch, memaddr));
+                paddress (target_gdbarch (), memaddr));
   else
     throw_error (MEMORY_ERROR,
                 _("Error accessing memory address %s: %s."),
-                paddress (target_gdbarch, memaddr),
+                paddress (target_gdbarch (), memaddr),
                 safe_strerror (status));
 }
 
 /* Same as target_read_memory, but report an error if can't read.  */
 
 void
-read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
+read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
 {
   int status;
 
@@ -226,7 +225,7 @@ read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
 /* Same as target_read_stack, but report an error if can't read.  */
 
 void
-read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
+read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
 {
   int status;
 
@@ -353,7 +352,7 @@ read_memory_typed_address (CORE_ADDR addr, struct type *type)
    write.  */
 void
 write_memory (CORE_ADDR memaddr, 
-             const bfd_byte *myaddr, int len)
+             const bfd_byte *myaddr, ssize_t len)
 {
   int status;
 
@@ -362,6 +361,16 @@ write_memory (CORE_ADDR memaddr,
     memory_error (status, memaddr);
 }
 
+/* Same as write_memory, but notify 'memory_changed' observers.  */
+
+void
+write_memory_with_notification (CORE_ADDR memaddr, const bfd_byte *myaddr,
+                               ssize_t len)
+{
+  write_memory (memaddr, myaddr, len);
+  observer_notify_memory_changed (current_inferior (), memaddr, len, myaddr);
+}
+
 /* Store VALUE at ADDR in the inferior as a LEN-byte unsigned
    integer.  */
 void
@@ -446,6 +455,7 @@ Use `set gnutarget auto' to specify automatic detection."),
                                   set_gnutarget_command,
                                   show_gnutarget_string,
                                   &setlist, &showlist);
+  add_alias_cmd ("g", "gnutarget", class_files, 1, &setlist);
 
   if (getenv ("GNUTARGET"))
     set_gnutarget (getenv ("GNUTARGET"));
This page took 0.026386 seconds and 4 git commands to generate.