2004-09-13 Andrew Cagney <cagney@gnu.org>

Eliminate event_loop_p, always has the value 1.
	* defs.h (event_loop_p): Delete macro.
	* breakpoint.c (until_break_command): Simplify.
	* utils.c (prompt_for_continue): Simplify.
	* tracepoint.c (read_actions): Simplify.
	* top.c (throw_exception, execute_command, gdb_readline_wrapper)
	(gdb_rl_operate_and_get_next, command_line_input, get_prompt)
	(set_prompt, init_main): Simplify.
	(init_signals, disconnect): Delete, unused.
	* remote.c (remote_async_resume)
	(extended_remote_async_create_inferior): Simplify.
	* mi/mi-interp.c (mi_input): Delete, unused.
	(mi_interpreter_resume, mi_command_loop): Simplify.
	* interps.c (current_interp_command_loop): Simplify.
	* infrun.c (proceed): Simplify.
	* infcmd.c (run_command, continue_command, step_1, jump_command)
	(until_command, advance_command, finish_command)
	(interrupt_target_command): Simplify.
	* event-top.c (gdb_setup_readline, gdb_disable_readline): Simplify.
This commit is contained in:
Andrew Cagney 2004-09-13 18:26:31 +00:00
parent 9c50426849
commit 362646f517
12 changed files with 166 additions and 312 deletions

View File

@ -1,5 +1,25 @@
2004-09-13 Andrew Cagney <cagney@gnu.org>
Eliminate event_loop_p, always has the value 1.
* defs.h (event_loop_p): Delete macro.
* breakpoint.c (until_break_command): Simplify.
* utils.c (prompt_for_continue): Simplify.
* tracepoint.c (read_actions): Simplify.
* top.c (throw_exception, execute_command, gdb_readline_wrapper)
(gdb_rl_operate_and_get_next, command_line_input, get_prompt)
(set_prompt, init_main): Simplify.
(init_signals, disconnect): Delete, unused.
* remote.c (remote_async_resume)
(extended_remote_async_create_inferior): Simplify.
* mi/mi-interp.c (mi_input): Delete, unused.
(mi_interpreter_resume, mi_command_loop): Simplify.
* interps.c (current_interp_command_loop): Simplify.
* infrun.c (proceed): Simplify.
* infcmd.c (run_command, continue_command, step_1, jump_command)
(until_command, advance_command, finish_command)
(interrupt_target_command): Simplify.
* event-top.c (gdb_setup_readline, gdb_disable_readline): Simplify.
* config/i386/nm-i386.h (TARGET_HAS_HARDWARE_WATCHPOINTS): Delete.
* config/s390/nm-linux.h (TARGET_HAS_HARDWARE_WATCHPOINTS): Delete.
* config/pa/nm-hppah.h (TARGET_HAS_HARDWARE_WATCHPOINTS): Delete.

View File

@ -6123,7 +6123,7 @@ until_break_command (char *arg, int from_tty, int anywhere)
get_frame_id (deprecated_selected_frame),
bp_until);
if (!event_loop_p || !target_can_async_p ())
if (!target_can_async_p ())
old_chain = make_cleanup_delete_breakpoint (breakpoint);
else
old_chain = make_exec_cleanup_delete_breakpoint (breakpoint);
@ -6135,7 +6135,7 @@ until_break_command (char *arg, int from_tty, int anywhere)
where we get a chance to do that is in fetch_inferior_event, so
we must set things up for that. */
if (event_loop_p && target_can_async_p ())
if (target_can_async_p ())
{
/* In this case the arg for the continuation is just the point
in the exec_cleanups chain from where to start doing
@ -6157,7 +6157,7 @@ until_break_command (char *arg, int from_tty, int anywhere)
sal.pc = get_frame_pc (prev_frame);
breakpoint = set_momentary_breakpoint (sal, get_frame_id (prev_frame),
bp_until);
if (!event_loop_p || !target_can_async_p ())
if (!target_can_async_p ())
make_cleanup_delete_breakpoint (breakpoint);
else
make_exec_cleanup_delete_breakpoint (breakpoint);
@ -6166,7 +6166,7 @@ until_break_command (char *arg, int from_tty, int anywhere)
proceed (-1, TARGET_SIGNAL_DEFAULT, 0);
/* Do the cleanups now, anly if we are not running asynchronously,
of if we are, but the target is still synchronous. */
if (!event_loop_p || !target_can_async_p ())
if (!target_can_async_p ())
do_cleanups (old_chain);
}

View File

@ -1173,13 +1173,6 @@ extern char *interpreter_p;
struct target_waitstatus;
struct cmd_list_element;
/* Should the asynchronous variant of the interpreter (using the
event-loop) be enabled? */
/* NOTE: cagney/2004-06-10: GDB changed to always uses the event-loop.
A follow-on cleanup is to eliminate references to
"event_loop_p". */
#define event_loop_p 1
extern void (*deprecated_pre_add_symbol_hook) (const char *);
extern void (*deprecated_post_add_symbol_hook) (void);
extern void (*selected_frame_level_changed_hook) (int);

View File

@ -1106,58 +1106,55 @@ set_async_prompt (char *args, int from_tty, struct cmd_list_element *c)
void
gdb_setup_readline (void)
{
/* This function is a noop for the sync case. The assumption is that
the sync setup is ALL done in gdb_init, and we would only mess it up
here. The sync stuff should really go away over time. */
/* This function is a noop for the sync case. The assumption is
that the sync setup is ALL done in gdb_init, and we would only
mess it up here. The sync stuff should really go away over
time. */
if (event_loop_p)
gdb_stdout = stdio_fileopen (stdout);
gdb_stderr = stdio_fileopen (stderr);
gdb_stdlog = gdb_stderr; /* for moment */
gdb_stdtarg = gdb_stderr; /* for moment */
/* If the input stream is connected to a terminal, turn on
editing. */
if (ISATTY (instream))
{
gdb_stdout = stdio_fileopen (stdout);
gdb_stderr = stdio_fileopen (stderr);
gdb_stdlog = gdb_stderr; /* for moment */
gdb_stdtarg = gdb_stderr; /* for moment */
/* If the input stream is connected to a terminal, turn on
editing. */
if (ISATTY (instream))
{
/* Tell gdb that we will be using the readline library. This
could be overwritten by a command in .gdbinit like 'set
editing on' or 'off'. */
async_command_editing_p = 1;
/* Tell gdb that we will be using the readline library. This
could be overwritten by a command in .gdbinit like 'set
editing on' or 'off'. */
async_command_editing_p = 1;
/* When a character is detected on instream by select or
poll, readline will be invoked via this callback
function. */
call_readline = rl_callback_read_char_wrapper;
}
else
{
async_command_editing_p = 0;
call_readline = gdb_readline2;
}
/* When readline has read an end-of-line character, it passes
the complete line to gdb for processing. command_line_handler
is the function that does this. */
input_handler = command_line_handler;
/* Tell readline to use the same input stream that gdb uses. */
rl_instream = instream;
/* Get a file descriptor for the input stream, so that we can
register it with the event loop. */
input_fd = fileno (instream);
/* Now we need to create the event sources for the input file
descriptor. */
/* At this point in time, this is the only event source that we
register with the even loop. Another source is going to be
the target program (inferior), but that must be registered
only when it actually exists (I.e. after we say 'run' or
after we connect to a remote target. */
add_file_handler (input_fd, stdin_event_handler, 0);
/* When a character is detected on instream by select or poll,
readline will be invoked via this callback function. */
call_readline = rl_callback_read_char_wrapper;
}
else
{
async_command_editing_p = 0;
call_readline = gdb_readline2;
}
/* When readline has read an end-of-line character, it passes the
complete line to gdb for processing. command_line_handler is the
function that does this. */
input_handler = command_line_handler;
/* Tell readline to use the same input stream that gdb uses. */
rl_instream = instream;
/* Get a file descriptor for the input stream, so that we can
register it with the event loop. */
input_fd = fileno (instream);
/* Now we need to create the event sources for the input file
descriptor. */
/* At this point in time, this is the only event source that we
register with the even loop. Another source is going to be the
target program (inferior), but that must be registered only when
it actually exists (I.e. after we say 'run' or after we connect
to a remote target. */
add_file_handler (input_fd, stdin_event_handler, 0);
}
/* Disable command input through the standard CLI channels. Used in
@ -1166,22 +1163,18 @@ gdb_setup_readline (void)
void
gdb_disable_readline (void)
{
if (event_loop_p)
{
/* FIXME - It is too heavyweight to delete and remake these
every time you run an interpreter that needs readline.
It is probably better to have the interpreters cache these,
which in turn means that this needs to be moved into interpreter
specific code. */
/* FIXME - It is too heavyweight to delete and remake these every
time you run an interpreter that needs readline. It is probably
better to have the interpreters cache these, which in turn means
that this needs to be moved into interpreter specific code. */
#if 0
ui_file_delete (gdb_stdout);
ui_file_delete (gdb_stderr);
gdb_stdlog = NULL;
gdb_stdtarg = NULL;
ui_file_delete (gdb_stdout);
ui_file_delete (gdb_stderr);
gdb_stdlog = NULL;
gdb_stdtarg = NULL;
#endif
rl_callback_handler_remove ();
delete_file_handler (input_fd);
}
rl_callback_handler_remove ();
delete_file_handler (input_fd);
}

View File

@ -434,7 +434,7 @@ run_command (char *args, int from_tty)
if (!args)
{
if (event_loop_p && target_can_async_p ())
if (target_can_async_p ())
async_disable_stdin ();
}
else
@ -443,12 +443,12 @@ run_command (char *args, int from_tty)
/* If we get a request for running in the bg but the target
doesn't support it, error out. */
if (event_loop_p && async_exec && !target_can_async_p ())
if (async_exec && !target_can_async_p ())
error ("Asynchronous execution not supported on this target.");
/* If we don't get a request of running in the bg, then we need
to simulate synchronous (fg) execution. */
if (event_loop_p && !async_exec && target_can_async_p ())
if (!async_exec && target_can_async_p ())
{
/* Simulate synchronous execution */
async_disable_stdin ();
@ -526,12 +526,12 @@ continue_command (char *proc_count_exp, int from_tty)
/* If we must run in the background, but the target can't do it,
error out. */
if (event_loop_p && async_exec && !target_can_async_p ())
if (async_exec && !target_can_async_p ())
error ("Asynchronous execution not supported on this target.");
/* If we are not asked to run in the bg, then prepare to run in the
foreground, synchronously. */
if (event_loop_p && !async_exec && target_can_async_p ())
if (!async_exec && target_can_async_p ())
{
/* Simulate synchronous execution */
async_disable_stdin ();
@ -620,12 +620,12 @@ step_1 (int skip_subroutines, int single_inst, char *count_string)
/* If we get a request for running in the bg but the target
doesn't support it, error out. */
if (event_loop_p && async_exec && !target_can_async_p ())
if (async_exec && !target_can_async_p ())
error ("Asynchronous execution not supported on this target.");
/* If we don't get a request of running in the bg, then we need
to simulate synchronous (fg) execution. */
if (event_loop_p && !async_exec && target_can_async_p ())
if (!async_exec && target_can_async_p ())
{
/* Simulate synchronous execution */
async_disable_stdin ();
@ -636,14 +636,14 @@ step_1 (int skip_subroutines, int single_inst, char *count_string)
if (!single_inst || skip_subroutines) /* leave si command alone */
{
enable_longjmp_breakpoint ();
if (!event_loop_p || !target_can_async_p ())
if (!target_can_async_p ())
cleanups = make_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/);
else
make_exec_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/);
}
/* In synchronous case, all is well, just use the regular for loop. */
if (!event_loop_p || !target_can_async_p ())
if (!target_can_async_p ())
{
for (; count > 0; count--)
{
@ -701,7 +701,7 @@ which has no line number information.\n", name);
and handle them one at the time, through step_once(). */
else
{
if (event_loop_p && target_can_async_p ())
if (target_can_async_p ())
step_once (skip_subroutines, single_inst, count);
}
}
@ -828,12 +828,12 @@ jump_command (char *arg, int from_tty)
/* If we must run in the background, but the target can't do it,
error out. */
if (event_loop_p && async_exec && !target_can_async_p ())
if (async_exec && !target_can_async_p ())
error ("Asynchronous execution not supported on this target.");
/* If we are not asked to run in the bg, then prepare to run in the
foreground, synchronously. */
if (event_loop_p && !async_exec && target_can_async_p ())
if (!async_exec && target_can_async_p ())
{
/* Simulate synchronous execution */
async_disable_stdin ();
@ -1024,12 +1024,12 @@ until_command (char *arg, int from_tty)
/* If we must run in the background, but the target can't do it,
error out. */
if (event_loop_p && async_exec && !target_can_async_p ())
if (async_exec && !target_can_async_p ())
error ("Asynchronous execution not supported on this target.");
/* If we are not asked to run in the bg, then prepare to run in the
foreground, synchronously. */
if (event_loop_p && !async_exec && target_can_async_p ())
if (!async_exec && target_can_async_p ())
{
/* Simulate synchronous execution */
async_disable_stdin ();
@ -1058,12 +1058,12 @@ advance_command (char *arg, int from_tty)
/* If we must run in the background, but the target can't do it,
error out. */
if (event_loop_p && async_exec && !target_can_async_p ())
if (async_exec && !target_can_async_p ())
error ("Asynchronous execution not supported on this target.");
/* If we are not asked to run in the bg, then prepare to run in the
foreground, synchronously. */
if (event_loop_p && !async_exec && target_can_async_p ())
if (!async_exec && target_can_async_p ())
{
/* Simulate synchronous execution. */
async_disable_stdin ();
@ -1199,12 +1199,12 @@ finish_command (char *arg, int from_tty)
/* If we must run in the background, but the target can't do it,
error out. */
if (event_loop_p && async_exec && !target_can_async_p ())
if (async_exec && !target_can_async_p ())
error ("Asynchronous execution not supported on this target.");
/* If we are not asked to run in the bg, then prepare to run in the
foreground, synchronously. */
if (event_loop_p && !async_exec && target_can_async_p ())
if (!async_exec && target_can_async_p ())
{
/* Simulate synchronous execution. */
async_disable_stdin ();
@ -1228,7 +1228,7 @@ finish_command (char *arg, int from_tty)
breakpoint = set_momentary_breakpoint (sal, get_frame_id (frame), bp_finish);
if (!event_loop_p || !target_can_async_p ())
if (!target_can_async_p ())
old_chain = make_cleanup_delete_breakpoint (breakpoint);
else
old_chain = make_exec_cleanup_delete_breakpoint (breakpoint);
@ -1249,7 +1249,7 @@ finish_command (char *arg, int from_tty)
execution, set things up for the rest of the finish command to be
completed later on, when gdb has detected that the target has
stopped, in fetch_inferior_event. */
if (event_loop_p && target_can_async_p ())
if (target_can_async_p ())
{
arg1 =
(struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
@ -1272,7 +1272,7 @@ finish_command (char *arg, int from_tty)
/* Do this only if not running asynchronously or if the target
cannot do async execution. Otherwise, complete this command when
the target actually stops, in fetch_inferior_event. */
if (!event_loop_p || !target_can_async_p ())
if (!target_can_async_p ())
{
/* Did we stop at our breakpoint? */
if (bpstat_find_breakpoint (stop_bpstat, breakpoint) != NULL
@ -1897,7 +1897,7 @@ disconnect_command (char *args, int from_tty)
void
interrupt_target_command (char *args, int from_tty)
{
if (event_loop_p && target_can_async_p ())
if (target_can_async_p ())
{
dont_repeat (); /* Not for the faint of heart */
target_stop ();

View File

@ -809,7 +809,7 @@ proceed (CORE_ADDR addr, enum target_signal siggnal, int step)
and in any case decode why it stopped, and act accordingly. */
/* Do this only if we are not using the event loop, or if the target
does not support asynchronous execution. */
if (!event_loop_p || !target_can_async_p ())
if (!target_can_async_p ())
{
wait_for_inferior ();
normal_stop ();

View File

@ -275,10 +275,8 @@ current_interp_command_loop (void)
else if (current_interpreter != NULL
&& current_interpreter->procs->command_loop_proc != NULL)
current_interpreter->procs->command_loop_proc (current_interpreter->data);
else if (event_loop_p)
cli_command_loop ();
else
command_loop ();
cli_command_loop ();
}
int

View File

@ -51,7 +51,6 @@ struct mi_interp
/* These are the interpreter setup, etc. functions for the MI interpreter */
static void mi_execute_command_wrapper (char *cmd);
static void mi_command_loop (int mi_version);
static char *mi_input (char *);
/* These are hooks that we put in place while doing interpreter_exec
so we can report interesting things that happened "behind the mi's
@ -99,22 +98,19 @@ mi_interpreter_resume (void *data)
gdb_setup_readline ();
if (event_loop_p)
{
/* These overwrite some of the initialization done in
_intialize_event_loop. */
call_readline = gdb_readline2;
input_handler = mi_execute_command_wrapper;
add_file_handler (input_fd, stdin_event_handler, 0);
async_command_editing_p = 0;
/* FIXME: This is a total hack for now. PB's use of the MI implicitly
relies on a bug in the async support which allows asynchronous
commands to leak through the commmand loop. The bug involves
(but is not limited to) the fact that sync_execution was
erroneously initialized to 0. Duplicate by initializing it
thus here... */
sync_execution = 0;
}
/* These overwrite some of the initialization done in
_intialize_event_loop. */
call_readline = gdb_readline2;
input_handler = mi_execute_command_wrapper;
add_file_handler (input_fd, stdin_event_handler, 0);
async_command_editing_p = 0;
/* FIXME: This is a total hack for now. PB's use of the MI
implicitly relies on a bug in the async support which allows
asynchronous commands to leak through the commmand loop. The bug
involves (but is not limited to) the fact that sync_execution was
erroneously initialized to 0. Duplicate by initializing it thus
here... */
sync_execution = 0;
gdb_stdout = mi->out;
/* Route error and log output through the MI */
@ -365,16 +361,7 @@ mi_command_loop (int mi_version)
/* Tell the world that we're alive */
fputs_unfiltered ("(gdb) \n", raw_stdout);
gdb_flush (raw_stdout);
if (!event_loop_p)
simplified_command_loop (mi_input, mi_execute_command);
else
start_event_loop ();
}
static char *
mi_input (char *buf)
{
return gdb_readline (NULL);
start_event_loop ();
}
extern initialize_file_ftype _initialize_mi_interp; /* -Wmissing-prototypes */

View File

@ -2552,7 +2552,7 @@ remote_async_resume (ptid_t ptid, int step, enum target_signal siggnal)
/* FIXME: ezannoni 1999-09-28: We may need to move this out of here
into infcmd.c in order to allow inferior function calls to work
NOT asynchronously. */
if (event_loop_p && target_can_async_p ())
if (target_can_async_p ())
target_async (inferior_event_handler, 0);
/* Tell the world that the target is now executing. */
/* FIXME: cagney/1999-09-23: Is it the targets responsibility to set
@ -4277,7 +4277,7 @@ extended_remote_async_create_inferior (char *exec_file, char *args, char **env,
/* If running asynchronously, register the target file descriptor
with the event loop. */
if (event_loop_p && target_can_async_p ())
if (target_can_async_p ())
target_async (inferior_event_handler, 0);
/* Now restart the remote server. */

217
gdb/top.c
View File

@ -322,9 +322,9 @@ throw_exception (enum return_reason reason)
disable_current_display ();
do_cleanups (ALL_CLEANUPS);
if (event_loop_p && target_can_async_p () && !target_executing)
if (target_can_async_p () && !target_executing)
do_exec_cleanups (ALL_CLEANUPS);
if (event_loop_p && sync_execution)
if (sync_execution)
do_exec_error_cleanups (ALL_CLEANUPS);
if (annotation_level > 1)
@ -578,8 +578,6 @@ catch_command_errors (catch_command_errors_ftype * command,
/* Handler for SIGHUP. */
#ifdef SIGHUP
/* Just a little helper function for disconnect(). */
/* NOTE 1999-04-29: This function will be static again, once we modify
gdb to use the event loop as the default command loop and we merge
event-top.c into this file, top.c */
@ -591,15 +589,6 @@ quit_cover (void *s)
quit_command ((char *) 0, 0);
return 0;
}
static void
disconnect (int signo)
{
catch_errors (quit_cover, NULL,
"Could not kill the program being debugged", RETURN_MASK_ALL);
signal (SIGHUP, SIG_DFL);
kill (getpid (), SIGHUP);
}
#endif /* defined SIGHUP */
/* Line number we are currently in in a file which is being sourced. */
@ -696,7 +685,7 @@ execute_command (char *p, int from_tty)
/* If the target is running, we allow only a limited set of
commands. */
if (event_loop_p && target_can_async_p () && target_executing)
if (target_can_async_p () && target_executing)
if (strcmp (c->name, "help") != 0
&& strcmp (c->name, "pwd") != 0
&& strcmp (c->name, "show") != 0
@ -991,7 +980,7 @@ char *
gdb_readline_wrapper (char *prompt)
{
/* Set the hook that works in this case. */
if (event_loop_p && after_char_processing_hook)
if (after_char_processing_hook)
{
rl_pre_input_hook = (Function *) after_char_processing_hook;
after_char_processing_hook = NULL;
@ -1052,37 +1041,6 @@ do_nothing (int signo)
signal (signo, do_nothing);
}
static void
init_signals (void)
{
signal (SIGINT, request_quit);
/* If SIGTRAP was set to SIG_IGN, then the SIG_IGN will get passed
to the inferior and breakpoints will be ignored. */
#ifdef SIGTRAP
signal (SIGTRAP, SIG_DFL);
#endif
/* If we initialize SIGQUIT to SIG_IGN, then the SIG_IGN will get
passed to the inferior, which we don't want. It would be
possible to do a "signal (SIGQUIT, SIG_DFL)" after we fork, but
on BSD4.3 systems using vfork, that can affect the
GDB process as well as the inferior (the signal handling tables
might be in memory, shared between the two). Since we establish
a handler for SIGQUIT, when we call exec it will set the signal
to SIG_DFL for us. */
signal (SIGQUIT, do_nothing);
#ifdef SIGHUP
if (signal (SIGHUP, do_nothing) != SIG_IGN)
signal (SIGHUP, disconnect);
#endif
signal (SIGFPE, float_handler);
#if defined(SIGWINCH) && defined(SIGWINCH_HANDLER)
signal (SIGWINCH, SIGWINCH_HANDLER);
#endif
}
/* The current saved history number from operate-and-get-next.
This is -1 if not valid. */
static int operate_saved_history = -1;
@ -1114,17 +1072,8 @@ gdb_rl_operate_and_get_next (int count, int key)
{
int where;
if (event_loop_p)
{
/* Use the async hook. */
after_char_processing_hook = gdb_rl_operate_and_get_next_completion;
}
else
{
/* This hook only works correctly when we are using the
synchronous readline. */
rl_pre_input_hook = (Function *) gdb_rl_operate_and_get_next_completion;
}
/* Use the async hook. */
after_char_processing_hook = gdb_rl_operate_and_get_next_completion;
/* Find the current line, and find the next line to use. */
where = where_history();
@ -1200,12 +1149,7 @@ command_line_input (char *prompt_arg, int repeat, char *annotation_suffix)
immediate_quit++;
#ifdef STOP_SIGNAL
if (job_control)
{
if (event_loop_p)
signal (STOP_SIGNAL, handle_stop_sig);
else
signal (STOP_SIGNAL, stop_sig);
}
signal (STOP_SIGNAL, handle_stop_sig);
#endif
while (1)
@ -1419,10 +1363,7 @@ There is absolutely no warranty for GDB. Type \"show warranty\" for details.\n"
char *
get_prompt (void)
{
if (event_loop_p)
return PROMPT (0);
else
return gdb_prompt_string;
return PROMPT (0);
}
void
@ -1433,10 +1374,7 @@ set_prompt (char *s)
if (prompt != NULL)
xfree (prompt);
*/
if (event_loop_p)
PROMPT (0) = savestring (s, strlen (s));
else
gdb_prompt_string = savestring (s, strlen (s));
PROMPT (0) = savestring (s, strlen (s));
}
@ -1713,32 +1651,23 @@ init_main (void)
{
struct cmd_list_element *c;
/* If we are running the asynchronous version,
we initialize the prompts differently. */
if (!event_loop_p)
{
gdb_prompt_string = savestring (DEFAULT_PROMPT, strlen (DEFAULT_PROMPT));
}
else
{
/* initialize the prompt stack to a simple "(gdb) " prompt or to
whatever the DEFAULT_PROMPT is. */
the_prompts.top = 0;
PREFIX (0) = "";
PROMPT (0) = savestring (DEFAULT_PROMPT, strlen (DEFAULT_PROMPT));
SUFFIX (0) = "";
/* Set things up for annotation_level > 1, if the user ever decides
to use it. */
async_annotation_suffix = "prompt";
/* Set the variable associated with the setshow prompt command. */
new_async_prompt = savestring (PROMPT (0), strlen (PROMPT (0)));
/* initialize the prompt stack to a simple "(gdb) " prompt or to
whatever the DEFAULT_PROMPT is. */
the_prompts.top = 0;
PREFIX (0) = "";
PROMPT (0) = savestring (DEFAULT_PROMPT, strlen (DEFAULT_PROMPT));
SUFFIX (0) = "";
/* Set things up for annotation_level > 1, if the user ever decides
to use it. */
async_annotation_suffix = "prompt";
/* Set the variable associated with the setshow prompt command. */
new_async_prompt = savestring (PROMPT (0), strlen (PROMPT (0)));
/* If gdb was started with --annotate=2, this is equivalent to
the user entering the command 'set annotate 2' at the gdb
prompt, so we need to do extra processing. */
if (annotation_level > 1)
set_async_annotation_level (NULL, 0, NULL);
}
/* If gdb was started with --annotate=2, this is equivalent to the
user entering the command 'set annotate 2' at the gdb prompt, so
we need to do extra processing. */
if (annotation_level > 1)
set_async_annotation_level (NULL, 0, NULL);
/* Set the important stuff up for command editing. */
command_editing_p = 1;
@ -1756,55 +1685,24 @@ init_main (void)
15 is Control-o, the same binding this function has in Bash. */
rl_add_defun ("operate-and-get-next", gdb_rl_operate_and_get_next, 15);
/* The set prompt command is different depending whether or not the
async version is run. NOTE: this difference is going to
disappear as we make the event loop be the default engine of
gdb. */
if (!event_loop_p)
{
deprecated_add_show_from_set
(add_set_cmd ("prompt", class_support, var_string,
(char *) &gdb_prompt_string, "Set gdb's prompt",
&setlist),
&showlist);
}
else
{
c = add_set_cmd ("prompt", class_support, var_string,
(char *) &new_async_prompt, "Set gdb's prompt",
&setlist);
deprecated_add_show_from_set (c, &showlist);
set_cmd_sfunc (c, set_async_prompt);
}
c = add_set_cmd ("prompt", class_support, var_string,
(char *) &new_async_prompt, "Set gdb's prompt",
&setlist);
deprecated_add_show_from_set (c, &showlist);
set_cmd_sfunc (c, set_async_prompt);
add_com ("dont-repeat", class_support, dont_repeat_command, "Don't repeat this command.\n\
Primarily used inside of user-defined commands that should not be repeated when\n\
hitting return.");
/* The set editing command is different depending whether or not the
async version is run. NOTE: this difference is going to disappear
as we make the event loop be the default engine of gdb. */
if (!event_loop_p)
{
deprecated_add_show_from_set
(add_set_cmd ("editing", class_support, var_boolean, (char *) &command_editing_p,
"Set editing of command lines as they are typed.\n\
Use \"on\" to enable the editing, and \"off\" to disable it.\n\
Without an argument, command line editing is enabled. To edit, use\n\
EMACS-like or VI-like commands like control-P or ESC.", &setlist),
&showlist);
}
else
{
c = add_set_cmd ("editing", class_support, var_boolean, (char *) &async_command_editing_p,
"Set editing of command lines as they are typed.\n\
c = add_set_cmd ("editing", class_support, var_boolean, (char *) &async_command_editing_p,
"Set editing of command lines as they are typed.\n\
Use \"on\" to enable the editing, and \"off\" to disable it.\n\
Without an argument, command line editing is enabled. To edit, use\n\
EMACS-like or VI-like commands like control-P or ESC.", &setlist);
deprecated_add_show_from_set (c, &showlist);
set_cmd_sfunc (c, set_async_editing_command);
}
deprecated_add_show_from_set (c, &showlist);
set_cmd_sfunc (c, set_async_editing_command);
deprecated_add_show_from_set
(add_set_cmd ("save", no_class, var_boolean, (char *) &write_history_p,
@ -1833,37 +1731,19 @@ ie. the number of previous commands to keep a record of.", &sethistlist);
&setlist),
&showlist);
/* The set annotate command is different depending whether or not
the async version is run. NOTE: this difference is going to
disappear as we make the event loop be the default engine of
gdb. */
if (!event_loop_p)
{
c = add_set_cmd ("annotate", class_obscure, var_zinteger,
(char *) &annotation_level, "Set annotation_level.\n\
c = add_set_cmd ("annotate", class_obscure, var_zinteger,
(char *) &annotation_level, "Set annotation_level.\n\
0 == normal; 1 == fullname (for use when running under emacs)\n\
2 == output annotated suitably for use by programs that control GDB.",
&setlist);
c = deprecated_add_show_from_set (c, &showlist);
}
else
{
c = add_set_cmd ("annotate", class_obscure, var_zinteger,
(char *) &annotation_level, "Set annotation_level.\n\
0 == normal; 1 == fullname (for use when running under emacs)\n\
2 == output annotated suitably for use by programs that control GDB.",
&setlist);
deprecated_add_show_from_set (c, &showlist);
set_cmd_sfunc (c, set_async_annotation_level);
}
if (event_loop_p)
{
deprecated_add_show_from_set
(add_set_cmd ("exec-done-display", class_support, var_boolean, (char *) &exec_done_display_p,
"Set notification of completion for asynchronous execution commands.\n\
&setlist);
deprecated_add_show_from_set (c, &showlist);
set_cmd_sfunc (c, set_async_annotation_level);
deprecated_add_show_from_set
(add_set_cmd ("exec-done-display", class_support, var_boolean, (char *) &exec_done_display_p,
"Set notification of completion for asynchronous execution commands.\n\
Use \"on\" to enable the notification, and \"off\" to disable it.", &setlist),
&showlist);
}
&showlist);
}
void
@ -1891,14 +1771,7 @@ gdb_init (char *argv0)
init_cli_cmds();
init_main (); /* But that omits this file! Do it now */
/* The signal handling mechanism is different depending whether or
not the async version is run. NOTE: in the future we plan to make
the event loop be the default engine of gdb, and this difference
will disappear. */
if (event_loop_p)
async_init_signals ();
else
init_signals ();
async_init_signals ();
/* We need a default language for parsing expressions, so simple things like
"set width 0" won't fail if no language is explicitly set in a config file

View File

@ -825,12 +825,7 @@ read_actions (struct tracepoint *t)
isn't declared. Leave this alone for now. */
#ifdef STOP_SIGNAL
if (job_control)
{
if (event_loop_p)
signal (STOP_SIGNAL, handle_stop_sig);
else
signal (STOP_SIGNAL, stop_sig);
}
signal (STOP_SIGNAL, handle_stop_sig);
#endif
old_chain = make_cleanup_free_actions (t);
while (1)

View File

@ -1802,12 +1802,7 @@ prompt_for_continue (void)
while (*p == ' ' || *p == '\t')
++p;
if (p[0] == 'q')
{
if (!event_loop_p)
request_quit (SIGINT);
else
async_request_quit (0);
}
async_request_quit (0);
xfree (ignore);
}
immediate_quit--;