From b4a14fd09b84468e7d28a2889d99a27008781fb1 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 2 Sep 2011 16:56:30 +0000 Subject: 2011-09-02 Pedro Alves * top.c: Include interps.h. (execute_command): If the target can async, but the interpreter is in sync mode, synchronously wait for the command to finish before returning. (execute_command_to_string): Force the interpreter to sync mode. * infrun.c: Include interps.h. (fetch_inferior_event): Don't restore the prompt yet if the interpreter is in sync mode. * interps.c (interpreter_async): New global. * interps.h (interpreter_async): Declare. * inf-loop.c: Include interps.h. (inferior_event_handler): Don't print the language change or run breakpoint commands yet if the interpreter in is sync mode. * main.c (captured_command_loop): Flip the interpreter to async mode. * cli/cli-script.c: Include interps.h. (execute_user_command, while_command, if_command): Force the interpreter to sync mode. * python/python.c: Include interps.h. (python_command, execute_gdb_command): Force the interpreter to sync mode. --- gdb/inf-loop.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'gdb/inf-loop.c') diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c index 670b966..50a7391 100644 --- a/gdb/inf-loop.c +++ b/gdb/inf-loop.c @@ -29,6 +29,7 @@ #include "language.h" #include "gdbthread.h" #include "continuations.h" +#include "interps.h" static int fetch_inferior_event_wrapper (gdb_client_data client_data); @@ -40,7 +41,6 @@ void inferior_event_handler (enum inferior_event_type event_type, gdb_client_data client_data) { - struct gdb_exception e; int was_sync = 0; struct cleanup *cleanup_if_error = make_bpstat_clear_actions_cleanup (); @@ -109,19 +109,26 @@ inferior_event_handler (enum inferior_event_type event_type, else do_all_continuations (0); - if (info_verbose - && current_language != expected_language - && language_mode == language_mode_auto) - language_info (1); /* Print what changed. */ - - /* Don't propagate breakpoint commands errors. Either we're - stopping or some command resumes the inferior. The user will - be informed. */ - TRY_CATCH (e, RETURN_MASK_ALL) + /* When running a command list (from a user command, say), these + are only run when the command list is all done. */ + if (interpreter_async) { - bpstat_do_actions (); + volatile struct gdb_exception e; + + if (info_verbose + && current_language != expected_language + && language_mode == language_mode_auto) + language_info (1); /* Print what changed. */ + + /* Don't propagate breakpoint commands errors. Either we're + stopping or some command resumes the inferior. The user will + be informed. */ + TRY_CATCH (e, RETURN_MASK_ALL) + { + bpstat_do_actions (); + } + exception_print (gdb_stderr, e); } - exception_print (gdb_stderr, e); if (!was_sync && exec_done_display_p -- cgit v1.1