From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24322 invoked by alias); 14 Apr 2008 18:06:31 -0000 Received: (qmail 24185 invoked by uid 22791); 14 Apr 2008 18:06:29 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 14 Apr 2008 18:05:46 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 44012983DA; Mon, 14 Apr 2008 18:05:44 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 0932C98119; Mon, 14 Apr 2008 18:05:44 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1JlT3n-0006Bf-Ep; Mon, 14 Apr 2008 14:05:43 -0400 Date: Mon, 14 Apr 2008 18:27:00 -0000 From: Daniel Jacobowitz To: Doug Evans Cc: gdb-patches@sourceware.org Subject: Re: [RFA] lmemmem.patch Message-ID: <20080414180543.GB1968@caradoc.them.org> Mail-Followup-To: Doug Evans , gdb-patches@sourceware.org References: <200803241758.m2OHwDid017265@greed.delorie.com> <20080324203738.GC29991@ins.uni-bonn.de> <20080324205119.GE29991@ins.uni-bonn.de> <20080324212354.GA16323@caradoc.them.org> <20080330213540.GA2856@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-12-11) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-04/txt/msg00247.txt.bz2 On Mon, Mar 31, 2008 at 10:33:18AM -0700, Doug Evans wrote: > On Sun, Mar 30, 2008 at 2:35 PM, Daniel Jacobowitz wrote: > > Here you go. How does this look? It frees us to rely on gnulib's > > stdint.h, string.h, and other useful modules should we want them. I > > didn't make gdbserver completely use gnulib, only build memmem; I > > tested this on Linux (memmem present) and Windows (memmem missing). > > GDB will use the included memmem even on Linux, since glibc's is known > > to be slower. > > Great. > > [I had to touch Makefile.am before running gnulib-tool and then > immediately remove it afterwards. Hmm, I didn't. I wonder why not. > Also, gdbserver/configure.ac needs its copyright year updated.] Thanks. With that change, I have checked it in. Please let me know if it causes any problems. I forgot to mention that I manually deleted cvsignore files. Gnulib assumes you do not keep generated files in CVS, but we do. -- Daniel Jacobowitz CodeSourcery In the gdb directory, run: gnulib-tool --import --lib=libgnu --source-base=gnulib --m4-base=gnulib/m4 \ --aux-dir=gnulib/aux memmem Then apply this patch and run autoconf, aclocal, and automake (yes, automake) in the gdb subdirectory. Also run autoconf in the gdbserver directory. 2008-04-14 Daniel Jacobowitz * Makefile.in (LIBGNU, INCGNU): Define. (INTERNAL_CFLAGS_BASE): Add INCGNU. (INTERNAL_LIBS, CLIBS, CDEPS): Add LIBGNU. (CLEANDIRS): New. ($(LIBGNU), all-lib): New rules. (clean, distclean, do-maintainer-clean): Use CLEANDIRS. * configure.ac: Use gl_EARLY, gl_INIT, and AM_INIT_AUTOMAKE. Simplify AC_CONFIG_AUX_DIR. Generate gnulib/Makefile. * gnulib: New directory, from gnulib-tool. * configure, aclocal.m4: Regenerated. 2008-04-14 Daniel Jacobowitz * Makefile.in (LIBOBJS): New. (OBS): Use LIBOBJS. (memmem.o): New rule. * configure.ac: Use AC_CONFIG_LIBOBJ_DIR and check for memmem. * configure: Regenerated. ? gnulib Index: Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/Makefile.in,v retrieving revision 1.998 diff -u -p -r1.998 Makefile.in --- Makefile.in 9 Apr 2008 13:29:51 -0000 1.998 +++ Makefile.in 14 Apr 2008 18:02:01 -0000 @@ -160,6 +160,10 @@ LIBICONV = @LIBICONV@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@ TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@ +# Helper code from gnulib. +LIBGNU = gnulib/libgnu.a +INCGNU = -I$(srcdir)/gnulib -Ignulib + # # CLI sub directory definitons # @@ -364,7 +368,7 @@ INTERNAL_CFLAGS_BASE = \ $(CFLAGS) $(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) \ $(GDB_CFLAGS) $(OPCODES_CFLAGS) $(READLINE_CFLAGS) \ $(BFD_CFLAGS) $(INCLUDE_CFLAGS) $(LIBDECNUMBER_CFLAGS) \ - $(INTL_CFLAGS) $(ENABLE_CFLAGS) $(INTERNAL_CPPFLAGS) + $(INTL_CFLAGS) $(INCGNU) $(ENABLE_CFLAGS) $(INTERNAL_CPPFLAGS) INTERNAL_WARN_CFLAGS = $(INTERNAL_CFLAGS_BASE) $(GDB_WARN_CFLAGS) INTERNAL_CFLAGS = $(INTERNAL_WARN_CFLAGS) $(GDB_WERROR_CFLAGS) @@ -388,13 +392,13 @@ INTERNAL_LDFLAGS = $(CFLAGS) $(GLOBAL_CF # you can use 'CLIBS=$(INSTALLED_LIBS)' 'CDEPS=' INSTALLED_LIBS=-lbfd -lreadline -lopcodes -liberty -ldecnumber \ $(XM_CLIBS) $(TM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) @LIBS@ \ - -lintl -liberty + -lintl -liberty $(LIBGNU) CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \ $(XM_CLIBS) $(TM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) @LIBS@ \ $(LIBICONV) $(LIBEXPAT) \ - $(LIBIBERTY) $(WIN32LIBS) + $(LIBIBERTY) $(WIN32LIBS) $(LIBGNU) CDEPS = $(XM_CDEPS) $(TM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) \ - $(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) + $(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU) ADD_FILES = $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES) ADD_DEPS = $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES) @@ -1077,6 +1081,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $ TSOBS = inflow.o SUBDIRS = @subdirs@ +CLEANDIRS = $(SUBDIRS) gnulib # For now, shortcut the "configure GDB for fewer languages" stuff. YYFILES = c-exp.c \ @@ -1329,6 +1334,12 @@ $(TUI)$(EXEEXT): tui-main.o libgdb.a $(A -o $(TUI)$(EXEEXT) tui-main.o libgdb.a \ $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES) +# Convenience rule to handle recursion. +$(LIBGNU): all-lib +all-lib: + @$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS=gnulib subdir_do +.PHONY: all-lib + # Create a library of the gdb object files and build GDB by linking # against that. # @@ -1368,7 +1379,7 @@ TAGS: $(DEPFILES) $(TAGFILES_NO_SRCDIR) tags: TAGS clean mostlyclean: $(CONFIG_CLEAN) - @$(MAKE) $(FLAGS_TO_PASS) DO=clean "DODIRS=$(SUBDIRS)" subdir_do + @$(MAKE) $(FLAGS_TO_PASS) DO=clean "DODIRS=$(CLEANDIRS)" subdir_do rm -f *.o *.a $(ADD_FILES) *~ init.c-tmp init.l-tmp version.c-tmp rm -f init.c version.c rm -f gdb$(EXEEXT) core make.log @@ -1387,7 +1398,7 @@ clean-tui: # NB: While GDBSERVER might be configured on native systems, it isn't # always included in SUBDIRS. Remove the gdbserver files explicitly. distclean: clean - @$(MAKE) $(FLAGS_TO_PASS) DO=distclean "DODIRS=$(SUBDIRS)" subdir_do + @$(MAKE) $(FLAGS_TO_PASS) DO=distclean "DODIRS=$(CLEANDIRS)" subdir_do rm -f gdbserver/config.status gdbserver/config.log rm -f gdbserver/tm.h gdbserver/xm.h gdbserver/nm.h rm -f gdbserver/Makefile gdbserver/config.cache @@ -1414,7 +1425,7 @@ local-maintainer-clean: rm -f nm.h config.status do-maintainer-clean: - @$(MAKE) $(FLAGS_TO_PASS) DO=maintainer-clean "DODIRS=$(SUBDIRS)" \ + @$(MAKE) $(FLAGS_TO_PASS) DO=maintainer-clean "DODIRS=$(CLEANDIRS)" \ subdir_do diststuff: $(DISTSTUFF) $(PACKAGE).pot $(CATALOGS) Index: configure.ac =================================================================== RCS file: /cvs/src/src/gdb/configure.ac,v retrieving revision 1.66 diff -u -p -r1.66 configure.ac --- configure.ac 12 Mar 2008 14:10:53 -0000 1.66 +++ configure.ac 14 Apr 2008 18:02:03 -0000 @@ -1,6 +1,6 @@ dnl Autoconf configure script for GDB, the GNU debugger. dnl Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -dnl 2005, 2006 +dnl 2005, 2006, 2007, 2008 dnl Free Software Foundation, Inc. dnl dnl This file is part of GDB. @@ -29,9 +29,10 @@ AC_PROG_CC AC_GNU_SOURCE AC_AIX AC_ISC_POSIX +gl_EARLY AM_PROG_CC_STDC -AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..) +AC_CONFIG_AUX_DIR(..) AC_CANONICAL_SYSTEM dnl List of object files and targets accumulated by configure. @@ -59,10 +60,16 @@ if test x"$USE_NLS" = xyes; then CONFIG_UNINSTALL="$CONFIG_UNINSTALL uninstall-po" fi +gl_INIT + PACKAGE=gdb AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package. ]) AC_SUBST(PACKAGE) +# GDB does not use automake, but gnulib does. This line lets us +# generate its Makefile.in. +AM_INIT_AUTOMAKE(gdb, UNUSED-VERSION, [no-define]) + debugdir=${libdir}/debug AC_ARG_WITH(separate-debug-dir, @@ -207,8 +214,6 @@ if test "x$targ_defvec" != x; then [Define to BFD's default target vector. ]) fi -AC_ARG_PROGRAM - # The CLI cannot be disabled yet, but may be in the future. # Enable CLI. @@ -1721,7 +1726,7 @@ AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "ISO AM_ICONV -AC_OUTPUT(Makefile .gdbinit:gdbinit.in, +AC_OUTPUT(Makefile .gdbinit:gdbinit.in gnulib/Makefile, [ dnl Autoconf doesn't provide a mechanism for modifying definitions dnl provided by makefile fragments. Index: gdbserver/Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/Makefile.in,v retrieving revision 1.56 diff -u -p -r1.56 Makefile.in --- gdbserver/Makefile.in 28 Feb 2008 05:55:55 -0000 1.56 +++ gdbserver/Makefile.in 14 Apr 2008 18:02:03 -0000 @@ -136,6 +136,8 @@ SFILES= $(srcdir)/gdbreplay.c $(srcdir)/ DEPFILES = @GDBSERVER_DEPFILES@ +LIBOBJS = @LIBOBJS@ + SOURCES = $(SFILES) TAGFILES = $(SOURCES) ${HFILES} ${ALLPARAM} ${POSSLIBS} @@ -143,7 +145,7 @@ OBS = inferiors.o regcache.o remote-util utils.o version.o \ mem-break.o hostio.o \ $(XML_BUILTIN) \ - $(DEPFILES) + $(DEPFILES) $(LIBOBJS) GDBSERVER_LIBS = @GDBSERVER_LIBS@ XM_CLIBS = @LIBS@ @@ -289,6 +291,9 @@ utils.o: utils.c $(server_h) signals.o: ../signals/signals.c $(server_h) $(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER +memmem.o: ../gnulib/memmem.c + $(CC) -o memmem.o -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< + i387-fp.o: i387-fp.c $(server_h) linux_low_h = $(srcdir)/linux-low.h Index: gdbserver/configure.ac =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/configure.ac,v retrieving revision 1.21 diff -u -p -r1.21 configure.ac --- gdbserver/configure.ac 28 Feb 2008 05:54:09 -0000 1.21 +++ gdbserver/configure.ac 14 Apr 2008 18:02:03 -0000 @@ -1,5 +1,5 @@ dnl Autoconf configure script for GDB server. -dnl Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006 +dnl Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008 dnl Free Software Foundation, Inc. dnl dnl This file is part of GDB. @@ -23,6 +23,7 @@ AC_PREREQ(2.59)dnl AC_INIT(server.c) AC_CONFIG_HEADER(config.h:config.in) +AC_CONFIG_LIBOBJ_DIR(../gnulib) AC_PROG_CC AC_GNU_SOURCE @@ -42,6 +43,7 @@ AC_CHECK_HEADERS(sgtty.h termio.h termio sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl netinet/tcp.h arpa/inet.h sys/wait.h) AC_CHECK_FUNCS(pread pwrite pread64) +AC_REPLACE_FUNCS(memmem) have_errno=no AC_MSG_CHECKING(for errno)