*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / corefile.c
index 7452f50b0b89baa5c80f970dc599a5c2c0a37e09..2be4e260f5b90838f8a9b22d38b48495eeaf6d58 100644 (file)
@@ -160,11 +160,15 @@ reopen_exec_file (void)
   /* If the timestamp of the exec file has changed, reopen it. */
   filename = xstrdup (bfd_get_filename (exec_bfd));
   make_cleanup (xfree, filename);
-  mtime = bfd_get_mtime (exec_bfd);
   res = stat (filename, &st);
 
-  if (mtime && mtime != st.st_mtime)
+  if (exec_bfd_mtime && exec_bfd_mtime != st.st_mtime)
     exec_file_attach (filename, 0);
+  else
+    /* If we accessed the file since last opening it, close it now;
+       this stops GDB from holding the executable open after it
+       exits.  */
+    bfd_cache_close_all ();
 #endif
 }
 \f
@@ -346,10 +350,7 @@ void
 write_memory (CORE_ADDR memaddr, const bfd_byte *myaddr, int len)
 {
   int status;
-  gdb_byte *bytes = alloca (len);
-  
-  memcpy (bytes, myaddr, len);
-  status = target_write_memory (memaddr, bytes, len);
+  status = target_write_memory (memaddr, myaddr, len);
   if (status != 0)
     memory_error (status, memaddr);
 }
@@ -452,7 +453,7 @@ No arg means have no core file.  This command has been superseded by the\n\
 
   
   add_setshow_string_noescape_cmd ("gnutarget", class_files,
-                                  &gnutarget_string, _("(\
+                                  &gnutarget_string, _("\
 Set the current BFD target."), _("\
 Show the current BFD target."), _("\
 Use `set gnutarget auto' to specify automatic detection."),
This page took 0.023398 seconds and 4 git commands to generate.