diff options
author | Daniel Jacobowitz <drow@false.org> | 2006-07-24 20:38:08 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2006-07-24 20:38:08 +0000 |
commit | 4c42eaff630026a1c9589e913d072935fed919c1 (patch) | |
tree | af7754be431bda48c2d576f4ebf431a1af11c819 | |
parent | b05e64e5fe26950eba7f895b31019b8cc598b42d (diff) | |
download | gdb-4c42eaff630026a1c9589e913d072935fed919c1.zip gdb-4c42eaff630026a1c9589e913d072935fed919c1.tar.gz gdb-4c42eaff630026a1c9589e913d072935fed919c1.tar.bz2 |
gdb/
* corefile.c (reopen_exec_file): Only check for an open exec file.
Use exec_file_attach.
* exec.c (exec_open): Make static.
(exec_file_command): Don't use target_preopen. Query directly about
changing the file.
* gdbcore.h (exec_open): Remove prototype.
gdb/testsuite/
* gdb.base/completion.exp: Update for change in "file" behavior.
* gdb.stabs/weird.exp: Likewise.
* lib/mi-support.exp (mi_gdb_file_cmd): Likewise.
* lib/gdb.exp (gdb_file_cmd): Likewise. Kill the program explicitly.
-rw-r--r-- | gdb/ChangeLog | 11 | ||||
-rw-r--r-- | gdb/corefile.c | 8 | ||||
-rw-r--r-- | gdb/exec.c | 9 | ||||
-rw-r--r-- | gdb/gdbcore.h | 2 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/completion.exp | 21 | ||||
-rw-r--r-- | gdb/testsuite/gdb.stabs/weird.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 19 | ||||
-rw-r--r-- | gdb/testsuite/lib/mi-support.exp | 5 |
9 files changed, 49 insertions, 35 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ebb2450..b92727c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,4 +1,13 @@ -2006-07-21 Frederic Riss <frederic.riss@st.com> +2006-07-24 Daniel Jacobowitz <dan@codesourcery.com> + + * corefile.c (reopen_exec_file): Only check for an open exec file. + Use exec_file_attach. + * exec.c (exec_open): Make static. + (exec_file_command): Don't use target_preopen. Query directly about + changing the file. + * gdbcore.h (exec_open): Remove prototype. + +2006-07-24 Frederic Riss <frederic.riss@st.com> * regcache.c (struct regcache): Make register_valid_p a signed char array. diff --git a/gdb/corefile.c b/gdb/corefile.c index c49d00c..03e853b 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -156,8 +156,8 @@ reopen_exec_file (void) 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) + /* Don't do anything if there isn't an exec file. */ + if (exec_bfd == NULL) return; /* If the timestamp of the exec file has changed, reopen it. */ @@ -167,9 +167,7 @@ reopen_exec_file (void) res = stat (filename, &st); if (mtime && mtime != st.st_mtime) - { - exec_open (filename, 0); - } + exec_file_attach (filename, 0); #endif } @@ -85,7 +85,7 @@ show_write_files (struct ui_file *file, int from_tty, struct vmap *vmap; -void +static void exec_open (char *args, int from_tty) { target_preopen (from_tty); @@ -286,8 +286,11 @@ exec_file_command (char *args, int from_tty) { char **argv; char *filename; - - target_preopen (from_tty); + + if (from_tty && target_has_execution + && !query (_("A program is being debugged already.\n" + "Are you sure you want to change the file? "))) + error (_("File not changed.")); if (args) { diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h index eb4c46d..d72a17b 100644 --- a/gdb/gdbcore.h +++ b/gdb/gdbcore.h @@ -123,8 +123,6 @@ extern int write_files; extern void core_file_command (char *filename, int from_tty); -extern void exec_open (char *filename, int from_tty); - extern void exec_file_attach (char *filename, int from_tty); extern void exec_file_clear (int from_tty); diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 641cdd2..f145210 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2006-07-24 Daniel Jacobowitz <dan@codesourcery.com> + + * gdb.base/completion.exp: Update for change in "file" behavior. + * gdb.stabs/weird.exp: Likewise. + * lib/mi-support.exp (mi_gdb_file_cmd): Likewise. + * lib/gdb.exp (gdb_file_cmd): Likewise. Kill the program explicitly. + 2006-07-24 Nathan Sidwell <nathan@codesourcery.com> * gdb.base/auxv.exp: Skip on non-linux, non-solaris targets. diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index 2961cb5..23d6902 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -671,19 +671,14 @@ sleep 1 gdb_expect { -re "^file ./gdb.base/completion\\.exp $"\ { send_gdb "\n" - gdb_expect { - -re "\r\nA program is being debugged already\\. Kill it\\? \\(y or n\\) $" - { send_gdb "n\n" - gdb_expect { - -re "\r\nProgram not killed\\.\r\n$gdb_prompt $"\ - { pass "complete 'file ./gdb.base/complet'"} - -re ".*$gdb_prompt $" { fail "complete 'file ./gdb.base/complet'"} - timeout {fail "(timeout) complete 'file ./gdb.base/complet'"} - } - } - -re ".*$gdb_prompt $" { fail "complete 'file ./gdb.base/complet'"} - timeout {fail "(timeout) complete 'file ./gdb.base/complet'"} - } + # Ignore the exact error message. + gdb_test_multiple "" "complete 'file ./gdb.base/complet'" { + -re "\r\nA program is being debugged already\\.\[\r\n\]+Are you sure you want to change the file\\? \\(y or n\\) $" { + send_gdb "n\n" + exp_continue + } + -re ".*$gdb_prompt $" { pass "complete 'file ./gdb.base/complet'" } + } } -re ".*$gdb_prompt $" { fail "complete 'file ./gdb.base/complet'" } timeout { fail "(timeout) complete 'file ./gdb.base/complet'" } diff --git a/gdb/testsuite/gdb.stabs/weird.exp b/gdb/testsuite/gdb.stabs/weird.exp index 7f67ccb..fca9701 100644 --- a/gdb/testsuite/gdb.stabs/weird.exp +++ b/gdb/testsuite/gdb.stabs/weird.exp @@ -313,7 +313,7 @@ gdb_expect 60 { -re "^file (\[^ \]| +\008)*\r*\n" { exp_continue } - -re "A program is being debugged already. Kill it\\? \\(y or n\\)" { + -re "A program is being debugged already.\[\r\n\]+Are you sure you want to change the file\\? \\(y or n\\)" { send_gdb "y\n" exp_continue } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index eca2a50..047bf50 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1008,6 +1008,20 @@ proc gdb_file_cmd { arg } { } } + # The file command used to kill the remote target. For the benefit + # of the testsuite, preserve this behavior. + send_gdb "kill\n" + gdb_expect 120 { + -re "Kill the program being debugged. .y or n. $" { + send_gdb "y\n" + verbose "\t\tKilling previous program being debugged" + exp_continue + } + -re "$gdb_prompt $" { + # OK. + } + } + send_gdb "file $arg\n" gdb_expect 120 { -re "Reading symbols from.*no debugging symbols found.*done.*$gdb_prompt $" { @@ -1020,11 +1034,6 @@ proc gdb_file_cmd { arg } { set gdb_file_cmd_debug_info "debug" return 0 } - -re "A program is being debugged already.*Kill it.*y or n. $" { - send_gdb "y\n" - verbose "\t\tKilling previous program being debugged" - exp_continue - } -re "Load new symbol table from \".*\".*y or n. $" { send_gdb "y\n" gdb_expect 120 { diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index fa99c53..5d5af94 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -411,11 +411,6 @@ proc mi_gdb_file_cmd { arg } { perror "$arg wasn't compiled with \"-g\"" return -1 } - -re "A program is being debugged already.*Kill it.*y or n. $" { - send_gdb "y\n" - verbose "\t\tKilling previous program being debugged" - exp_continue - } -re "Load new symbol table from \".*\".*y or n. $" { send_gdb "y\n" gdb_expect 120 { |