From 8f0e742e7a4969a88961c0ac38c4427c94c5780b Mon Sep 17 00:00:00 2001 From: John Marino Date: Tue, 15 May 2012 22:56:24 +0200 Subject: [PATCH] gdb: Fix gdb -tui mode The gdbtui (aka gdb -tui) mode has been nonfunctional for a long time due to the replacement of readline with libedit. After speaking with Cristos Zoulas, it was confirmed that libedit can't support gdbtui now and is not envisioned to support it in the future. The tui mode is fixed by building the readline library internally and linking against that instead of libedit. The README files were updated to reflected additional imported sources for readline and the removal of libedit-caused local modications to tui-io.c file. --- contrib/gdb-7/README.DELETED | 56 ------ contrib/gdb-7/README.DRAGONFLY | 1 - contrib/gdb-7/gdb/tui/tui-io.c | 11 +- gnu/usr.bin/gdb/Makefile | 3 +- gnu/usr.bin/gdb/Makefile.inc | 4 +- gnu/usr.bin/gdb/gdb/Makefile | 14 +- gnu/usr.bin/gdb/kgdb/Makefile | 14 +- gnu/usr.bin/gdb/libreadline/Makefile | 43 +++++ gnu/usr.bin/gdb/libreadline/config.h | 271 +++++++++++++++++++++++++++ 9 files changed, 344 insertions(+), 73 deletions(-) create mode 100644 gnu/usr.bin/gdb/libreadline/Makefile create mode 100644 gnu/usr.bin/gdb/libreadline/config.h diff --git a/contrib/gdb-7/README.DELETED b/contrib/gdb-7/README.DELETED index 4a91b95255..3591c91e6e 100644 --- a/contrib/gdb-7/README.DELETED +++ b/contrib/gdb-7/README.DELETED @@ -1528,17 +1528,10 @@ readline/NEWS readline/README readline/USAGE readline/aclocal.m4 -readline/ansi_stdlib.h -readline/bind.c -readline/callback.c -readline/chardefs.h -readline/compat.c -readline/complete.c readline/config.h.in readline/configure readline/configure.in readline/cross-build/ -readline/display.c readline/doc/ChangeLog.gdb readline/doc/Makefile.in readline/doc/fdl.texi @@ -1552,60 +1545,11 @@ readline/doc/rluserman.texi readline/doc/texi2dvi readline/doc/texi2html readline/doc/version.texi -readline/emacs_keymap.c readline/examples/ -readline/funmap.c -readline/histexpand.c -readline/histfile.c -readline/histlib.h -readline/history.c -readline/history.h -readline/histsearch.c -readline/input.c -readline/isearch.c -readline/keymaps.c -readline/keymaps.h -readline/kill.c -readline/macro.c -readline/mbutil.c -readline/misc.c -readline/nls.c -readline/parens.c readline/patchlevel -readline/posixdir.h -readline/posixjmp.h -readline/posixselect.h -readline/posixstat.h -readline/readline.c -readline/readline.h -readline/rlconf.h -readline/rldefs.h -readline/rlmbutil.h -readline/rlprivate.h -readline/rlshell.h -readline/rlstdc.h -readline/rltty.c -readline/rltty.h -readline/rltypedefs.h -readline/rlwinsize.h readline/savestring.c -readline/search.c -readline/shell.c readline/shlib/ -readline/signals.c readline/support/ -readline/tcap.h -readline/terminal.c -readline/text.c -readline/tilde.c -readline/tilde.h -readline/undo.c -readline/util.c -readline/vi_keymap.c -readline/vi_mode.c -readline/xfree.c -readline/xmalloc.c -readline/xmalloc.h sim/ src-release symlink-tree diff --git a/contrib/gdb-7/README.DRAGONFLY b/contrib/gdb-7/README.DRAGONFLY index fbfbcb8569..7b152bda5f 100644 --- a/contrib/gdb-7/README.DRAGONFLY +++ b/contrib/gdb-7/README.DRAGONFLY @@ -37,6 +37,5 @@ Local modifications applied to following files: gdb/mi/mi-main.c gdb/osabi.c gdb/top.c - gdb/tui-io.c include/elf/common.h include/libiberty.h diff --git a/contrib/gdb-7/gdb/tui/tui-io.c b/contrib/gdb-7/gdb/tui/tui-io.c index 4a5087c20f..2fb7bb436c 100644 --- a/contrib/gdb-7/gdb/tui/tui-io.c +++ b/contrib/gdb-7/gdb/tui/tui-io.c @@ -399,6 +399,9 @@ static void tui_rl_display_match_list (char **matches, int len, int max) { typedef int QSFUNC (const void *, const void *); + extern int _rl_qsort_string_compare (const void *, + const void *); + extern int _rl_print_completions_horizontally; int count, limit, printed_len; int i, j, k, l; @@ -502,7 +505,7 @@ tui_rl_display_match_list (char **matches, int len, int max) void tui_setup_io (int mode) { - extern int readline_echoing_p; + extern int _rl_echoing_p; if (mode) { @@ -512,12 +515,12 @@ tui_setup_io (int mode) tui_old_rl_prep_terminal = rl_prep_term_function; tui_old_rl_getc_function = rl_getc_function; tui_old_rl_outstream = rl_outstream; - tui_old_rl_echoing_p = readline_echoing_p; + tui_old_rl_echoing_p = _rl_echoing_p; rl_redisplay_function = tui_redisplay_readline; rl_deprep_term_function = tui_deprep_terminal; rl_prep_term_function = tui_prep_terminal; rl_getc_function = tui_getc; - readline_echoing_p = 0; + _rl_echoing_p = 0; rl_outstream = tui_rl_outstream; rl_prompt = 0; rl_completion_display_matches_hook = tui_rl_display_match_list; @@ -556,7 +559,7 @@ tui_setup_io (int mode) rl_getc_function = tui_old_rl_getc_function; rl_outstream = tui_old_rl_outstream; rl_completion_display_matches_hook = 0; - readline_echoing_p = tui_old_rl_echoing_p; + _rl_echoing_p = tui_old_rl_echoing_p; rl_already_prompted = 0; /* Save tty for SIGCONT. */ diff --git a/gnu/usr.bin/gdb/Makefile b/gnu/usr.bin/gdb/Makefile index a219d82a2e..d644b6465c 100644 --- a/gnu/usr.bin/gdb/Makefile +++ b/gnu/usr.bin/gdb/Makefile @@ -1,3 +1,4 @@ -SUBDIR= libbfd libiberty libopcodes libdecnumber libgdb gdb kgdb gdbtui +SUBDIR= libbfd libiberty libopcodes libdecnumber libreadline +SUBDIR+= libgdb gdb kgdb gdbtui .include diff --git a/gnu/usr.bin/gdb/Makefile.inc b/gnu/usr.bin/gdb/Makefile.inc index 055232b6d0..50c1460402 100644 --- a/gnu/usr.bin/gdb/Makefile.inc +++ b/gnu/usr.bin/gdb/Makefile.inc @@ -1,8 +1,10 @@ BASEDIR= ${.CURDIR}/${RELATIVE}../../../../contrib/gdb-7 +GDBLIBS+= ${.OBJDIR}/../libreadline/libreadline.a GDBLIBS+= ${.OBJDIR}/../libopcodes/libopcodes.a -GDBLIBS+= ${.OBJDIR}/../libgdb/libgdb.a GDBLIBS+= ${.OBJDIR}/../libbfd/libbfd.a GDBLIBS+= ${.OBJDIR}/../libiberty/libiberty.a +GDBLIBS+= ${.OBJDIR}/../libdecnumber/libdecnumber.a +GDBLIBS+= ${.OBJDIR}/../libgdb/libgdb.a .include "../Makefile.inc" diff --git a/gnu/usr.bin/gdb/gdb/Makefile b/gnu/usr.bin/gdb/gdb/Makefile index 24a5e99b6e..c6a83531c0 100644 --- a/gnu/usr.bin/gdb/gdb/Makefile +++ b/gnu/usr.bin/gdb/gdb/Makefile @@ -6,11 +6,15 @@ CFLAGS+= -I${BASEDIR}/bfd -I${BASEDIR}/gdb -I${BASEDIR}/gdb/config CFLAGS+= -I${BASEDIR}/gdb/common -I${.CURDIR}/../libbfd CFLAGS+= -I${.OBJDIR}/../libbfd -DPADD= ${GDBLIBS} -DPADD+= ${LIBEDIT} ${LIBTERMCAP} ${LIBM} ${LIBZ} -LDADD= -L../libgdb -lgdb -L../libbfd -lbfd -L../libopcodes -lopcodes -L../libiberty -liberty -LDADD+= -L../libdecnumber -ldecnumber -LDADD+= -ledit -ltermcap -lm -lz +DPADD= ${GDBLIBS} +DPADD+= ${LIBNCURSES} ${LIBM} ${LIBZ} ${LIBKVM} +LDADD= -L../libgdb -lgdb +LDADD+= -L../libreadline -lreadline +LDADD+= -L../libopcodes -lopcodes +LDADD+= -L../libbfd -lbfd +LDADD+= -L../libiberty -liberty +LDADD+= -L../libdecnumber -ldecnumber +LDADD+= -lncurses -lm -lz -lkvm SUBDIR= doc diff --git a/gnu/usr.bin/gdb/kgdb/Makefile b/gnu/usr.bin/gdb/kgdb/Makefile index 904d674c67..86a285c2f6 100644 --- a/gnu/usr.bin/gdb/kgdb/Makefile +++ b/gnu/usr.bin/gdb/kgdb/Makefile @@ -6,11 +6,15 @@ CFLAGS+= -I${BASEDIR}/bfd -I${BASEDIR}/gdb -I${BASEDIR}/gdb/config -I${.CURDIR}/ CFLAGS+= -I${.OBJDIR}/../libbfd -I${BASEDIR}/gdb/common CFLAGS+= -D_KERNEL_STRUCTURES -DPADD= ${LIBEDIT} ${LIBKVM} ${LIBTERMCAP} ${LIBM} ${LIBZ} -DPADD+= ${GDBLIBS} -LDADD= -L../libgdb -lgdb -L../libbfd -lbfd -L../libopcodes -lopcodes -LDADD+= -L../libiberty -liberty -L../libdecnumber -ldecnumber -LDADD+= -ledit -lkvm -ltermcap -lm -lz +DPADD= ${GDBLIBS} +DPADD+= ${LIBNCURSES} ${LIBM} ${LIBZ} ${LIBKVM} +LDADD= -L../libgdb -lgdb +LDADD+= -L../libreadline -lreadline +LDADD+= -L../libopcodes -lopcodes +LDADD+= -L../libbfd -lbfd +LDADD+= -L../libiberty -liberty +LDADD+= -L../libdecnumber -ldecnumber +LDADD+= -lncurses -lm -lz -lkvm WARNS?= 2 diff --git a/gnu/usr.bin/gdb/libreadline/Makefile b/gnu/usr.bin/gdb/libreadline/Makefile new file mode 100644 index 0000000000..319351e1e2 --- /dev/null +++ b/gnu/usr.bin/gdb/libreadline/Makefile @@ -0,0 +1,43 @@ +.include "../Makefile.inc" + +LIB= readline +INTERNALLIB= YES + +.PATH: ${BASEDIR}/readline +CFLAGS+= -I${.CURDIR} -I${.OBJDIR} -I${BASEDIR} +CFLAGS+= -DHAVE_CONFIG_H + +SRCS+= readline.c \ + vi_mode.c \ + funmap.c \ + keymaps.c \ + parens.c \ + search.c \ + rltty.c \ + complete.c \ + bind.c \ + isearch.c \ + display.c \ + signals.c \ + util.c \ + kill.c \ + undo.c \ + macro.c \ + input.c \ + callback.c \ + terminal.c \ + text.c \ + nls.c \ + misc.c \ + compat.c \ + xfree.c \ + xmalloc.c \ + history.c \ + histexpand.c \ + histfile.c \ + histsearch.c \ + shell.c \ + mbutil.c \ + tilde.c + +.include diff --git a/gnu/usr.bin/gdb/libreadline/config.h b/gnu/usr.bin/gdb/libreadline/config.h new file mode 100644 index 0000000000..211a4aee6b --- /dev/null +++ b/gnu/usr.bin/gdb/libreadline/config.h @@ -0,0 +1,271 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Maintained by hand. */ + +/* Define NO_MULTIBYTE_SUPPORT to not compile in support for multibyte + characters, even if the OS supports them. */ +/* #undef NO_MULTIBYTE_SUPPORT */ + +/* #undef _FILE_OFFSET_BITS */ + +/* Define if on MINIX. */ +/* #undef _MINIX */ + +/* Define as the return type of signal handlers (int or void). */ +#define RETSIGTYPE void + +#define VOID_SIGHANDLER 1 + +/* Characteristics of the compiler. */ +/* #undef sig_atomic_t */ + +/* #undef size_t */ + +/* #undef ssize_t */ + +/* #undef const */ + +/* #undef volatile */ + +#define PROTOTYPES 1 + +/* #undef __CHAR_UNSIGNED__ */ + +/* Define if the `S_IS*' macros in do not work properly. */ +/* #undef STAT_MACROS_BROKEN */ + +/* Define if you have the fcntl function. */ +#define HAVE_FCNTL 1 + +/* Define if you have the getpwent function. */ +#define HAVE_GETPWENT 1 + +/* Define if you have the getpwnam function. */ +#define HAVE_GETPWNAM 1 + +/* Define if you have the getpwuid function. */ +#define HAVE_GETPWUID 1 + +/* Define if you have the isascii function. */ +#define HAVE_ISASCII 1 + +/* Define if you have the iswctype function. */ +#define HAVE_ISWCTYPE 1 + +/* Define if you have the iswlower function. */ +#define HAVE_ISWLOWER 1 + +/* Define if you have the iswupper function. */ +#define HAVE_ISWUPPER 1 + +/* Define if you have the isxdigit function. */ +#define HAVE_ISXDIGIT 1 + +/* Define if you have the kill function. */ +#define HAVE_KILL 1 + +/* Define if you have the lstat function. */ +#define HAVE_LSTAT 1 + +/* Define if you have the mbrlen function. */ +#define HAVE_MBRLEN 1 + +/* Define if you have the mbrtowc function. */ +#define HAVE_MBRTOWC 1 + +/* Define if you have the mbsrtowcs function. */ +#define HAVE_MBSRTOWCS 1 + +/* Define if you have the memmove function. */ +#define HAVE_MEMMOVE 1 + +/* Define if you have the putenv function. */ +#define HAVE_PUTENV 1 + +/* Define if you have the select function. */ +#define HAVE_SELECT 1 + +/* Define if you have the setenv function. */ +#define HAVE_SETENV 1 + +/* Define if you have the setlocale function. */ +#define HAVE_SETLOCALE 1 + +/* Define if you have the strcasecmp function. */ +#define HAVE_STRCASECMP 1 + +/* Define if you have the strcoll function. */ +#define HAVE_STRCOLL 1 + +/* #undef STRCOLL_BROKEN */ + +/* Define if you have the strpbrk function. */ +#define HAVE_STRPBRK 1 + +/* Define if you have the tcgetattr function. */ +#define HAVE_TCGETATTR 1 + +/* Define if you have the towlower function. */ +#define HAVE_TOWLOWER 1 + +/* Define if you have the towupper function. */ +#define HAVE_TOWUPPER 1 + +/* Define if you have the vsnprintf function. */ +#define HAVE_VSNPRINTF 1 + +/* Define if you have the wcrtomb function. */ +#define HAVE_WCRTOMB 1 + +/* Define if you have the wcscoll function. */ +#define HAVE_WCSCOLL 1 + +/* Define if you have the wctype function. */ +#define HAVE_WCTYPE 1 + +/* Define if you have the wcwidth function. */ +#define HAVE_WCWIDTH 1 + +#define STDC_HEADERS 1 + +/* Define if you have the header file. */ +#define HAVE_DIRENT_H 1 + +/* Define if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the header file. */ +#define HAVE_LANGINFO_H 1 + +/* Define if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_NDIR_H */ + +/* Define if you have the header file. */ +#define HAVE_PWD_H 1 + +/* Define if you have the header file. */ +#define HAVE_STDARG_H 1 + +/* Define if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define if you have the header file. */ +#define HAVE_SYS_FILE_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_PTE_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_PTEM_H */ + +/* Define if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_STREAM_H */ + +/* Define if you have the header file. */ +#define HAVE_TERMCAP_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_TERMIO_H */ + +/* Define if you have the header file. */ +#define HAVE_TERMIOS_H 1 + +/* Define if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define if you have the header file. */ +#define HAVE_VARARGS_H 1 + +/* Define if you have the header file. */ +#define HAVE_WCHAR_H 1 + +/* Define if you have the header file. */ +#define HAVE_WCTYPE_H 1 + +#define HAVE_MBSTATE_T 1 + +/* Define if you have wchar_t in . */ +#define HAVE_WCHAR_T 1 + +/* Define if you have wctype_t in . */ +#define HAVE_WCTYPE_T 1 + +/* Define if you have wint_t in . */ +#define HAVE_WINT_T 1 + +/* Define if you have and nl_langinfo(CODESET). */ +#define HAVE_LANGINFO_CODESET 1 + +/* Definitions pulled in from aclocal.m4. */ +#define VOID_SIGHANDLER 1 + +/* #undef GWINSZ_IN_SYS_IOCTL */ + +#define STRUCT_WINSIZE_IN_SYS_IOCTL 1 + +/* #undef STRUCT_WINSIZE_IN_TERMIOS */ + +#define TIOCSTAT_IN_SYS_IOCTL 1 + +#define FIONREAD_IN_SYS_IOCTL 1 + +/* #undef SPEED_T_IN_SYS_TYPES */ + +#define HAVE_GETPW_DECLS 1 + +/* #undef STRUCT_DIRENT_HAS_D_INO */ + +/* #undef STRUCT_DIRENT_HAS_D_FILENO */ + +/* #undef HAVE_BSD_SIGNALS */ + +#define HAVE_POSIX_SIGNALS 1 + +/* #undef HAVE_USG_SIGHOLD */ + +/* #undef MUST_REINSTALL_SIGHANDLERS */ + +#define HAVE_POSIX_SIGSETJMP 1 + +#define CTYPE_NON_ASCII 1 + +/* modify settings or make new ones based on what autoconf tells us. */ + +/* Ultrix botches type-ahead when switching from canonical to + non-canonical mode, at least through version 4.3 */ +#if !defined (HAVE_TERMIOS_H) || !defined (HAVE_TCGETATTR) || defined (ultrix) +# define TERMIOS_MISSING +#endif + +#if defined (__STDC__) && defined (HAVE_STDARG_H) +# define PREFER_STDARG +# define USE_VARARGS +#else +# if defined (HAVE_VARARGS_H) +# define PREFER_VARARGS +# define USE_VARARGS +# endif +#endif -- 2.41.0