From 0f641c01197d8f614a1ecb4a54c7d508f500367a Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 5 Sep 2011 14:53:13 +0000 Subject: [PATCH] 2011-09-05 Pedro Alves * inf-loop.c (execute_command): Don't check if the current thread if running before synchronously waiting for command completion. * infrun.c (fetch_inferior_event): Handle "set exec-done-display" here. (normal_stop): Call async_enable_stdin here. * inf-loop.c (inferior_event_handler): Don't call async_enable_stdin, nor handle "set exec-done-display" here. --- gdb/ChangeLog | 10 ++++++++++ gdb/inf-loop.c | 14 -------------- gdb/infrun.c | 17 +++++++++++++++-- gdb/top.c | 2 +- 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4141499..9f06267 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2011-09-05 Pedro Alves + + * inf-loop.c (execute_command): Don't check if the current thread + if running before synchronously waiting for command completion. + * infrun.c (fetch_inferior_event): Handle "set exec-done-display" + here. + (normal_stop): Call async_enable_stdin here. + * inf-loop.c (inferior_event_handler): Don't call + async_enable_stdin, nor handle "set exec-done-display" here. + 2011-09-04 Joel Brobecker GDB 7.3.1 released. diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c index 50a7391..8e49e91 100644 --- a/gdb/inf-loop.c +++ b/gdb/inf-loop.c @@ -41,7 +41,6 @@ void inferior_event_handler (enum inferior_event_type event_type, gdb_client_data client_data) { - int was_sync = 0; struct cleanup *cleanup_if_error = make_bpstat_clear_actions_cleanup (); switch (event_type) @@ -63,7 +62,6 @@ inferior_event_handler (enum inferior_event_type event_type, break; case INF_EXEC_COMPLETE: - if (!non_stop) { /* Unregister the inferior from the event loop. This is done @@ -73,12 +71,6 @@ inferior_event_handler (enum inferior_event_type event_type, target_async (NULL, 0); } - /* The call to async_enable_stdin below resets 'sync_execution'. - However, if sync_execution is 1 now, we also need to show the - prompt below, so save the current value. */ - was_sync = sync_execution; - async_enable_stdin (); - /* Do all continuations associated with the whole inferior (not a particular thread). */ if (!ptid_equal (inferior_ptid, null_ptid)) @@ -129,12 +121,6 @@ inferior_event_handler (enum inferior_event_type event_type, } exception_print (gdb_stderr, e); } - - if (!was_sync - && exec_done_display_p - && (ptid_equal (inferior_ptid, null_ptid) - || !is_running (inferior_ptid))) - printf_unfiltered (_("completed.\n")); break; case INF_EXEC_CONTINUE: diff --git a/gdb/infrun.c b/gdb/infrun.c index f9b814d..fee302c 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -2713,6 +2713,7 @@ fetch_inferior_event (void *client_data) struct cleanup *old_chain = make_cleanup (null_cleanup, NULL); struct cleanup *ts_old_chain; int was_sync = sync_execution; + int cmd_done = 0; memset (ecs, 0, sizeof (*ecs)); @@ -2804,7 +2805,10 @@ fetch_inferior_event (void *client_data) && ecs->event_thread->control.stop_step) inferior_event_handler (INF_EXEC_CONTINUE, NULL); else - inferior_event_handler (INF_EXEC_COMPLETE, NULL); + { + inferior_event_handler (INF_EXEC_COMPLETE, NULL); + cmd_done = 1; + } } /* No error, don't finish the thread states yet. */ @@ -2814,9 +2818,17 @@ fetch_inferior_event (void *client_data) do_cleanups (old_chain); /* If the inferior was in sync execution mode, and now isn't, - restore the prompt. */ + restore the prompt (a synchronous execution command has finished, + and we're ready for input). */ if (interpreter_async && was_sync && !sync_execution) display_gdb_prompt (0); + + if (cmd_done + && !was_sync + && exec_done_display_p + && (ptid_equal (inferior_ptid, null_ptid) + || !is_running (inferior_ptid))) + printf_unfiltered (_("completed.\n")); } /* Record the frame and location we're currently stepping through. */ @@ -5814,6 +5826,7 @@ normal_stop (void) goto done; target_terminal_ours (); + async_enable_stdin (); /* Set the current source location. This will also happen if we display the frame below, but the current SAL will be incorrect diff --git a/gdb/top.c b/gdb/top.c index ac37176..dfee645 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -447,7 +447,7 @@ execute_command (char *p, int from_tty) command's list, running command hooks or similars), and we just ran a synchronous command that started the target, wait for that command to end. */ - if (!interpreter_async && sync_execution && is_running (inferior_ptid)) + if (!interpreter_async && sync_execution) { while (gdb_do_one_event () >= 0) if (!sync_execution) -- 2.7.4