summaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorPedro Alves <pedro@codesourcery.com>2011-09-02 16:56:28 +0000
committerPedro Alves <pedro@codesourcery.com>2011-09-02 16:56:28 +0000
commit0a5f727ba1d6334dd9548284ccbfc8fe7d4e9c47 (patch)
treeb3004102a902dead896dd548820905f5f16fb10c /gdb/cli
parent1e00603daae80372f25992191b3e1c9cc5c6af2e (diff)
downloadgdb-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/cli')
-rw-r--r--gdb/cli/cli-script.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 66fa220b310..790ce81cc90 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -35,6 +35,7 @@
#include "gdb_assert.h"
#include "python/python.h"
+#include "interps.h"
/* Prototypes for local functions. */
@@ -338,6 +339,9 @@ execute_user_command (struct cmd_list_element *c, char *args)
not confused with Insight. */
in_user_command = 1;
+ make_cleanup_restore_integer (&interpreter_async);
+ interpreter_async = 0;
+
command_nest_depth++;
while (cmdlines)
{
@@ -598,6 +602,7 @@ void
while_command (char *arg, int from_tty)
{
struct command_line *command = NULL;
+ struct cleanup *old_chain;
control_level = 1;
command = get_command_line (while_control, arg);
@@ -605,8 +610,13 @@ while_command (char *arg, int from_tty)
if (command == NULL)
return;
+ old_chain = make_cleanup_restore_integer (&interpreter_async);
+ interpreter_async = 0;
+
execute_control_command_untraced (command);
free_command_lines (&command);
+
+ do_cleanups (old_chain);
}
/* "if" command support. Execute either the true or false arm depending
@@ -616,6 +626,7 @@ void
if_command (char *arg, int from_tty)
{
struct command_line *command = NULL;
+ struct cleanup *old_chain;
control_level = 1;
command = get_command_line (if_control, arg);
@@ -623,8 +634,13 @@ if_command (char *arg, int from_tty)
if (command == NULL)
return;
+ old_chain = make_cleanup_restore_integer (&interpreter_async);
+ interpreter_async = 0;
+
execute_control_command_untraced (command);
free_command_lines (&command);
+
+ do_cleanups (old_chain);
}
/* Cleanup */