aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2008-03-14 18:39:43 +0000
committerDaniel Jacobowitz <drow@false.org>2008-03-14 18:39:43 +0000
commitc04ea773f9e9764a17382e6c1e0cf5a8d24df67a (patch)
tree562abf1cccaba1620d6d4edcda52252a8c3632a1 /gdb
parent952dc227b2fbc938feb2c4b8b9d5a4d5ed7473ad (diff)
downloadgdb-c04ea773f9e9764a17382e6c1e0cf5a8d24df67a.zip
gdb-c04ea773f9e9764a17382e6c1e0cf5a8d24df67a.tar.gz
gdb-c04ea773f9e9764a17382e6c1e0cf5a8d24df67a.tar.bz2
* cache.c (close_one): Remove mtime hack.
* corefile.c (reopen_exec_file): Use exec_bfd_mtime. * exec.c (exec_bfd_mtime): Define. (exec_close): Clear it. (exec_file_attach): Set it. * gdbcore.h (exec_bfd_mtime): Declare. * source.c (find_source_lines): Do not use bfd_get_mtime.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/corefile.c3
-rw-r--r--gdb/exec.c4
-rw-r--r--gdb/gdbcore.h3
-rw-r--r--gdb/source.c4
5 files changed, 19 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 075a799..082c44c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2008-03-14 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * corefile.c (reopen_exec_file): Use exec_bfd_mtime.
+ * exec.c (exec_bfd_mtime): Define.
+ (exec_close): Clear it.
+ (exec_file_attach): Set it.
+ * gdbcore.h (exec_bfd_mtime): Declare.
+ * source.c (find_source_lines): Do not use bfd_get_mtime.
+
2008-03-14 Vladimir Prus <vladimir@codesourcery.com>
* top.c (simplified_command_loop): Remove.
diff --git a/gdb/corefile.c b/gdb/corefile.c
index 7452f50..b1dbc6b 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -160,10 +160,9 @@ 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);
#endif
}
diff --git a/gdb/exec.c b/gdb/exec.c
index 7648b03..a759ab5 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -69,6 +69,7 @@ struct target_ops exec_ops;
/* The Binary File Descriptor handle for the executable file. */
bfd *exec_bfd = NULL;
+long exec_bfd_mtime = 0;
/* Whether to open exec and core files read-only or read-write. */
@@ -136,6 +137,7 @@ exec_close (int quitting)
name, bfd_errmsg (bfd_get_error ()));
xfree (name);
exec_bfd = NULL;
+ exec_bfd_mtime = 0;
}
if (exec_ops.to_sections)
@@ -260,6 +262,8 @@ exec_file_attach (char *filename, int from_tty)
scratch_pathname, bfd_errmsg (bfd_get_error ()));
}
+ exec_bfd_mtime = bfd_get_mtime (exec_bfd);
+
validate_files ();
set_gdbarch_from_file (exec_bfd);
diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h
index 383cc3f..6d8d2eb 100644
--- a/gdb/gdbcore.h
+++ b/gdb/gdbcore.h
@@ -104,6 +104,9 @@ extern void specify_exec_file_hook (void (*hook) (char *filename));
extern bfd *core_bfd;
extern bfd *exec_bfd;
+/* The mtime when we last opened exec_bfd. */
+extern long exec_bfd_mtime;
+
/* Whether to open exec and core files read-only or read-write. */
extern int write_files;
diff --git a/gdb/source.c b/gdb/source.c
index 7cbd55f..2c69547 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1127,9 +1127,9 @@ find_source_lines (struct symtab *s, int desc)
perror_with_name (s->filename);
if (s->objfile && s->objfile->obfd)
- mtime = bfd_get_mtime (s->objfile->obfd);
+ mtime = s->objfile->mtime;
else if (exec_bfd)
- mtime = bfd_get_mtime (exec_bfd);
+ mtime = exec_bfd_mtime;
if (mtime && mtime < st.st_mtime)
warning (_("Source file is more recent than executable."));