diff options
author | Mark Alexander <marka@cygnus> | 1998-05-14 04:01:13 +0000 |
---|---|---|
committer | Mark Alexander <marka@cygnus> | 1998-05-14 04:01:13 +0000 |
commit | 091d73027cf6944a75fa7be5e3559cf486b4d13c (patch) | |
tree | b26027923a75c7161d23d0d2a72a16ccb1c16917 /gdb/corefile.c | |
parent | 900dc14b4256592f304ff471e15c97d3788993dd (diff) | |
download | gdb-091d73027cf6944a75fa7be5e3559cf486b4d13c.zip gdb-091d73027cf6944a75fa7be5e3559cf486b4d13c.tar.gz gdb-091d73027cf6944a75fa7be5e3559cf486b4d13c.tar.bz2 |
Fix for PR 13484:
* corefile.c (reopen_exec_file): Reopen the exec file if
it has changed.
Diffstat (limited to 'gdb/corefile.c')
-rw-r--r-- | gdb/corefile.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gdb/corefile.c b/gdb/corefile.c index ddaee62..7f66ec1 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -33,6 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gdbcore.h" #include "dis-asm.h" #include "language.h" +#include "gdb_stat.h" extern char registers[]; @@ -149,6 +150,24 @@ reopen_exec_file () #if 0 /* FIXME */ if (exec_bfd) bfd_reopen (exec_bfd); +#else + char *filename; + int res; + struct stat st; + long mtime; + + /* Don't do anything if the current target isn't exec. */ + if (exec_bfd == NULL || strcmp (target_shortname, "exec") != 0) + return; + + /* If the timestamp of the exec file has changed, reopen it. */ + filename = strdup (bfd_get_filename (exec_bfd)); + make_cleanup (free, filename); + mtime = bfd_get_mtime(exec_bfd); + res = stat (filename, &st); + + if (mtime && mtime != st.st_mtime) + exec_file_command (filename, 0); #endif } |