From ext.jussieu.fr!jussieu.fr!univ-lyon1.fr!howland.erols.net!newsxfer.itd.umich.edu!uunet!in2.uu.net!relay4.uu.net!wendy-fate.uu.net!bug-gdb Sat Mar 15 03:57:45 1997
x-gateway: relay4.UU.NET from bug-gdb to gnu.gdb.bug; Fri, 14 Mar 1997 13:38:46 EST
From: fnf@fishpond.ninemoons.com (Fred Fish)
Message-ID: <199703141844.LAA26566@fishpond.ninemoons.com>
Subject: Re: gdb-4.16 support for i586-unknown-linux with glibc2.0.1?
Date: Fri, 14 Mar 1997 11:44:29 -0700
Content-Type: text
Approved: bug-gdb-request@prep.ai.mit.edu
Newsgroups: gnu.gdb.bug
Path: ext.jussieu.fr!jussieu.fr!univ-lyon1.fr!howland.erols.net!newsxfer.itd.umich.edu!uunet!in2.uu.net!relay4.uu.net!wendy-fate.uu.net!bug-gdb
Sender: bug-gdb-request@prep.ai.mit.edu
Lines: 177

> Hi, I was wondering if there are any patches which allow recent
> version of gdb to work with glibc2.0.1 under linux on an ix86 platform?
> When I build gdb with 'config i586-unknown-linux', the executable
> compiles cleanly.  Execution results in 
> 
> gdb internal error: Memory
> corruption
> Quit

Try this patch:

Index: ChangeLog
===================================================================
RCS file: /cvs/cvsfiles/devo/mmalloc/ChangeLog,v
retrieving revision 1.69
diff -c -r1.69 ChangeLog
*** ChangeLog	1996/10/03 06:44:20	1.69
--- ChangeLog	1996/12/28 22:28:53
***************
*** 1,3 ****
--- 1,15 ----
+ Sat Dec 28 12:48:32 1996  Fred Fish  <fnf@cygnus.com>
+ 
+ 	* Makefile.in (mm.o): New target that combines all the functions
+ 	into a single object module.  This avoids client programs picking
+  	up part of the allocation routines from mmalloc and part from libc,
+  	which can lead to undefined behavior.
+ 	(CFILES): Add mm.c
+ 	(TARGETOBJS): Define to be either the individual objects or the
+ 	single combined object.
+ 	(TARGETLIB): Create the archive using TARGETOBJS.
+ 	* mm.c: New file that simply #includes the other source C files.
+ 	
  Thu Oct  3 15:45:23 1996  Jason Molenda  (crash@godzilla.cygnus.co.jp)
  
  	* Makefile.in (maintainer-clean): Depend on distclean, remove
Index: .Sanitize
===================================================================
RCS file: /cvs/cvsfiles/devo/mmalloc/.Sanitize,v
retrieving revision 1.12
diff -c -r1.12 .Sanitize
*** .Sanitize	1995/05/04 00:21:16	1.12
--- .Sanitize	1996/12/28 22:07:30
***************
*** 34,39 ****
--- 34,40 ----
  keys.c
  mcalloc.c
  mfree.c
+ mm.c
  mmalloc.c
  mmalloc.h
  mmalloc.texi
Index: Makefile.in
===================================================================
RCS file: /cvs/cvsfiles/devo/mmalloc/Makefile.in,v
retrieving revision 1.27
diff -c -r1.27 Makefile.in
*** Makefile.in	1996/10/03 06:44:21	1.27
--- Makefile.in	1996/12/28 22:26:26
***************
*** 71,77 ****
  
  CFILES =	mcalloc.c mfree.c mmalloc.c mmcheck.c mmemalign.c mmstats.c \
  		mmtrace.c mrealloc.c mvalloc.c mmap-sup.c attach.c detach.c \
! 		keys.c sbrk-sup.c
  
  HFILES =	mmalloc.h
  
--- 71,77 ----
  
  CFILES =	mcalloc.c mfree.c mmalloc.c mmcheck.c mmemalign.c mmstats.c \
  		mmtrace.c mrealloc.c mvalloc.c mmap-sup.c attach.c detach.c \
! 		keys.c sbrk-sup.c mm.c
  
  HFILES =	mmalloc.h
  
***************
*** 81,88 ****
  
  DEFS =		@DEFS@
  
  .c.o:
! 	$(CC) -c $(CFLAGS) $(DEFS) -I. -I$(srcdir)/../include $<
  
  # Do we want/need any config overrides?
  #	 
--- 81,93 ----
  
  DEFS =		@DEFS@
  
+ # The current default is to build a single object module with all the mmalloc
+ # functions.  To build a more traditional library, flip this macro definition.
+ #TARGETOBJS =	$(OFILES)
+ TARGETOBJS =	mm.o
+ 
  .c.o:
! 		$(CC) -c $(CFLAGS) $(DEFS) -I. -I$(srcdir)/../include $<
  
  # Do we want/need any config overrides?
  #	 
***************
*** 120,131 ****
  		$(RANLIB) $(libdir)/$(TARGETLIB).n
  		mv -f $(libdir)/$(TARGETLIB).n $(libdir)/$(TARGETLIB)
  
! $(TARGETLIB):	$(OFILES)
  		$(RM) -rf $@
! 		$(AR) $(AR_FLAGS) $@ $(OFILES)
  		$(RANLIB) $@
  
  $(OFILES) :	$(HFILES) Makefile
  
  .always.:
  # Do nothing.
--- 125,139 ----
  		$(RANLIB) $(libdir)/$(TARGETLIB).n
  		mv -f $(libdir)/$(TARGETLIB).n $(libdir)/$(TARGETLIB)
  
! $(TARGETLIB):	$(TARGETOBJS)
  		$(RM) -rf $@
! 		$(AR) $(AR_FLAGS) $@ $(TARGETOBJS)
  		$(RANLIB) $@
  
  $(OFILES) :	$(HFILES) Makefile
+ 
+ mm.o:		$(HFILES) $(CFILES)
+ 		$(CC) -c $(CFLAGS) $(DEFS) -I. -I$(srcdir)/../include $(srcdir)/mm.c
  
  .always.:
  # Do nothing.
Index: mm.c
===================================================================
RCS file: mm.c
diff -N mm.c
*** /dev/null	Sat Dec 28 13:30:02 1996
--- mm.c	Sat Dec 28 14:11:54 1996
***************
*** 0 ****
--- 1,37 ----
+ /* Build the entire mmalloc library as a single object module. This
+    avoids having clients pick up part of their allocation routines
+    from mmalloc and part from libc, which results in undefined
+    behavior.  It should also still be possible to build the library
+    as a standard library with multiple objects.
+ 
+    Copyright 1996 Free Software Foundation
+ 
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+ 
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Library General Public License for more details.
+ 
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB.  If
+ not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+ 
+ #include "mcalloc.c"
+ #include "mfree.c"
+ #include "mmalloc.c"
+ #include "mmcheck.c"
+ #include "mmemalign.c"
+ #include "mmstats.c"
+ #include "mmtrace.c"
+ #include "mrealloc.c"
+ #include "mvalloc.c"
+ #include "mmap-sup.c"
+ #include "attach.c"
+ #include "detach.c"
+ #include "keys.c"
+ #include "sbrk-sup.c"

