/* Top level stuff for GDB, the GNU debugger.
- Copyright (C) 1999-2002, 2004-2005, 2007-2012 Free Software
- Foundation, Inc.
+ Copyright (C) 1999-2013 Free Software Foundation, Inc.
Written by Elena Zannoni <ezannoni@cygnus.com> of Cygnus Solutions.
#include "observer.h"
#include "continuations.h"
#include "gdbcmd.h" /* for dont_repeat() */
+#include "annotate.h"
+#include "maint.h"
/* readline include files. */
#include "readline/readline.h"
handlers mark these functions as ready to be executed and the event
loop, in a later iteration, calls them. See the function
invoke_async_signal_handler. */
-void *sigint_token;
+static struct async_signal_handler *sigint_token;
#ifdef SIGHUP
-void *sighup_token;
+static struct async_signal_handler *sighup_token;
#endif
#ifdef SIGQUIT
-void *sigquit_token;
+static struct async_signal_handler *sigquit_token;
#endif
-void *sigfpe_token;
+static struct async_signal_handler *sigfpe_token;
#ifdef STOP_SIGNAL
-void *sigtstp_token;
+static struct async_signal_handler *sigtstp_token;
#endif
/* Structure to save a partially entered command. This is used when
}
/* Initialize all the necessary variables, start the event loop,
- register readline, and stdin, start the loop. */
+ register readline, and stdin, start the loop. The DATA is the
+ interpreter data cookie, ignored for now. */
+
void
-cli_command_loop (void)
+cli_command_loop (void *data)
{
display_gdb_prompt (0);
char *actual_gdb_prompt = NULL;
struct cleanup *old_chain;
+ annotate_display_prompt ();
+
/* Reset the nesting depth used when trace-commands is set. */
reset_command_nest_depth ();
rl_callback_handler_remove(), does the job. */
rl_callback_handler_remove ();
+ do_cleanups (old_chain);
return;
}
else
char *p;
char *p1;
char *nline;
- char got_eof = 0;
-
int repeat = (instream == stdin);
if (annotation_level > 1 && instream == stdin)
and exit from gdb. */
if (!rl || rl == (char *) EOF)
{
- got_eof = 1;
command_handler (0);
return; /* Lint. */
}
*p = 0;
/* Add line to history if appropriate. */
- if (instream == stdin
- && ISATTY (stdin) && *linebuffer)
+ if (*linebuffer && input_from_terminal_p ())
add_history (linebuffer);
/* Note: lines consisting solely of comments are added to the command
}
-void
-mark_async_signal_handler_wrapper (void *token)
-{
- mark_async_signal_handler ((struct async_signal_handler *) token);
-}
-
/* Tell the event loop what to do if SIGINT is received.
See event-signal.c. */
void
static void
handle_sigquit (int sig)
{
- mark_async_signal_handler_wrapper (sigquit_token);
+ mark_async_signal_handler (sigquit_token);
signal (sig, handle_sigquit);
}
#endif
static void
handle_sighup (int sig)
{
- mark_async_signal_handler_wrapper (sighup_token);
+ mark_async_signal_handler (sighup_token);
signal (sig, handle_sighup);
}
TRY_CATCH (exception, RETURN_MASK_ALL)
{
- pop_all_targets (1);
+ pop_all_targets ();
}
signal (SIGHUP, SIG_DFL); /*FIXME: ??????????? */
void
handle_stop_sig (int sig)
{
- mark_async_signal_handler_wrapper (sigtstp_token);
+ mark_async_signal_handler (sigtstp_token);
signal (sig, handle_stop_sig);
}
static void
handle_sigfpe (int sig)
{
- mark_async_signal_handler_wrapper (sigfpe_token);
+ mark_async_signal_handler (sigfpe_token);
signal (sig, handle_sigfpe);
}
time. */
if (!batch_silent)
gdb_stdout = stdio_fileopen (stdout);
- gdb_stderr = stdio_fileopen (stderr);
+ gdb_stderr = stderr_fileopen ();
gdb_stdlog = gdb_stderr; /* for moment */
gdb_stdtarg = gdb_stderr; /* for moment */
gdb_stdtargerr = gdb_stderr; /* for moment */