aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli/cli-script.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/cli/cli-script.c')
-rw-r--r--gdb/cli/cli-script.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index ee986d1..b8e9d4f 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -1,8 +1,8 @@
/* GDB CLI command scripting.
Copyright (c) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
- 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005 Free
- Software Foundation, Inc.
+ 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -241,9 +241,9 @@ static void
do_restore_user_call_depth (void * call_depth)
{
int * depth = call_depth;
- /* We will be returning_to_top_level() at this point, so we want to
- reset our depth. */
- (*depth) = 0;
+ (*depth)--;
+ if ((*depth) == 0)
+ in_user_command = 0;
}
@@ -266,12 +266,17 @@ execute_user_command (struct cmd_list_element *c, char *args)
if (++user_call_depth > max_user_call_depth)
error (_("Max user call depth exceeded -- command aborted."));
- old_chain = make_cleanup (do_restore_user_call_depth, &user_call_depth);
+ make_cleanup (do_restore_user_call_depth, &user_call_depth);
/* Set the instream to 0, indicating execution of a
user-defined function. */
- old_chain = make_cleanup (do_restore_instream_cleanup, instream);
+ make_cleanup (do_restore_instream_cleanup, instream);
instream = (FILE *) 0;
+
+ /* Also set the global in_user_command, so that NULL instream is
+ not confused with Insight. */
+ in_user_command = 1;
+
while (cmdlines)
{
ret = execute_control_command (cmdlines);
@@ -283,8 +288,6 @@ execute_user_command (struct cmd_list_element *c, char *args)
cmdlines = cmdlines->next;
}
do_cleanups (old_chain);
-
- user_call_depth--;
}
enum command_control_type
@@ -920,15 +923,19 @@ read_command_lines (char *prompt_arg, int from_tty)
enum misc_command_type val;
control_level = 0;
- if (deprecated_readline_begin_hook)
- {
- /* Note - intentional to merge messages with no newline */
- (*deprecated_readline_begin_hook) ("%s %s\n", prompt_arg, END_MESSAGE);
- }
- else if (from_tty && input_from_terminal_p ())
+
+ if (from_tty && input_from_terminal_p ())
{
- printf_unfiltered ("%s\n%s\n", prompt_arg, END_MESSAGE);
- gdb_flush (gdb_stdout);
+ if (deprecated_readline_begin_hook)
+ {
+ /* Note - intentional to merge messages with no newline */
+ (*deprecated_readline_begin_hook) ("%s %s\n", prompt_arg, END_MESSAGE);
+ }
+ else
+ {
+ printf_unfiltered ("%s\n%s\n", prompt_arg, END_MESSAGE);
+ gdb_flush (gdb_stdout);
+ }
}
head = tail = NULL;
@@ -989,7 +996,7 @@ read_command_lines (char *prompt_arg, int from_tty)
do_cleanups (old_chain);
}
- if (deprecated_readline_end_hook)
+ if (deprecated_readline_end_hook && from_tty && input_from_terminal_p ())
{
(*deprecated_readline_end_hook) ();
}