mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-24 20:49:43 +00:00
* 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
@ -1,3 +1,24 @@
|
|||||||
|
2006-03-29 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2006-03-29 Ulrich Weigand <uweigand@de.ibm.com>
|
2006-03-29 Ulrich Weigand <uweigand@de.ibm.com>
|
||||||
|
|
||||||
* s390-nat.c (s390_insert_watchpoint): Add missing argument.
|
* s390-nat.c (s390_insert_watchpoint): Add missing argument.
|
||||||
|
@ -2744,7 +2744,7 @@ user-regs.o: user-regs.c $(defs_h) $(user_regs_h) $(gdbtypes_h) \
|
|||||||
utils.o: utils.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(event_top_h) \
|
utils.o: utils.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(event_top_h) \
|
||||||
$(exceptions_h) $(tui_h) $(gdbcmd_h) $(serial_h) $(bfd_h) \
|
$(exceptions_h) $(tui_h) $(gdbcmd_h) $(serial_h) $(bfd_h) \
|
||||||
$(target_h) $(demangle_h) $(expression_h) $(language_h) $(charset_h) \
|
$(target_h) $(demangle_h) $(expression_h) $(language_h) $(charset_h) \
|
||||||
$(annotate_h) $(filenames_h) $(symfile_h) $(inferior_h) \
|
$(annotate_h) $(filenames_h) $(symfile_h) $(inferior_h) $(top_h) \
|
||||||
$(gdb_curses_h) $(readline_h) $(gdb_obstack_h)
|
$(gdb_curses_h) $(readline_h) $(gdb_obstack_h)
|
||||||
uw-thread.o: uw-thread.c $(defs_h) $(gdbthread_h) $(target_h) $(inferior_h) \
|
uw-thread.o: uw-thread.c $(defs_h) $(gdbthread_h) $(target_h) $(inferior_h) \
|
||||||
$(regcache_h) $(gregset_h)
|
$(regcache_h) $(gregset_h)
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* GDB CLI command scripting.
|
/* GDB CLI command scripting.
|
||||||
|
|
||||||
Copyright (c) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
|
Copyright (c) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
|
||||||
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005 Free
|
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006
|
||||||
Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
|
||||||
@ -241,9 +241,9 @@ static void
|
|||||||
do_restore_user_call_depth (void * call_depth)
|
do_restore_user_call_depth (void * call_depth)
|
||||||
{
|
{
|
||||||
int * depth = call_depth;
|
int * depth = call_depth;
|
||||||
/* We will be returning_to_top_level() at this point, so we want to
|
(*depth)--;
|
||||||
reset our depth. */
|
if ((*depth) == 0)
|
||||||
(*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)
|
if (++user_call_depth > max_user_call_depth)
|
||||||
error (_("Max user call depth exceeded -- command aborted."));
|
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
|
/* Set the instream to 0, indicating execution of a
|
||||||
user-defined function. */
|
user-defined function. */
|
||||||
old_chain = make_cleanup (do_restore_instream_cleanup, instream);
|
make_cleanup (do_restore_instream_cleanup, instream);
|
||||||
instream = (FILE *) 0;
|
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)
|
while (cmdlines)
|
||||||
{
|
{
|
||||||
ret = execute_control_command (cmdlines);
|
ret = execute_control_command (cmdlines);
|
||||||
@ -283,8 +288,6 @@ execute_user_command (struct cmd_list_element *c, char *args)
|
|||||||
cmdlines = cmdlines->next;
|
cmdlines = cmdlines->next;
|
||||||
}
|
}
|
||||||
do_cleanups (old_chain);
|
do_cleanups (old_chain);
|
||||||
|
|
||||||
user_call_depth--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum command_control_type
|
enum command_control_type
|
||||||
@ -920,15 +923,19 @@ read_command_lines (char *prompt_arg, int from_tty)
|
|||||||
enum misc_command_type val;
|
enum misc_command_type val;
|
||||||
|
|
||||||
control_level = 0;
|
control_level = 0;
|
||||||
if (deprecated_readline_begin_hook)
|
|
||||||
|
if (from_tty && input_from_terminal_p ())
|
||||||
{
|
{
|
||||||
/* Note - intentional to merge messages with no newline */
|
if (deprecated_readline_begin_hook)
|
||||||
(*deprecated_readline_begin_hook) ("%s %s\n", prompt_arg, END_MESSAGE);
|
{
|
||||||
}
|
/* Note - intentional to merge messages with no newline */
|
||||||
else if (from_tty && input_from_terminal_p ())
|
(*deprecated_readline_begin_hook) ("%s %s\n", prompt_arg, END_MESSAGE);
|
||||||
{
|
}
|
||||||
printf_unfiltered ("%s\n%s\n", prompt_arg, END_MESSAGE);
|
else
|
||||||
gdb_flush (gdb_stdout);
|
{
|
||||||
|
printf_unfiltered ("%s\n%s\n", prompt_arg, END_MESSAGE);
|
||||||
|
gdb_flush (gdb_stdout);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
head = tail = NULL;
|
head = tail = NULL;
|
||||||
@ -989,7 +996,7 @@ read_command_lines (char *prompt_arg, int from_tty)
|
|||||||
do_cleanups (old_chain);
|
do_cleanups (old_chain);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deprecated_readline_end_hook)
|
if (deprecated_readline_end_hook && from_tty && input_from_terminal_p ())
|
||||||
{
|
{
|
||||||
(*deprecated_readline_end_hook) ();
|
(*deprecated_readline_end_hook) ();
|
||||||
}
|
}
|
||||||
|
23
gdb/top.c
23
gdb/top.c
@ -112,6 +112,10 @@ Whether to confirm potentially dangerous operations is %s.\n"),
|
|||||||
|
|
||||||
FILE *instream;
|
FILE *instream;
|
||||||
|
|
||||||
|
/* Flag to indicate whether a user defined command is currently running. */
|
||||||
|
|
||||||
|
int in_user_command;
|
||||||
|
|
||||||
/* Current working directory. */
|
/* Current working directory. */
|
||||||
|
|
||||||
char *current_directory;
|
char *current_directory;
|
||||||
@ -909,11 +913,11 @@ command_line_input (char *prompt_arg, int repeat, char *annotation_suffix)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Don't use fancy stuff if not talking to stdin. */
|
/* Don't use fancy stuff if not talking to stdin. */
|
||||||
if (deprecated_readline_hook && instream == NULL)
|
if (deprecated_readline_hook && input_from_terminal_p ())
|
||||||
{
|
{
|
||||||
rl = (*deprecated_readline_hook) (local_prompt);
|
rl = (*deprecated_readline_hook) (local_prompt);
|
||||||
}
|
}
|
||||||
else if (command_editing_p && instream == stdin && ISATTY (instream))
|
else if (command_editing_p && input_from_terminal_p ())
|
||||||
{
|
{
|
||||||
rl = gdb_readline_wrapper (local_prompt);
|
rl = gdb_readline_wrapper (local_prompt);
|
||||||
}
|
}
|
||||||
@ -1197,13 +1201,22 @@ quit_force (char *args, int from_tty)
|
|||||||
exit (exit_code);
|
exit (exit_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns whether GDB is running on a terminal and whether the user
|
/* Returns whether GDB is running on a terminal and input is
|
||||||
desires that questions be asked of them on that terminal. */
|
currently coming from that terminal. */
|
||||||
|
|
||||||
int
|
int
|
||||||
input_from_terminal_p (void)
|
input_from_terminal_p (void)
|
||||||
{
|
{
|
||||||
return gdb_has_a_terminal () && (instream == stdin) & caution;
|
if (gdb_has_a_terminal () && instream == stdin)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
/* If INSTREAM is unset, and we are not in a user command, we
|
||||||
|
must be in Insight. That's like having a terminal, for our
|
||||||
|
purposes. */
|
||||||
|
if (instream == NULL && !in_user_command)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* Top level stuff for GDB, the GNU debugger.
|
/* Top level stuff for GDB, the GNU debugger.
|
||||||
|
|
||||||
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
|
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
|
||||||
1996, 1997, 1998, 1999, 2000, 2005 Free Software Foundation, Inc.
|
1996, 1997, 1998, 1999, 2000, 2005, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
|
||||||
@ -27,6 +27,8 @@
|
|||||||
extern char *line;
|
extern char *line;
|
||||||
extern int linesize;
|
extern int linesize;
|
||||||
extern FILE *instream;
|
extern FILE *instream;
|
||||||
|
extern int in_user_command;
|
||||||
|
extern int caution;
|
||||||
extern char gdb_dirbuf[1024];
|
extern char gdb_dirbuf[1024];
|
||||||
extern int inhibit_gdbinit;
|
extern int inhibit_gdbinit;
|
||||||
extern int epoch_interface;
|
extern int epoch_interface;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* GDB hooks for TUI.
|
/* GDB hooks for TUI.
|
||||||
|
|
||||||
Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
|
||||||
@ -77,10 +78,6 @@ tui_query_hook (const char * msg, va_list argp)
|
|||||||
int ans2;
|
int ans2;
|
||||||
int answer;
|
int answer;
|
||||||
|
|
||||||
/* Automatically answer "yes" if input is not from a terminal. */
|
|
||||||
if (!input_from_terminal_p ())
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
echo ();
|
echo ();
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
19
gdb/utils.c
19
gdb/utils.c
@ -54,6 +54,7 @@
|
|||||||
#include "filenames.h"
|
#include "filenames.h"
|
||||||
#include "symfile.h"
|
#include "symfile.h"
|
||||||
#include "gdb_obstack.h"
|
#include "gdb_obstack.h"
|
||||||
|
#include "top.h"
|
||||||
|
|
||||||
#include "inferior.h" /* for signed_pointer_to_address */
|
#include "inferior.h" /* for signed_pointer_to_address */
|
||||||
|
|
||||||
@ -1141,16 +1142,17 @@ query (const char *ctlstr, ...)
|
|||||||
int ans2;
|
int ans2;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
|
/* Automatically answer "yes" if input is not from the user
|
||||||
|
directly, or if the user did not want prompts. */
|
||||||
|
if (!input_from_terminal_p () || !caution)
|
||||||
|
return 1;
|
||||||
|
|
||||||
if (deprecated_query_hook)
|
if (deprecated_query_hook)
|
||||||
{
|
{
|
||||||
va_start (args, ctlstr);
|
va_start (args, ctlstr);
|
||||||
return deprecated_query_hook (ctlstr, args);
|
return deprecated_query_hook (ctlstr, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Automatically answer "yes" if input is not from a terminal. */
|
|
||||||
if (!input_from_terminal_p ())
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
wrap_here (""); /* Flush any buffered output */
|
wrap_here (""); /* Flush any buffered output */
|
||||||
@ -1244,15 +1246,16 @@ defaulted_query (const char *ctlstr, const char defchar, va_list args)
|
|||||||
n_string = "[n]";
|
n_string = "[n]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Automatically answer the default value if input is not from the user
|
||||||
|
directly, or if the user did not want prompts. */
|
||||||
|
if (!input_from_terminal_p () || !caution)
|
||||||
|
return def_value;
|
||||||
|
|
||||||
if (deprecated_query_hook)
|
if (deprecated_query_hook)
|
||||||
{
|
{
|
||||||
return deprecated_query_hook (ctlstr, args);
|
return deprecated_query_hook (ctlstr, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Automatically answer default value if input is not from a terminal. */
|
|
||||||
if (!input_from_terminal_p ())
|
|
||||||
return def_value;
|
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
wrap_here (""); /* Flush any buffered output */
|
wrap_here (""); /* Flush any buffered output */
|
||||||
|
Loading…
Reference in New Issue
Block a user