+2011-09-05 Pedro Alves <pedro@codesourcery.com>
+
+ * 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 <brobecker@adacore.com>
GDB 7.3.1 released.
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)
break;
case INF_EXEC_COMPLETE:
-
if (!non_stop)
{
/* Unregister the inferior from the event loop. This is done
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))
}
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:
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));
&& 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. */
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. */
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
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)