* Makefile.in (utils.o): Update.
* top.c (in_user_command): New. (command_line_input): Use input_from_terminal_p. (input_from_terminal_p): Don't check caution. Handle stdin == NULL for Insight. * top.h (in_user_command, caution): New declarations. * utils.c: Include "top.h". (query, defaulted_query): Check caution here. Move the call to input_from_terminal_p higher. * cli/cli-script.c (do_restore_user_call_depth): Only decrement the depth. Update in_user_command if necessary. (execute_user_command): Don't clobber old_chain. Set in_user_command. Let do_restore_user_call_depth handle user_call_depth. (read_command_lines): Check whether to prompt before calling Insight hooks. * tui/tui-hooks.c (tui_query_hook): Remove newly unnecessary input_from_terminal_p check.
This commit is contained in:
parent
2f00de94cb
commit
698ba9341e
7 changed files with 81 additions and 38 deletions
|
@ -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)
|
||||
|
||||
if (from_tty && input_from_terminal_p ())
|
||||
{
|
||||
/* 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 ())
|
||||
{
|
||||
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) ();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue