From 4247603be536b5ff74624da45e486c369e995f82 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Thu, 18 Mar 2010 13:21:40 +0000 Subject: [PATCH] gdb/ * infcmd.c (until_command): Use ERROR_NO_INFERIOR. Ensure there's a valid selected thread, and that it is not running. (advance_command): Ditto. (finish_command): Ditto. gdb/testsuite/ * gdb.base/default.exp: Adjust. --- gdb/ChangeLog | 7 +++++++ gdb/infcmd.c | 17 +++++++++-------- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.base/default.exp | 6 +++--- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f961562f399..e5e8ae231a6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2010-03-18 Pedro Alves + + * infcmd.c (until_command): Use ERROR_NO_INFERIOR. Ensure there's + a valid selected thread, and that it is not running. + (advance_command): Ditto. + (finish_command): Ditto. + 2010-03-17 Stan Shebs * ax-gdb.c (require_rvalue): Disallow non-scalars. diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 8cc516dad00..e2235db2de0 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1274,10 +1274,10 @@ until_command (char *arg, int from_tty) { int async_exec = 0; - if (!target_has_execution) - error (_("The program is not running.")); - + ERROR_NO_INFERIOR; ensure_not_tfind_mode (); + ensure_valid_thread (); + ensure_not_running (); /* Find out whether we must run in the background. */ if (arg != NULL) @@ -1307,10 +1307,10 @@ advance_command (char *arg, int from_tty) { int async_exec = 0; - if (!target_has_execution) - error (_("The program is not running.")); - + ERROR_NO_INFERIOR; ensure_not_tfind_mode (); + ensure_valid_thread (); + ensure_not_running (); if (arg == NULL) error_no_arg (_("a location")); @@ -1565,7 +1565,10 @@ finish_command (char *arg, int from_tty) int async_exec = 0; + ERROR_NO_INFERIOR; ensure_not_tfind_mode (); + ensure_valid_thread (); + ensure_not_running (); /* Find out whether we must run in the background. */ if (arg != NULL) @@ -1590,8 +1593,6 @@ finish_command (char *arg, int from_tty) if (arg) error (_("The \"finish\" command does not take any arguments.")); - if (!target_has_execution) - error (_("The program is not running.")); frame = get_prev_frame (get_selected_frame (_("No selected frame."))); if (frame == 0) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index d79a15cf590..ad46ecfe858 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-03-18 Pedro Alves + + * gdb.base/default.exp: Adjust the expected output of the finish + and until commands when the inferior is not being run. + 2010-03-15 Sami Wagiaalla * gdb.cp/shadow.exp: Removed kfail; test has been fix. diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp index 9603fd4ae0a..808435de443 100644 --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -250,7 +250,7 @@ gdb_expect { } #test finish -gdb_test "finish" "The program is not running." "finish" +gdb_test "finish" "The program is not being run." "finish" #test forward-search # The message here comes from the regexp library, not gdb, and so can # vary on different systems. @@ -753,9 +753,9 @@ gdb_test "tbreak" "No default breakpoint address now." "tbreak" #test tty gdb_test "tty" "Argument required .filename to set it to\..*" "tty" #test until "u" abbreviation -gdb_test "u" "The program is not running." "until \"u\" abbreviation" +gdb_test "u" "The program is not being run." "until \"u\" abbreviation" #test until -gdb_test "until" "The program is not running." "until" +gdb_test "until" "The program is not being run." "until" #test undisplay # FIXME -- need to dump full output to detailed log send_gdb "undisplay\n" -- 2.30.2