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
commit39ad761d6d8e190fde168daeaa521cc17681ba3e (patch)
treedf7323cc4af0d589a5d9efc459194c0c5f0713a1 /gdb/infcmd.c
parent58255df39cc133d5e5f2eab79e22113c7fd0289f (diff)
downloadbinutils-gdb-39ad761d6d8e190fde168daeaa521cc17681ba3e.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