diff options
author | Pedro Alves <palves@redhat.com> | 2011-09-02 16:56:30 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2011-09-02 16:56:30 +0000 |
commit | b4a14fd09b84468e7d28a2889d99a27008781fb1 (patch) | |
tree | 4ae20f93ec8f3fd4518dc2f5ce66e788d981a511 /gdb/top.c | |
parent | c709acd150761fffe3536bf9e6a0b32870f41ca3 (diff) | |
download | gdb-b4a14fd09b84468e7d28a2889d99a27008781fb1.zip gdb-b4a14fd09b84468e7d28a2889d99a27008781fb1.tar.gz gdb-b4a14fd09b84468e7d28a2889d99a27008781fb1.tar.bz2 |
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
@@ -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); |