summaryrefslogtreecommitdiff
path: root/gdb/infcmd.c
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2002-01-21 21:57:55 +0000
committerJim Blandy <jimb@codesourcery.com>2002-01-21 21:57:55 +0000
commit281ce0d77c9a2c193dbd571b419eafc6761166eb (patch)
tree24cb7c807d7650a0ca5fdff3abbe928150e71ed4 /gdb/infcmd.c
parentcd79d01e88d74eb5f16c6b77cd3e2386879ea849 (diff)
downloadgdb-281ce0d77c9a2c193dbd571b419eafc6761166eb.tar.gz
* infcmd.c (run_command): Check that the `exec' target layer's BFD
is up-to-date before running the program, not just when a program exits. * testsuite/gdb.base/reread.exp: Check that GDB properly re-reads the executable file when it changes while no inferior is running.
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r--gdb/infcmd.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index ccf08064f4d..5b8d1f21fd8 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -389,17 +389,23 @@ Start it from the beginning? "))
clear_breakpoint_hit_counts ();
- exec_file = (char *) get_exec_file (0);
-
/* Purge old solib objfiles. */
objfile_purge_solibs ();
do_run_cleanups (NULL);
- /* The exec file is re-read every time we do a generic_mourn_inferior, so
- we just have to worry about the symbol file. */
+ /* The comment here used to read, "The exec file is re-read every
+ time we do a generic_mourn_inferior, so we just have to worry
+ about the symbol file." The `generic_mourn_inferior' function
+ gets called whenever the program exits. However, suppose the
+ program exits, and *then* the executable file changes? We need
+ to check again here. Since reopen_exec_file doesn't do anything
+ if the timestamp hasn't changed, I don't see the harm. */
+ reopen_exec_file ();
reread_symbols ();
+ exec_file = (char *) get_exec_file (0);
+
/* We keep symbols from add-symbol-file, on the grounds that the
user might want to add some symbols before running the program
(right?). But sometimes (dynamic loading where the user manually