4a11f20659
This patch syncs our upstream copy of readline from version 6.2 to the latest version, 7.0 alpha (released July 10 2015). I essentially copied what was done the last time readline was synced, when Jan updated to readline 6.2 in 2011: http://sourceware.org/ml/gdb-patches/2011-05/msg00003.html Procedure: 1. I extracted the readline-7.0-alpha tarball on top of readline/. 2. I deleted all the new files under doc/ that were deliberately omitted before. 3. I regenerated readline/configure and readline/examples/rlfe/configure using autoconf 2.64. No other configure files need regenerating. 4. I updated the function gdb_printable_part in completer.c with a trivial change made to the readline function it is based off of, printable_part in readline/complete.c. There is more work to be done in completer.c to sync it with readline/complete.c, but it is non-trivial and should probably be done separately anyway. Local patches that had to be reapplied: None. readline 7.0 alpha contains all of our local readline patches. New files in readline/: colors.{c,h} examples/{hist_erasedups,hist_purgecmd,rl-callbacktest,rlbasic}.c parse-colors.{c,h} readline.pc.in configure.ac Deleted files in readline/: configure.in Regressions: After the sync there is one testsuite regression, the test "signal SIGINT" in gdb.gdb/selftest.exp which now FAILs. Previously, the readline 6.2 SIGINT handler would temporarily reinstall the underlying application's SIGINT handler and immediately re-raise SIGINT so that the orginal handler gets invoked. But now (since readline 6.3) its SIGINT handler does not re-raise SIGINT or directly invoke the original handler; it now sets a flag marking that SIGINT was raised, and waits until readline explicitly has control to call the application's SIGINT handler. Anyway, because SIGINT is no longer re-raised from within readline's SIGINT handler, doing "signal SIGINT" with a stopped inferior gdb process will no longer resume and then immediately stop the process (since there is no 2nd SIGINT to immediately catch). Instead, the inferior gdb process will now just print "Quit" and continue to run. So with this commit, this particular test case is adjusted to reflect this change in behavior (we now have to send a 2nd SIGINT manually to stop it). Aside from this one testsuite regression, I personally noticed no regression in user-visible behavior. Though I only tested on x86_64 and on i686 Debian Stretch. Getting this kind of change in at the start of the GDB 7.11 development cycle will allow us to get a lot of passive testing from developers and from bleeding-edge users. readline/ChangeLog.gdb: Import readline 7.0 alpha * configure: Regenerate. * examples/rlfe/configure: Regenerate. gdb/ChangeLog: * completer.c (gdb_printable_part): Sync with readline function it is based off of. gdb/testsuite/ChangeLog: * gdb.gdb/selftest.exp (test_with_self): Update test to now expect the GDB inferior to no longer immediately stop after being resumed with "signal SIGINT".
90 lines
2 KiB
C
90 lines
2 KiB
C
/* Standard include files. stdio.h is required. */
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
|
|
/* Used for select(2) */
|
|
#include <sys/types.h>
|
|
#include <sys/select.h>
|
|
|
|
#include <errno.h>
|
|
#include <stdio.h>
|
|
|
|
/* Standard readline include files. */
|
|
#if defined (READLINE_LIBRARY)
|
|
# include "readline.h"
|
|
# include "history.h"
|
|
#else
|
|
# include <readline/readline.h>
|
|
# include <readline/history.h>
|
|
#endif
|
|
|
|
extern int errno;
|
|
|
|
static void cb_linehandler (char *);
|
|
|
|
int running;
|
|
const char *prompt = "rltest$ ";
|
|
|
|
/* Callback function called for each line when accept-line executed, EOF
|
|
seen, or EOF character read. This sets a flag and returns; it could
|
|
also call exit(3). */
|
|
static void
|
|
cb_linehandler (char *line)
|
|
{
|
|
/* Can use ^D (stty eof) or `exit' to exit. */
|
|
if (line == NULL || strcmp (line, "exit") == 0)
|
|
{
|
|
if (line == 0)
|
|
printf ("\n");
|
|
printf ("exit\n");
|
|
/* This function needs to be called to reset the terminal settings,
|
|
and calling it from the line handler keeps one extra prompt from
|
|
being displayed. */
|
|
rl_callback_handler_remove ();
|
|
|
|
running = 0;
|
|
}
|
|
else
|
|
{
|
|
if (*line)
|
|
add_history (line);
|
|
printf ("input line: %s\n", line);
|
|
free (line);
|
|
}
|
|
}
|
|
|
|
int
|
|
main (int c, char **v)
|
|
{
|
|
fd_set fds;
|
|
int r;
|
|
|
|
/* Install the line handler. */
|
|
rl_callback_handler_install (prompt, cb_linehandler);
|
|
|
|
/* Enter a simple event loop. This waits until something is available
|
|
to read on readline's input stream (defaults to standard input) and
|
|
calls the builtin character read callback to read it. It does not
|
|
have to modify the user's terminal settings. */
|
|
running = 1;
|
|
while (running)
|
|
{
|
|
FD_ZERO (&fds);
|
|
FD_SET (fileno (rl_instream), &fds);
|
|
|
|
r = select (FD_SETSIZE, &fds, NULL, NULL, NULL);
|
|
if (r < 0 && errno != EINTR)
|
|
{
|
|
perror ("rltest: select");
|
|
rl_callback_handler_remove ();
|
|
break;
|
|
}
|
|
|
|
if (FD_ISSET (fileno (rl_instream), &fds))
|
|
rl_callback_read_char ();
|
|
}
|
|
|
|
printf ("rltest: Event loop has exited\n");
|
|
return 0;
|
|
}
|