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/python/python.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gdb/python/python.c') diff --git a/gdb/python/python.c b/gdb/python/python.c index 03edce9..360bed4 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -52,6 +52,7 @@ static int gdbpy_should_print_stack = 0; #include "target.h" #include "gdbthread.h" #include "observer.h" +#include "interps.h" static PyMethodDef GdbMethods[]; @@ -199,6 +200,10 @@ python_command (char *arg, int from_tty) struct cleanup *cleanup; cleanup = ensure_python_env (get_current_arch (), current_language); + + make_cleanup_restore_integer (&interpreter_async); + interpreter_async = 0; + while (arg && *arg && isspace (*arg)) ++arg; if (arg && *arg) @@ -378,6 +383,9 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw) char *copy = xstrdup (arg); struct cleanup *cleanup = make_cleanup (xfree, copy); + make_cleanup_restore_integer (&interpreter_async); + interpreter_async = 0; + prevent_dont_repeat (); if (to_string) result = execute_command_to_string (copy, from_tty); -- cgit v1.1