*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / corefile.c
index ce3b7556804726b6b414ace4cd927d50f6fbef0a..ac8eff55a6e2559878c001601ed29ca5a41f883f 100644 (file)
@@ -1,7 +1,6 @@
 /* Core dump and executable file functions above target vector, for GDB.
 
-   Copyright (C) 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1996, 1997, 1998,
-   1999, 2000, 2001, 2003, 2006, 2007, 2008, 2009, 2010, 2011
+   Copyright (C) 1986-1987, 1989, 1991-1994, 1996-2001, 2003, 2006-2012
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -35,6 +34,7 @@
 #include "gdb_stat.h"
 #include "completer.h"
 #include "exceptions.h"
+#include "observer.h"
 
 /* Local function declarations.  */
 
@@ -61,7 +61,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
@@ -73,8 +73,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);
@@ -133,26 +132,9 @@ specify_exec_file_hook (void (*hook) (char *))
     deprecated_exec_file_display_hook = hook;
 }
 
-/* The exec file must be closed before running an inferior.
-   If it is needed again after the inferior dies, it must
-   be reopened.  */
-
-void
-close_exec_file (void)
-{
-#if 0                          /* FIXME */
-  if (exec_bfd)
-    bfd_tempclose (exec_bfd);
-#endif
-}
-
 void
 reopen_exec_file (void)
 {
-#if 0                          /* FIXME */
-  if (exec_bfd)
-    bfd_reopen (exec_bfd);
-#else
   char *filename;
   int res;
   struct stat st;
@@ -176,7 +158,6 @@ reopen_exec_file (void)
     bfd_cache_close_all ();
 
   do_cleanups (cleanups);
-#endif
 }
 \f
 /* If we have both a core file and an exec file,
@@ -233,7 +214,7 @@ memory_error (int status, CORE_ADDR memaddr)
 /* 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;
 
@@ -245,7 +226,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;
 
@@ -372,7 +353,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;
 
@@ -381,6 +362,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 (memaddr, len, myaddr);
+}
+
 /* Store VALUE at ADDR in the inferior as a LEN-byte unsigned
    integer.  */
 void
This page took 0.02462 seconds and 4 git commands to generate.