Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: [RFA] lmemmem.patch
@ 2008-04-14 19:14 Aleksandar Ristovski
  2008-04-14 20:00 ` Daniel Jacobowitz
  0 siblings, 1 reply; 21+ messages in thread
From: Aleksandar Ristovski @ 2008-04-14 19:14 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Doug Evans, gdb-patches

Daniel Jacobowitz wrote:
> 
> Try now?  I forgot to use -I gnulib/m4 for aclocal.
> 
Passed that point, but now does this:

gcc -c -g -O2   -I. -I../../src/gdb -I../../src/gdb/config 
-DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H 
-I../../src/gdb/../include/opcode -I../../src/gdb/../readline/.. -I../bfd 
-I../../src/gdb/../bfd -I../../src/gdb/../include -I../libdecnumber 
-I../../src/gdb/../libdecnumber  -I../../src/gdb/gnulib -Ignulib  -DMI_OUT=1

-DTUI=1  -Wall -Wdeclaration-after-statement -Wpointer-arith
-Wformat-nonliteral 
-Wno-pointer-sign -Wno-unused -Wno-switch -Wno-char-subscripts -Werror 
../../src/gdb/tui/tui-main.c
In file included from ../../src/gdb/gdb_string.h:25,
                  from ../../src/gdb/tui/tui-main.c:22:
gnulib/string.h:78:5: error: #if with no expression
gnulib/string.h:98:5: error: #if with no expression
...

and (when tui disabled):
In file included from ../../src/gdb/gdb_string.h:25,
                  from ../../src/gdb/gdb.c:21:
gnulib/string.h:78:5: error: #if with no expression
...




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA] lmemmem.patch
  2008-04-14 19:14 [RFA] lmemmem.patch Aleksandar Ristovski
@ 2008-04-14 20:00 ` Daniel Jacobowitz
  0 siblings, 0 replies; 21+ messages in thread
From: Daniel Jacobowitz @ 2008-04-14 20:00 UTC (permalink / raw)
  To: Aleksandar Ristovski; +Cc: Doug Evans, gdb-patches

On Mon, Apr 14, 2008 at 03:13:15PM -0400, Aleksandar Ristovski wrote:
> In file included from ../../src/gdb/gdb_string.h:25,
>                   from ../../src/gdb/tui/tui-main.c:22:
> gnulib/string.h:78:5: error: #if with no expression
> gnulib/string.h:98:5: error: #if with no expression
> ...

Boo, I forgot to run autoheader.  And I botched running automake by
not rerunning it after aclocal.  And the dependencies are wrong.

Checked in the attached.  Please tell me this works better...

-- 
Daniel Jacobowitz
CodeSourcery

2008-04-14  Daniel Jacobowitz  <dan@codesourcery.com>

	* Makefile.in (GNULIB_H): New.  Trigger all-lib.
	(defs_h): Use $(GNULIB_H).
	(all-lib): Depend on gnulib/Makefile.
	(gnulib/Makefile): Regenerate gnulib/Makefile and gnulib/.deps.
	* config.in, gnulib/Makefile.in: Regenerated.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.999
diff -u -p -r1.999 Makefile.in
--- Makefile.in	14 Apr 2008 18:04:00 -0000	1.999
+++ Makefile.in	14 Apr 2008 19:46:21 -0000
@@ -164,6 +164,10 @@ TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYST
 LIBGNU = gnulib/libgnu.a
 INCGNU = -I$(srcdir)/gnulib -Ignulib
 
+# Generated headers in the gnulib directory.  These must be listed
+# so that they are generated before other files are compiled.
+GNULIB_H = gnulib/string.h
+
 #
 # CLI sub directory definitons
 #
@@ -754,9 +758,10 @@ completer_h = completer.h
 cp_abi_h = cp-abi.h
 cp_support_h = cp-support.h $(symtab_h)
 dcache_h = dcache.h
+# Depend on $(GNULIB_H), since generated files are created in the gnulib build.
 defs_h = defs.h $(config_h) $(ansidecl_h) $(gdb_locale_h) $(gdb_signals_h) \
 	$(libiberty_h) $(bfd_h) $(ui_file_h) $(nm_h) \
-	$(fopen_bin_h) $(gdbarch_h)
+	$(fopen_bin_h) $(gdbarch_h) $(GNULIB_H)
 dictionary_h = dictionary.h
 disasm_h = disasm.h
 doublest_h = doublest.h $(floatformat_h)
@@ -1335,8 +1340,8 @@ $(TUI)$(EXEEXT): tui-main.o libgdb.a $(A
 		$(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES)
 
 # Convenience rule to handle recursion.
-$(LIBGNU): all-lib
-all-lib:
+$(LIBGNU) $(GNULIB_H): all-lib
+all-lib: gnulib/Makefile
 	@$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS=gnulib subdir_do
 .PHONY: all-lib
 
@@ -1442,11 +1447,18 @@ subdir_do: force
 
 Makefile: Makefile.in config.status @frags@
 	# Regenerate the Makefile and the tm.h / nm.h links.
-	CONFIG_FILES=Makefile \
+	CONFIG_FILES="Makefile" \
 	  CONFIG_COMMANDS= \
 	  CONFIG_HEADERS= \
 	  $(SHELL) config.status
 
+gnulib/Makefile: gnulib/Makefile.in gnulib/Makefile.in config.status @frags@
+	CONFIG_FILES="gnulib/Makefile" \
+	  CONFIG_COMMANDS="depfiles" \
+	  CONFIG_HEADERS= \
+	  CONFIG_LINKS= \
+	  $(SHELL) config.status
+
 config.h: stamp-h ; @true
 stamp-h: config.in config.status
 	CONFIG_HEADERS=config.h:config.in \


^ permalink raw reply	[flat|nested] 21+ messages in thread

* RE: [RFA] lmemmem.patch
  2008-04-15 17:14                                       ` 'Daniel Jacobowitz'
@ 2008-04-15 18:07                                         ` Pierre Muller
  0 siblings, 0 replies; 21+ messages in thread
From: Pierre Muller @ 2008-04-15 18:07 UTC (permalink / raw)
  To: 'Daniel Jacobowitz'; +Cc: gdb-patches



Yes, the problem is now fixed.

Thanks,


Pierre Muller
Pascal language support maintainer for GDB


-----Message d'origine-----
De : gdb-patches-owner@sourceware.org
[mailto:gdb-patches-owner@sourceware.org] De la part de 'Daniel Jacobowitz'
Envoyé : Tuesday, April 15, 2008 5:31 PM
À : Pierre Muller
Cc : gdb-patches@sourceware.org
Objet : Re: [RFA] lmemmem.patch

On Tue, Apr 15, 2008 at 05:25:40PM +0200, Pierre Muller wrote:
> I just tried this:
> 
> cvs  -d ... co gdb
> 
> It still fails at gnulib/aux
> 
> U src/gdb/gnulib/str-two-way.h
> U src/gdb/gnulib/string.in.h
> U src/gdb/gnulib/wchar.in.h
> cvs [checkout aborted]: could not chdir to src/gdb/gnulib/aux: Not a
> directory

It should work now.

-- 
Daniel Jacobowitz
CodeSourcery




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA] lmemmem.patch
  2008-04-15 15:40                                     ` Pierre Muller
@ 2008-04-15 17:14                                       ` 'Daniel Jacobowitz'
  2008-04-15 18:07                                         ` Pierre Muller
  0 siblings, 1 reply; 21+ messages in thread
From: 'Daniel Jacobowitz' @ 2008-04-15 17:14 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

On Tue, Apr 15, 2008 at 05:25:40PM +0200, Pierre Muller wrote:
> I just tried this:
> 
> cvs  -d ... co gdb
> 
> It still fails at gnulib/aux
> 
> U src/gdb/gnulib/str-two-way.h
> U src/gdb/gnulib/string.in.h
> U src/gdb/gnulib/wchar.in.h
> cvs [checkout aborted]: could not chdir to src/gdb/gnulib/aux: Not a
> directory

It should work now.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 21+ messages in thread

* RE: [RFA] lmemmem.patch
  2008-04-15 14:57                                   ` Daniel Jacobowitz
@ 2008-04-15 15:40                                     ` Pierre Muller
  2008-04-15 17:14                                       ` 'Daniel Jacobowitz'
  0 siblings, 1 reply; 21+ messages in thread
From: Pierre Muller @ 2008-04-15 15:40 UTC (permalink / raw)
  To: 'Daniel Jacobowitz'; +Cc: gdb-patches

I just tried this:

cvs  -d ... co gdb

It still fails at gnulib/aux

U src/gdb/gnulib/str-two-way.h
U src/gdb/gnulib/string.in.h
U src/gdb/gnulib/wchar.in.h
cvs [checkout aborted]: could not chdir to src/gdb/gnulib/aux: Not a
directory

Pierre@d620-muller ~/gdbcvs
$ Write failed flushing stdout buffer.
write stdout: Broken pipe



Pierre Muller
Pascal language support maintainer for GDB




-----Message d'origine-----
De : Daniel Jacobowitz [mailto:drow@false.org] 
Envoyé : Tuesday, April 15, 2008 4:40 PM
À : Pierre Muller
Cc : gdb-patches@sourceware.org
Objet : Re: [RFA] lmemmem.patch

On Tue, Apr 15, 2008 at 03:15:41PM +0200, Pierre Muller wrote:
> Not really,
> if I try 'cvs up -d -P' after
> it tries again to regenerate the 'aux' directory :(

Could you please try a clean checkout of GDB, into a new directory?

I think it will still break, and we'll have to remove the directory
from the repository.  I can do that, but I'd like to make sure it's
necessary first.

-- 
Daniel Jacobowitz
CodeSourcery




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA] lmemmem.patch
  2008-04-15 14:12                                 ` Pierre Muller
  2008-04-15 14:44                                   ` Corinna Vinschen
@ 2008-04-15 14:57                                   ` Daniel Jacobowitz
  2008-04-15 15:40                                     ` Pierre Muller
  1 sibling, 1 reply; 21+ messages in thread
From: Daniel Jacobowitz @ 2008-04-15 14:57 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

On Tue, Apr 15, 2008 at 03:15:41PM +0200, Pierre Muller wrote:
> Not really,
> if I try 'cvs up -d -P' after
> it tries again to regenerate the 'aux' directory :(

Could you please try a clean checkout of GDB, into a new directory?

I think it will still break, and we'll have to remove the directory
from the repository.  I can do that, but I'd like to make sure it's
necessary first.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA] lmemmem.patch
  2008-04-15 14:12                                 ` Pierre Muller
@ 2008-04-15 14:44                                   ` Corinna Vinschen
  2008-04-15 14:57                                   ` Daniel Jacobowitz
  1 sibling, 0 replies; 21+ messages in thread
From: Corinna Vinschen @ 2008-04-15 14:44 UTC (permalink / raw)
  To: gdb-patches

On Apr 15 15:15, Pierre Muller wrote:
> Not really,
> if I try 'cvs up -d -P' after
> it tries again to regenerate the 'aux' directory :(

Don't do that.  Call `cvs up -P; cvs up -d extra' for now.  I agree
that the aux dir should be removed manually from the CVS repository.


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


^ permalink raw reply	[flat|nested] 21+ messages in thread

* RE: [RFA] lmemmem.patch
  2008-04-15 13:37                               ` Corinna Vinschen
@ 2008-04-15 14:12                                 ` Pierre Muller
  2008-04-15 14:44                                   ` Corinna Vinschen
  2008-04-15 14:57                                   ` Daniel Jacobowitz
  0 siblings, 2 replies; 21+ messages in thread
From: Pierre Muller @ 2008-04-15 14:12 UTC (permalink / raw)
  To: gdb-patches

Not really,
if I try 'cvs up -d -P' after
it tries again to regenerate the 'aux' directory :(

I checked, there is no 'aux' entry in 
my local gdb/gnulib/CVS/Entries file.


Pierre Muller
Pascal language support maintainer for GDB






^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA] lmemmem.patch
  2008-04-15 13:15                             ` Pierre Muller
@ 2008-04-15 13:37                               ` Corinna Vinschen
  2008-04-15 14:12                                 ` Pierre Muller
  0 siblings, 1 reply; 21+ messages in thread
From: Corinna Vinschen @ 2008-04-15 13:37 UTC (permalink / raw)
  To: gdb-patches

On Apr 15 15:02, Pierre Muller wrote:
>  Thanks,
> using
> 'cvs up -d extra' in gdb/gnulib
> worked.
> Nevertheless, using
> 'cvs up -d' still fails...
> cvs is still trying to create aux directory...

Does `cvs up -P' help?


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


^ permalink raw reply	[flat|nested] 21+ messages in thread

* RE: [RFA] lmemmem.patch
  2008-04-15 13:08                           ` 'Daniel Jacobowitz'
@ 2008-04-15 13:15                             ` Pierre Muller
  2008-04-15 13:37                               ` Corinna Vinschen
  0 siblings, 1 reply; 21+ messages in thread
From: Pierre Muller @ 2008-04-15 13:15 UTC (permalink / raw)
  To: 'Daniel Jacobowitz'; +Cc: 'Doug Evans', gdb-patches

 Thanks,
using
'cvs up -d extra' in gdb/gnulib
worked.
Nevertheless, using
'cvs up -d' still fails...
cvs is still trying to create aux directory...

  I suspect that the only solution is to 
delete the aux directory in the cvs repository directly :(


Pierre Muller
Pascal language support maintainer for GDB






^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA] lmemmem.patch
  2008-04-15 11:55                         ` Pierre Muller
  2008-04-15 11:59                           ` Corinna Vinschen
@ 2008-04-15 13:08                           ` 'Daniel Jacobowitz'
  2008-04-15 13:15                             ` Pierre Muller
  1 sibling, 1 reply; 21+ messages in thread
From: 'Daniel Jacobowitz' @ 2008-04-15 13:08 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'Doug Evans', gdb-patches

On Tue, Apr 15, 2008 at 01:34:15PM +0200, Pierre Muller wrote:
>  Hi Daniel,
> 
>   I have a problem for gnulib on cygwin:
> 'aux' seems to be a reserved name for Microsoft Windows OS
> (at least XP, but it probably comes right from Dos...)
> Thus when I do a 'cvs up -d'
> in gdb directory, it fails to
> create the gnulib/aux subdirectory.
> 
>   I can still compile Cygwin GDB but
> I was wondering if it could become a problem
> later, if gnulib becomes required.
> 
> 
> Is there any solution for this?

Whoops.  Sure, this is easy to fix.  This patch (applied) moves the
file to gnulib/extra/.

-- 
Daniel Jacobowitz
CodeSourcery

2008-04-15  Daniel Jacobowitz  <dan@codesourcery.com>

	* gnulib/Makefile.am, gnulib/m4/gnulib-cache.m4,
	gnulib/aux/link-warning.h, gnulib/extra/link-warning.h: Adjust
	by rerunning gnulib-tool with --aux-dir=gnulib/extra.
	* gnulib/Makefile.in: Regenerate.

Index: gnulib/Makefile.am
===================================================================
RCS file: /cvs/src/src/gdb/gnulib/Makefile.am,v
retrieving revision 1.1
diff -u -p -r1.1 Makefile.am
--- gnulib/Makefile.am	14 Apr 2008 18:05:12 -0000	1.1
+++ gnulib/Makefile.am	15 Apr 2008 12:49:10 -0000
@@ -9,7 +9,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=gnulib/m4 --doc-base=doc --aux-dir=gnulib/aux --no-libtool --macro-prefix=gl memmem
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=gnulib/m4 --doc-base=doc --aux-dir=gnulib/extra --no-libtool --macro-prefix=gl memmem
 
 AUTOMAKE_OPTIONS = 1.5 gnits
 
@@ -36,9 +36,9 @@ EXTRA_libgnu_a_SOURCES =
 
 ## begin gnulib module link-warning
 
-LINK_WARNING_H=$(top_srcdir)/gnulib/aux/link-warning.h
+LINK_WARNING_H=$(top_srcdir)/gnulib/extra/link-warning.h
 
-EXTRA_DIST += $(top_srcdir)/gnulib/aux/link-warning.h
+EXTRA_DIST += $(top_srcdir)/gnulib/extra/link-warning.h
 
 ## end   gnulib module link-warning
 
Index: gnulib/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/gnulib/Makefile.in,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile.in
--- gnulib/Makefile.in	14 Apr 2008 19:47:29 -0000	1.2
+++ gnulib/Makefile.in	15 Apr 2008 12:49:10 -0000
@@ -23,7 +23,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=gnulib/m4 --doc-base=doc --aux-dir=gnulib/aux --no-libtool --macro-prefix=gl memmem
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=gnulib/m4 --doc-base=doc --aux-dir=gnulib/extra --no-libtool --macro-prefix=gl memmem
 
 
 
@@ -390,8 +390,9 @@ AUTOMAKE_OPTIONS = 1.5 gnits
 noinst_HEADERS = 
 noinst_LIBRARIES = libgnu.a
 noinst_LTLIBRARIES = 
-EXTRA_DIST = $(top_srcdir)/gnulib/aux/link-warning.h memchr.c memcmp.c \
-	memmem.c str-two-way.h stdint.in.h string.in.h wchar.in.h
+EXTRA_DIST = $(top_srcdir)/gnulib/extra/link-warning.h memchr.c \
+	memcmp.c memmem.c str-two-way.h stdint.in.h string.in.h \
+	wchar.in.h
 BUILT_SOURCES = $(STDINT_H) string.h $(WCHAR_H)
 SUFFIXES = 
 MOSTLYCLEANFILES = core *.stackdump stdint.h stdint.h-t string.h \
@@ -405,7 +406,7 @@ libgnu_a_SOURCES = dummy.c
 libgnu_a_LIBADD = $(gl_LIBOBJS)
 libgnu_a_DEPENDENCIES = $(gl_LIBOBJS)
 EXTRA_libgnu_a_SOURCES = memchr.c memcmp.c memmem.c
-LINK_WARNING_H = $(top_srcdir)/gnulib/aux/link-warning.h
+LINK_WARNING_H = $(top_srcdir)/gnulib/extra/link-warning.h
 all: $(BUILT_SOURCES)
 	$(MAKE) $(AM_MAKEFLAGS) all-am
 
@@ -532,7 +533,7 @@ distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
 distdir: $(DISTFILES)
-	$(mkdir_p) $(distdir)/$(top_srcdir)/gnulib/aux
+	$(mkdir_p) $(distdir)/$(top_srcdir)/gnulib/extra
 	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
 	list='$(DISTFILES)'; for file in $$list; do \
Index: gnulib/aux/link-warning.h
===================================================================
RCS file: gnulib/aux/link-warning.h
diff -N gnulib/aux/link-warning.h
--- gnulib/aux/link-warning.h	14 Apr 2008 18:05:12 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,28 +0,0 @@
-/* GL_LINK_WARNING("literal string") arranges to emit the literal string as
-   a linker warning on most glibc systems.
-   We use a linker warning rather than a preprocessor warning, because
-   #warning cannot be used inside macros.  */
-#ifndef GL_LINK_WARNING
-  /* This works on platforms with GNU ld and ELF object format.
-     Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
-     Testing __ELF__ guarantees the ELF object format.
-     Testing __GNUC__ is necessary for the compound expression syntax.  */
-# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
-#  define GL_LINK_WARNING(message) \
-     GL_LINK_WARNING1 (__FILE__, __LINE__, message)
-#  define GL_LINK_WARNING1(file, line, message) \
-     GL_LINK_WARNING2 (file, line, message)  /* macroexpand file and line */
-#  define GL_LINK_WARNING2(file, line, message) \
-     GL_LINK_WARNING3 (file ":" #line ": warning: " message)
-#  define GL_LINK_WARNING3(message) \
-     ({ static const char warning[sizeof (message)]		\
-          __attribute__ ((__unused__,				\
-                          __section__ (".gnu.warning"),		\
-                          __aligned__ (1)))			\
-          = message "\n";					\
-        (void)0;						\
-     })
-# else
-#  define GL_LINK_WARNING(message) ((void) 0)
-# endif
-#endif
Index: gnulib/extra/link-warning.h
===================================================================
RCS file: gnulib/extra/link-warning.h
diff -N gnulib/extra/link-warning.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnulib/extra/link-warning.h	15 Apr 2008 12:49:10 -0000
@@ -0,0 +1,28 @@
+/* GL_LINK_WARNING("literal string") arranges to emit the literal string as
+   a linker warning on most glibc systems.
+   We use a linker warning rather than a preprocessor warning, because
+   #warning cannot be used inside macros.  */
+#ifndef GL_LINK_WARNING
+  /* This works on platforms with GNU ld and ELF object format.
+     Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
+     Testing __ELF__ guarantees the ELF object format.
+     Testing __GNUC__ is necessary for the compound expression syntax.  */
+# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
+#  define GL_LINK_WARNING(message) \
+     GL_LINK_WARNING1 (__FILE__, __LINE__, message)
+#  define GL_LINK_WARNING1(file, line, message) \
+     GL_LINK_WARNING2 (file, line, message)  /* macroexpand file and line */
+#  define GL_LINK_WARNING2(file, line, message) \
+     GL_LINK_WARNING3 (file ":" #line ": warning: " message)
+#  define GL_LINK_WARNING3(message) \
+     ({ static const char warning[sizeof (message)]		\
+          __attribute__ ((__unused__,				\
+                          __section__ (".gnu.warning"),		\
+                          __aligned__ (1)))			\
+          = message "\n";					\
+        (void)0;						\
+     })
+# else
+#  define GL_LINK_WARNING(message) ((void) 0)
+# endif
+#endif
Index: gnulib/m4/gnulib-cache.m4
===================================================================
RCS file: /cvs/src/src/gdb/gnulib/m4/gnulib-cache.m4,v
retrieving revision 1.1
diff -u -p -r1.1 gnulib-cache.m4
--- gnulib/m4/gnulib-cache.m4	14 Apr 2008 18:05:12 -0000	1.1
+++ gnulib/m4/gnulib-cache.m4	15 Apr 2008 12:49:10 -0000
@@ -15,7 +15,7 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=gnulib/m4 --doc-base=doc --aux-dir=gnulib/aux --no-libtool --macro-prefix=gl memmem
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=gnulib/m4 --doc-base=doc --aux-dir=gnulib/extra --no-libtool --macro-prefix=gl memmem
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA] lmemmem.patch
  2008-04-15 11:55                         ` Pierre Muller
@ 2008-04-15 11:59                           ` Corinna Vinschen
  2008-04-15 13:08                           ` 'Daniel Jacobowitz'
  1 sibling, 0 replies; 21+ messages in thread
From: Corinna Vinschen @ 2008-04-15 11:59 UTC (permalink / raw)
  To: gdb-patches

On Apr 15 13:34, Pierre Muller wrote:
>  Hi Daniel,
> 
>   I have a problem for gnulib on cygwin:
> 'aux' seems to be a reserved name for Microsoft Windows OS
> (at least XP, but it probably comes right from Dos...)

Yes, it's a reserved DOS file name.  This will be no problem anymore
with the next major version of Cygwin, but it is a problem for all
native Windows tools.  No filename part must be AUX or PRN or COM[1-9],
or NUL and a few more.


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


^ permalink raw reply	[flat|nested] 21+ messages in thread

* RE: [RFA] lmemmem.patch
  2008-04-14 18:27                       ` Daniel Jacobowitz
@ 2008-04-15 11:55                         ` Pierre Muller
  2008-04-15 11:59                           ` Corinna Vinschen
  2008-04-15 13:08                           ` 'Daniel Jacobowitz'
  0 siblings, 2 replies; 21+ messages in thread
From: Pierre Muller @ 2008-04-15 11:55 UTC (permalink / raw)
  To: 'Daniel Jacobowitz', 'Doug Evans'; +Cc: gdb-patches

 Hi Daniel,

  I have a problem for gnulib on cygwin:
'aux' seems to be a reserved name for Microsoft Windows OS
(at least XP, but it probably comes right from Dos...)
Thus when I do a 'cvs up -d'
in gdb directory, it fails to
create the gnulib/aux subdirectory.

  I can still compile Cygwin GDB but
I was wondering if it could become a problem
later, if gnulib becomes required.


Is there any solution for this?

Thanks in advance,




Pierre Muller
Pascal language support maintainer for GDB






^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA] lmemmem.patch
@ 2008-04-14 23:46 Aleksandar Ristovski
  0 siblings, 0 replies; 21+ messages in thread
From: Aleksandar Ristovski @ 2008-04-14 23:46 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Doug Evans, gdb-patches

Daniel Jacobowitz wrote:
> 
> Checked in the attached.  Please tell me this works better...
> 
Worked fine!

Thanks!


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA] lmemmem.patch
  2008-04-14 18:59 Aleksandar Ristovski
@ 2008-04-14 19:13 ` Daniel Jacobowitz
  0 siblings, 0 replies; 21+ messages in thread
From: Daniel Jacobowitz @ 2008-04-14 19:13 UTC (permalink / raw)
  To: Aleksandar Ristovski; +Cc: Doug Evans, gdb-patches

On Mon, Apr 14, 2008 at 02:56:39PM -0400, Aleksandar Ristovski wrote:
> Daniel Jacobowitz wrote:
> > Thanks.  With that change, I have checked it in.  Please let me know
> > if it causes any problems.
> >
> >   
> Maybe it's just me, but it doesn't build for me any more:
> 
> /space/src/gdb_HEAD/WRITABLE/src/gdb/configure: line 3033: gl_INIT: 
> command not found
> checking for a BSD-compatible install... /usr/bin/install -c
> checking whether build environment is sane... configure: error: newly 
> created file is older than distributed files!

Try now?  I forgot to use -I gnulib/m4 for aclocal.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA] lmemmem.patch
@ 2008-04-14 18:59 Aleksandar Ristovski
  2008-04-14 19:13 ` Daniel Jacobowitz
  0 siblings, 1 reply; 21+ messages in thread
From: Aleksandar Ristovski @ 2008-04-14 18:59 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Doug Evans, gdb-patches

Daniel Jacobowitz wrote:
> Thanks.  With that change, I have checked it in.  Please let me know
> if it causes any problems.
>
>   
Maybe it's just me, but it doesn't build for me any more:

/space/src/gdb_HEAD/WRITABLE/src/gdb/configure: line 3033: gl_INIT: 
command not found
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... configure: error: newly 
created file is older than distributed files!



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA] lmemmem.patch
  2008-03-31 18:35                     ` Doug Evans
@ 2008-04-14 18:27                       ` Daniel Jacobowitz
  2008-04-15 11:55                         ` Pierre Muller
  0 siblings, 1 reply; 21+ messages in thread
From: Daniel Jacobowitz @ 2008-04-14 18:27 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

On Mon, Mar 31, 2008 at 10:33:18AM -0700, Doug Evans wrote:
> On Sun, Mar 30, 2008 at 2:35 PM, Daniel Jacobowitz <drow@false.org> 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  <dan@codesourcery.com>

	* 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  <dan@codesourcery.com>

	* 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)


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA] lmemmem.patch
  2008-04-09 23:04                     ` Doug Evans
@ 2008-04-10  5:31                       ` Daniel Jacobowitz
  0 siblings, 0 replies; 21+ messages in thread
From: Daniel Jacobowitz @ 2008-04-10  5:31 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

On Wed, Apr 09, 2008 at 03:17:05PM -0700, Doug Evans wrote:
> On Sun, Mar 30, 2008 at 2:35 PM, Daniel Jacobowitz <drow@false.org> 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.
> 
> Hi.  Can you check this in?

Yeah, sorry.  Not having seen any objections, I will do so (tomorrow
morning).

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA] lmemmem.patch
  2008-03-30 21:37                   ` Daniel Jacobowitz
  2008-03-31 18:35                     ` Doug Evans
@ 2008-04-09 23:04                     ` Doug Evans
  2008-04-10  5:31                       ` Daniel Jacobowitz
  1 sibling, 1 reply; 21+ messages in thread
From: Doug Evans @ 2008-04-09 23:04 UTC (permalink / raw)
  To: gdb-patches

On Sun, Mar 30, 2008 at 2:35 PM, Daniel Jacobowitz <drow@false.org> 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.

Hi.  Can you check this in?


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA] lmemmem.patch
  2008-03-30 21:37                   ` Daniel Jacobowitz
@ 2008-03-31 18:35                     ` Doug Evans
  2008-04-14 18:27                       ` Daniel Jacobowitz
  2008-04-09 23:04                     ` Doug Evans
  1 sibling, 1 reply; 21+ messages in thread
From: Doug Evans @ 2008-03-31 18:35 UTC (permalink / raw)
  To: gdb-patches

On Sun, Mar 30, 2008 at 2:35 PM, Daniel Jacobowitz <drow@false.org> 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.
Also, gdbserver/configure.ac needs its copyright year updated.]


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA] lmemmem.patch
       [not found]                 ` <e394668d0803241436w5160a2dfodd33d44b174cb9bf@mail.gmail.com>
@ 2008-03-30 21:37                   ` Daniel Jacobowitz
  2008-03-31 18:35                     ` Doug Evans
  2008-04-09 23:04                     ` Doug Evans
  0 siblings, 2 replies; 21+ messages in thread
From: Daniel Jacobowitz @ 2008-03-30 21:37 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

On Mon, Mar 24, 2008 at 02:36:13PM -0700, Doug Evans wrote:
> On Mon, Mar 24, 2008 at 2:23 PM, Daniel Jacobowitz <drow@false.org> wrote:
> >  I have been thinking of adding support in the GDB build process to use
> >  gnulib directly.  I even have a patch.  I put it under the GDB
> >  subdirectory precisely to minimize integration and keeping-in-sync
> >  issues with libiberty; gnulib-tool makes it easy to update.
> 
> [for completeness' sake]
> 
> If/when you do this, make sure gdbserver can use the code too.

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.

-- 
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-03-30  Daniel Jacobowitz  <dan@codesourcery.com>

	* 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-03-30  Daniel Jacobowitz  <dan@codesourcery.com>

	* Makefile.in (LIBOBJS): New.
	(OBS): Use LIBOBJS.
	(memmem.o): New rule.
	* configure.ac: Use AC_CONFIG_LIBOBJ_DIR and check for memmem.
	* configure: Regenerated.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.996
diff -u -p -r1.996 Makefile.in
--- Makefile.in	26 Mar 2008 14:53:28 -0000	1.996
+++ Makefile.in	30 Mar 2008 21:28:20 -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	30 Mar 2008 21:28:20 -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	30 Mar 2008 21:28:20 -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	30 Mar 2008 21:28:20 -0000
@@ -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)


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2008-04-15 15:40 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-14 19:14 [RFA] lmemmem.patch Aleksandar Ristovski
2008-04-14 20:00 ` Daniel Jacobowitz
  -- strict thread matches above, loose matches on Subject: below --
2008-04-14 23:46 Aleksandar Ristovski
2008-04-14 18:59 Aleksandar Ristovski
2008-04-14 19:13 ` Daniel Jacobowitz
     [not found] <200803241737.m2OHbgC8016762@greed.delorie.com>
     [not found] ` <e394668d0803241050w6a1f341u585fb4906135a44b@mail.gmail.com>
     [not found]   ` <200803241758.m2OHwDid017265@greed.delorie.com>
     [not found]     ` <e394668d0803241333nedb753j9b7b1593c6d3989f@mail.gmail.com>
     [not found]       ` <20080324203738.GC29991@ins.uni-bonn.de>
     [not found]         ` <e394668d0803241346h5006b63du8997cf9e081dc907@mail.gmail.com>
     [not found]           ` <20080324205119.GE29991@ins.uni-bonn.de>
     [not found]             ` <e394668d0803241420w3db1813bj4aa7803b74f3d40b@mail.gmail.com>
     [not found]               ` <20080324212354.GA16323@caradoc.them.org>
     [not found]                 ` <e394668d0803241436w5160a2dfodd33d44b174cb9bf@mail.gmail.com>
2008-03-30 21:37                   ` Daniel Jacobowitz
2008-03-31 18:35                     ` Doug Evans
2008-04-14 18:27                       ` Daniel Jacobowitz
2008-04-15 11:55                         ` Pierre Muller
2008-04-15 11:59                           ` Corinna Vinschen
2008-04-15 13:08                           ` 'Daniel Jacobowitz'
2008-04-15 13:15                             ` Pierre Muller
2008-04-15 13:37                               ` Corinna Vinschen
2008-04-15 14:12                                 ` Pierre Muller
2008-04-15 14:44                                   ` Corinna Vinschen
2008-04-15 14:57                                   ` Daniel Jacobowitz
2008-04-15 15:40                                     ` Pierre Muller
2008-04-15 17:14                                       ` 'Daniel Jacobowitz'
2008-04-15 18:07                                         ` Pierre Muller
2008-04-09 23:04                     ` Doug Evans
2008-04-10  5:31                       ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox