This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: gdb internal error: Memory corruption
- To: Ronald dot Wahl at informatik dot tu-chemnitz dot de
- Subject: Re: gdb internal error: Memory corruption
- From: Fred Fish <fnf at ninemoons dot com>
- Date: Wed, 1 Oct 1997 14:30:26 -0700 (MST)
- Cc: kthomas at gwdg dot de, egcs-bugs at cygnus dot com
> > >GDB 4.16 (i586-unknown-linux), Copyright 1996 Free Software Foundation,
> > >gdb internal error: Memory corruption
Try this patch to mmalloc:
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"