/* 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
/* Actually, address between memaddr and memaddr + len
was out of bounds. */
fprintf_unfiltered (tmp_stream, "Cannot access memory at address ");
- deprecated_print_address_numeric (memaddr, 1, tmp_stream);
+ fputs_filtered (paddress (memaddr), tmp_stream);
}
else
{
fprintf_filtered (tmp_stream, "Error accessing memory address ");
- deprecated_print_address_numeric (memaddr, 1, tmp_stream);
+ fputs_filtered (paddress (memaddr), tmp_stream);
fprintf_filtered (tmp_stream, ": %s.",
safe_strerror (status));
}