diff options
author | Pedro Alves <pedro@codesourcery.com> | 2011-09-02 16:56:28 +0000 |
---|---|---|
committer | Pedro Alves <pedro@codesourcery.com> | 2011-09-02 16:56:28 +0000 |
commit | 0a5f727ba1d6334dd9548284ccbfc8fe7d4e9c47 (patch) | |
tree | b3004102a902dead896dd548820905f5f16fb10c /gdb/top.c | |
parent | 1e00603daae80372f25992191b3e1c9cc5c6af2e (diff) | |
download | gdb-0a5f727ba1d6334dd9548284ccbfc8fe7d4e9c47.tar.gz |
2011-09-02 Pedro Alves <pedro@codesourcery.com>
* 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.
Diffstat (limited to 'gdb/top.c')
-rw-r--r-- | gdb/top.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/gdb/top.c b/gdb/top.c index 3112d393203..ac371763dc6 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -48,6 +48,7 @@ #include "event-loop.h" #include "gdbthread.h" #include "python/python.h" +#include "interps.h" /* readline include files. */ #include "readline/readline.h" @@ -441,7 +442,18 @@ execute_command (char *p, int from_tty) deprecated_call_command_hook (c, arg, from_tty & caution); else cmd_func (c, arg, from_tty & caution); - + + /* If the interpreter is in sync mode (we're running a user + 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)) + { + while (gdb_do_one_event () >= 0) + if (!sync_execution) + break; + } + /* If this command has been post-hooked, run the hook last. */ execute_cmd_post_hook (c); @@ -497,6 +509,9 @@ execute_command_to_string (char *p, int from_tty) restoration callbacks. */ cleanup = set_batch_flag_and_make_cleanup_restore_page_info (); + make_cleanup_restore_integer (&interpreter_async); + interpreter_async = 0; + str_file = mem_fileopen (); make_cleanup_ui_file_delete (str_file); |