/* Top level stuff for GDB, the GNU debugger.
- Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2008, 2009
+ Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Written by Elena Zannoni <ezannoni@cygnus.com> of Cygnus Solutions.
/* Pushes a new prompt on the prompt stack. Each prompt has three
parts: prefix, prompt, suffix. Usually prefix and suffix are empty
strings, except when the annotation level is 2. Memory is allocated
- within savestring for the new prompt. */
+ within xstrdup for the new prompt. */
void
push_prompt (char *prefix, char *prompt, char *suffix)
{
the_prompts.top++;
- PREFIX (0) = savestring (prefix, strlen (prefix));
+ PREFIX (0) = xstrdup (prefix);
/* Note that this function is used by the set annotate 2
command. This is why we take care of saving the old prompt
in case a new one is not specified. */
if (prompt)
- PROMPT (0) = savestring (prompt, strlen (prompt));
+ PROMPT (0) = xstrdup (prompt);
else
- PROMPT (0) = savestring (PROMPT (-1), strlen (PROMPT (-1)));
+ PROMPT (0) = xstrdup (PROMPT (-1));
- SUFFIX (0) = savestring (suffix, strlen (suffix));
+ SUFFIX (0) = xstrdup (suffix);
}
/* Pops the top of the prompt stack, and frees the memory allocated for it. */
if (strcmp (PROMPT (0), PROMPT (-1)))
{
xfree (PROMPT (-1));
- PROMPT (-1) = savestring (PROMPT (0), strlen (PROMPT (0)));
+ PROMPT (-1) = xstrdup (PROMPT (0));
}
xfree (PREFIX (0));
{
#ifdef HAVE_SBRK
char *lim = (char *) sbrk (0);
+
space_at_cmd_start = lim - lim_at_start;
#endif
}
char *nline;
char got_eof = 0;
-
int repeat = (instream == stdin);
if (annotation_level > 1 && instream == stdin)
if (p > linebuffer && *(p - 1) == '\\')
{
+ *p = '\0';
p--; /* Put on top of '\'. */
- readline_input_state.linebuffer = savestring (linebuffer,
- strlen (linebuffer));
+ readline_input_state.linebuffer = xstrdup (linebuffer);
readline_input_state.linebuffer_ptr = p;
/* We will not invoke a execute_command if there is more
async_stop_sig (gdb_client_data arg)
{
char *prompt = get_prompt ();
+
#if STOP_SIGNAL == SIGTSTP
signal (SIGTSTP, SIG_DFL);
#if HAVE_SIGPROCMASK
void
set_async_prompt (char *args, int from_tty, struct cmd_list_element *c)
{
- PROMPT (0) = savestring (new_async_prompt, strlen (new_async_prompt));
+ PROMPT (0) = xstrdup (new_async_prompt);
}
/* Set things up for readline to be invoked via the alternate