gdb-5.3 -- some minor build problems + 3 patches
Peter Breitenlohner <[email protected]> Wed, 22 Jan 2003 17:54:19 +0100 (CET)
| Newsgroups | gmane.comp.gdb.bugs.general |
|---|---|
| Message-ID | <[email protected]> |
Hi, attached please find 3 patches for gdb-5.3 which address several minor build problems. Each patch starts whith comment which I repeat here: 1. patch-01-gdbserver-config gdbreplay.c uses `#ifdef HAVE_STDLIB_H', but configure and config.h don't define this. Consequently <stdlib.h> was not included, resulting in an "implicit declaration of `atoi'" warning. 2. patch-02-gdbserver-ldflags LDFLAGS were not propagated from gdb to gdb/gdbserver. Consequently "make LDFLAGS=-s" did produced unstripped gdbreplay and gdbserver binaries. All this wouldn't be needed, if the gdb distribution were to support "make install-strip" as most modern packages do. Unfortunately this feature has not (yet?) found its way into the cygnus type source trees (nor has DESTDIR support). 3. patch-03-gdb-readline It really is a shame that gdb still uses the outdated readline-4.1 and (sort of) insists on using the readline distributed with gdb. There really ought to be a configure option '--with-installed-readline' or similar (in particular in case where the installed library is a shared one). All that can, actually, be achieved by minor changes in gdb/Makefile, and I don't terribly care wether or not the realine distibuted with gdb is built or not -- as long as it is not used. There are, however, several incompatibilities between readline-4.1 and readline-4.[23]. The aim of this patch is to take care of these incompatibilities. With these changes gdb can be compiled with either the distributed readline-4.1 or an installed readline-4.[123] via said minor changes in gdb/Makefile. Given this patch, I would like to strongly suggest that future versions of gdb be distributed with readline-4.3, and have a configure '--with-installed-readline' option. ============================ 4. A final remark/question. Compiling libiberty for ix86-linux-gnu (with gcc-2.95.3) produces lots of warnings, a few from gdb-5.3/libiberty/regex.c but mostly from gdb-5.3/libiberty/md5. They are almost exclusively: warning: integer constant is unsigned in ANSI C, signed with -traditional Is there really no decent way to avoid all these warnings? regards Peter Breitenlohner <[email protected]> _______________________________________________ Bug-gdb mailing list [email protected] http://mail.gnu.org/mailman/listinfo/bug-gdb
patch-01-gdbserver-config
(text/plain, 1.8 KB)
gdbreplay.c uses `#ifdef HAVE_STDLIB_H', but configure and config.h
don't define this. Consequently <stdlib.h> was not included,
resulting in an "implicit declaration of `atoi'" warning.
diff -ur gdb-5.3.orig/gdb/gdbserver/config.in gdb-5.3/gdb/gdbserver/config.in
--- gdb-5.3.orig/gdb/gdbserver/config.in 2002-07-24 23:30:46.000000000 +0200
+++ gdb-5.3/gdb/gdbserver/config.in 2003-01-22 13:28:29.000000000 +0100
@@ -25,6 +25,9 @@
/* Define if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H
+/* Define if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
diff -ur gdb-5.3.orig/gdb/gdbserver/configure gdb-5.3/gdb/gdbserver/configure
--- gdb-5.3.orig/gdb/gdbserver/configure 2002-07-24 23:30:46.000000000 +0200
+++ gdb-5.3/gdb/gdbserver/configure 2003-01-22 13:28:40.000000000 +0100
@@ -1105,7 +1105,7 @@
fi
-for ac_hdr in sgtty.h termio.h termios.h sys/reg.h string.h proc_service.h sys/procfs.h thread_db.h linux/elf.h unistd.h
+for ac_hdr in sgtty.h termio.h termios.h sys/reg.h stdlib.h string.h proc_service.h sys/procfs.h thread_db.h linux/elf.h unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
diff -ur gdb-5.3.orig/gdb/gdbserver/configure.in gdb-5.3/gdb/gdbserver/configure.in
--- gdb-5.3.orig/gdb/gdbserver/configure.in 2002-07-24 23:30:46.000000000 +0200
+++ gdb-5.3/gdb/gdbserver/configure.in 2003-01-22 13:28:04.000000000 +0100
@@ -30,7 +30,7 @@
AC_HEADER_STDC
-AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
+AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h stdlib.h string.h dnl
proc_service.h sys/procfs.h thread_db.h linux/elf.h unistd.h)
. ${srcdir}/configure.srv
patch-02-gdbserver-ldflags
(text/plain, 794 B)
LDFLAGS were not propagated from gdb to gdb/gdbserver. Consequently "make LDFLAGS=-s" did produced unstripped gdbreplay and gdbserver binaries. All this wouldn't be needed, if the gdb distribution were to support "make install-strip" as most modern packages do. Unfortunately this feature has not (yet?) found its way into the cygnus type source trees (nor has DESTDIR support). diff -ur gdb-5.3.orig/gdb/Makefile.in gdb-5.3/gdb/Makefile.in --- gdb-5.3.orig/gdb/Makefile.in 2002-11-25 23:05:38.000000000 +0100 +++ gdb-5.3/gdb/Makefile.in 2003-01-22 13:58:42.000000000 +0100 @@ -437,6 +437,7 @@ "CXX=$(CXX)" \ "CXXFLAGS=$(CXXFLAGS)" \ "DLLTOOL=$(DLLTOOL)" \ + "LDFLAGS=$(LDFLAGS)" \ "RANLIB=$(RANLIB)" \ "MAKEINFO=$(MAKEINFO)" \ "MAKEHTML=$(MAKEHTML)" \
patch-03-gdb-readline
(text/plain, 6.3 KB)
It really is a shame that gdb still uses the outdated readline-4.1
and (sort of) insists on using the readline distributed with gdb.
There really ought to be a configure option
'--with-installed-readline' or similar (in particular in case where
the installed library is a shared one).
All that can, actually, be achieved by minor changes in
gdb/Makefile, and I don't terribly care wether or not the realine
distibuted with gdb is built or not -- as long as it is not used.
There are, however, several incompatibilities between readline-4.1
and readline-4.[23].
The aim of this patch is to take care of these incompatibilities.
With these changes gdb can be compiled with either the distributed
readline-4.1 or an installed readline-4.[123] via said minor changes
in gdb/Makefile.
Given this patch, I would like to strongly suggest that future
versions of gdb be distributed with readline-4.3, and have a
configure '--with-installed-readline' option.
diff -ur gdb-5.3.orig/gdb/cli/cli-cmds.c gdb-5.3/gdb/cli/cli-cmds.c
--- gdb-5.3.orig/gdb/cli/cli-cmds.c 2002-07-30 15:45:14.000000000 +0200
+++ gdb-5.3/gdb/cli/cli-cmds.c 2003-01-22 11:31:41.000000000 +0100
@@ -35,6 +35,8 @@
#include "cli/cli-setshow.h"
#include "cli/cli-cmds.h"
+#include <readline/readline.h>
+
#ifndef GDBINIT_FILENAME
#define GDBINIT_FILENAME ".gdbinit"
#endif
diff -ur gdb-5.3.orig/gdb/cli/cli-dump.c gdb-5.3/gdb/cli/cli-dump.c
--- gdb-5.3.orig/gdb/cli/cli-dump.c 2002-08-09 18:36:10.000000000 +0200
+++ gdb-5.3/gdb/cli/cli-dump.c 2003-01-22 11:31:33.000000000 +0100
@@ -32,6 +32,8 @@
#include <ctype.h>
#include "target.h"
+#include <readline/readline.h>
+
#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
diff -ur gdb-5.3.orig/gdb/cli/cli-setshow.c gdb-5.3/gdb/cli/cli-setshow.c
--- gdb-5.3.orig/gdb/cli/cli-setshow.c 2002-07-30 15:45:14.000000000 +0200
+++ gdb-5.3/gdb/cli/cli-setshow.c 2003-01-22 11:31:30.000000000 +0100
@@ -28,6 +28,8 @@
#include "cli/cli-cmds.h"
#include "cli/cli-setshow.h"
+#include <readline/readline.h>
+
/* Prototypes for local functions */
static int parse_binary_operation (char *);
diff -ur gdb-5.3.orig/gdb/completer.c gdb-5.3/gdb/completer.c
--- gdb-5.3.orig/gdb/completer.c 2002-03-24 01:40:35.000000000 +0100
+++ gdb-5.3/gdb/completer.c 2003-01-22 13:14:00.000000000 +0100
@@ -37,6 +37,11 @@
/* readline defines this. */
#undef savestring
+/* readline-4.1 backwards compatibility */
+#ifndef RL_READLINE_VERSION
+#define rl_filename_completion_function filename_completion_function
+#endif
+
#include "completer.h"
/* Prototypes for local functions */
@@ -135,7 +140,7 @@
while (1)
{
char *p;
- p = filename_completion_function (text, subsequent_name);
+ p = rl_filename_completion_function (text, subsequent_name);
if (return_val_used >= return_val_alloced)
{
return_val_alloced *= 2;
diff -ur gdb-5.3.orig/gdb/corelow.c gdb-5.3/gdb/corelow.c
--- gdb-5.3.orig/gdb/corelow.c 2002-05-18 01:06:10.000000000 +0200
+++ gdb-5.3/gdb/corelow.c 2003-01-22 11:31:35.000000000 +0100
@@ -39,6 +39,8 @@
#include "regcache.h"
#include "symfile.h"
+#include <readline/readline.h>
+
#ifndef O_BINARY
#define O_BINARY 0
#endif
diff -ur gdb-5.3.orig/gdb/defs.h gdb-5.3/gdb/defs.h
--- gdb-5.3.orig/gdb/defs.h 2002-08-01 19:18:32.000000000 +0200
+++ gdb-5.3/gdb/defs.h 2003-01-22 11:31:24.000000000 +0100
@@ -614,10 +614,6 @@
struct frame_info;
-/* From readline (but not in any readline .h files). */
-
-extern char *tilde_expand (char *);
-
/* Control types for commands */
enum misc_command_type
diff -ur gdb-5.3.orig/gdb/exec.c gdb-5.3/gdb/exec.c
--- gdb-5.3.orig/gdb/exec.c 2002-03-06 07:28:33.000000000 +0100
+++ gdb-5.3/gdb/exec.c 2003-01-22 11:31:27.000000000 +0100
@@ -48,6 +48,8 @@
#include "xcoffsolib.h"
+#include <readline/readline.h>
+
struct vmap *map_vmap (bfd *, bfd *);
void (*file_changed_hook) (char *);
diff -ur gdb-5.3.orig/gdb/solib.c gdb-5.3/gdb/solib.c
--- gdb-5.3.orig/gdb/solib.c 2002-05-12 06:20:06.000000000 +0200
+++ gdb-5.3/gdb/solib.c 2003-01-22 11:31:28.000000000 +0100
@@ -43,6 +43,8 @@
#include "solist.h"
+#include <readline/readline.h>
+
/* external data declarations */
/* FIXME: gdbarch needs to control this variable */
diff -ur gdb-5.3.orig/gdb/source.c gdb-5.3/gdb/source.c
--- gdb-5.3.orig/gdb/source.c 2002-06-11 22:36:51.000000000 +0200
+++ gdb-5.3/gdb/source.c 2003-01-22 11:31:39.000000000 +0100
@@ -45,6 +45,8 @@
#include "completer.h"
#include "ui-out.h"
+#include <readline/readline.h>
+
#ifdef CRLF_SOURCE_FILES
/* Define CRLF_SOURCE_FILES in an xm-*.h file if source files on the
diff -ur gdb-5.3.orig/gdb/symfile.c gdb-5.3/gdb/symfile.c
--- gdb-5.3.orig/gdb/symfile.c 2002-08-01 19:18:32.000000000 +0200
+++ gdb-5.3/gdb/symfile.c 2003-01-22 11:31:29.000000000 +0100
@@ -49,6 +49,8 @@
#include <ctype.h>
#include <time.h>
+#include <readline/readline.h>
+
#ifndef O_BINARY
#define O_BINARY 0
#endif
diff -ur gdb-5.3.orig/gdb/symmisc.c gdb-5.3/gdb/symmisc.c
--- gdb-5.3.orig/gdb/symmisc.c 2002-07-30 00:55:26.000000000 +0200
+++ gdb-5.3/gdb/symmisc.c 2003-01-22 11:31:36.000000000 +0100
@@ -35,6 +35,8 @@
#include "gdb_string.h"
+#include <readline/readline.h>
+
#ifndef DEV_TTY
#define DEV_TTY "/dev/tty"
#endif
diff -ur gdb-5.3.orig/gdb/top.c gdb-5.3/gdb/top.c
--- gdb-5.3.orig/gdb/top.c 2002-09-28 17:10:32.000000000 +0200
+++ gdb-5.3/gdb/top.c 2003-01-22 14:52:13.000000000 +0100
@@ -53,6 +53,13 @@
/* readline defines this. */
#undef savestring
+/* readline-4.1 backwards compatibility */
+#ifdef RL_READLINE_VERSION
+#define rl_compentry_func_ptr rl_compentry_func_t *
+#else
+#define rl_compentry_func_ptr int (*)()
+#endif
+
#include <sys/types.h>
#include <setjmp.h>
@@ -1952,7 +1959,7 @@
write_history_p = 0;
/* Setup important stuff for command line editing. */
- rl_completion_entry_function = (int (*)()) readline_line_completion_function;
+ rl_completion_entry_function = (rl_compentry_func_ptr) readline_line_completion_function;
rl_completer_word_break_characters =
get_gdb_completer_word_break_characters ();
rl_completer_quote_characters = get_gdb_completer_quote_characters ();