diff options
author | Christopher Faylor <me@cgf.cx> | 2003-08-31 18:26:58 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-08-31 18:26:58 +0000 |
commit | f8e2f358c498417f044e17a5977cc796159bba95 (patch) | |
tree | 612fbe776a4e951183c0c3af4d5472355f0b3c6b | |
parent | 110a4b87df64e27ecd07f25198ab44679fce474f (diff) | |
download | newlib-f8e2f358c498417f044e17a5977cc796159bba95.zip newlib-f8e2f358c498417f044e17a5977cc796159bba95.tar.gz newlib-f8e2f358c498417f044e17a5977cc796159bba95.tar.bz2 |
* Makefile.in (MALLOC_OFILES): Always fill in with correct malloc object.
* configure.in: Fill in MALLOC_OFILES with either debugging or regular malloc.
* configure: Regenerate.
* dlmalloc.c: Make various fruitless changes to attempt to get to work.
* dlmalloc.h: Ditto.
* malloc.cc (free): Check malloc pool when debugging.
* path.cc (win32_device_name): Eliminate compiler warning.
* sigproc.cc (sig_dispatch_pending): Remove use of was_pending. Let
thisframe.call_signal_handler decide if handler should be called rather than
using bogus was_pending check.
* exceptions.cc (interrupt_setup): Remove accidentally checked in debugging
code.
* heap.cc (sbrk): Save rounded addess in user_heap_max.
-rw-r--r-- | winsup/cygwin/ChangeLog | 24 | ||||
-rw-r--r-- | winsup/cygwin/Makefile.in | 2 | ||||
-rwxr-xr-x | winsup/cygwin/configure | 2 | ||||
-rw-r--r-- | winsup/cygwin/configure.in | 2 | ||||
-rw-r--r-- | winsup/cygwin/dlmalloc.c | 79 | ||||
-rw-r--r-- | winsup/cygwin/dlmalloc.h | 29 | ||||
-rw-r--r-- | winsup/cygwin/exceptions.cc | 1 | ||||
-rw-r--r-- | winsup/cygwin/malloc.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/path.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/sigproc.cc | 7 |
10 files changed, 78 insertions, 72 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 322b109..dc8ddb3 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,27 @@ +2003-08-31 Christopher Faylor <cgf@redhat.com> + + * Makefile.in (MALLOC_OFILES): Always fill in with correct malloc + object. + * configure.in: Fill in MALLOC_OFILES with either debugging or regular + malloc. + * configure: Regenerate. + * dlmalloc.c: Make various fruitless changes to attempt to get to work. + * dlmalloc.h: Ditto. + * malloc.cc (free): Check malloc pool when debugging. + + * path.cc (win32_device_name): Eliminate compiler warning. + + * sigproc.cc (sig_dispatch_pending): Remove use of was_pending. Let + thisframe.call_signal_handler decide if handler should be called rather + than using bogus was_pending check. + + * exceptions.cc (interrupt_setup): Remove accidentally checked in + debugging code. + +2003-08-30 Christopher Faylor <cgf@redhat.com> + + * heap.cc (sbrk): Save rounded addess in user_heap_max. + 2003-08-30 Christopher Faylor <cgf@redhat.com> * sigproc.cc (sig_dispatch_pending): Remove explicit call to diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index 6a54a1c..41dad96 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -152,7 +152,7 @@ DLL_OFILES:=assert.o autoload.o cxx.o cygheap.o cygthread.o dcrt0.o debug.o \ fhandler_socket.o fhandler_tape.o fhandler_termios.o \ fhandler_tty.o fhandler_virtual.o fhandler_windows.o \ fhandler_zero.o fnmatch.o fork.o glob.o grp.o heap.o init.o ioctl.o \ - ipc.o localtime.o malloc.o malloc_wrapper.o miscfuncs.o mmap.o msg.o \ + ipc.o localtime.o malloc_wrapper.o miscfuncs.o mmap.o msg.o \ net.o netdb.o ntea.o passwd.o path.o pinfo.o pipe.o poll.o pthread.o \ regcomp.o regerror.o regexec.o regfree.o registry.o resource.o \ scandir.o sched.o sec_acl.o sec_helper.o security.o select.o sem.o \ diff --git a/winsup/cygwin/configure b/winsup/cygwin/configure index 3500fad..eb1b688 100755 --- a/winsup/cygwin/configure +++ b/winsup/cygwin/configure @@ -1916,7 +1916,7 @@ esac fi -MALLOC_OFILES= +MALLOC_OFILES=malloc.o # Check whether --enable-malloc-debugging or --disable-malloc-debugging was given. if test "${enable_malloc_debugging+set}" = set; then enableval="$enable_malloc_debugging" diff --git a/winsup/cygwin/configure.in b/winsup/cygwin/configure.in index c0ad976..d47b408 100644 --- a/winsup/cygwin/configure.in +++ b/winsup/cygwin/configure.in @@ -145,7 +145,7 @@ no) LIBSERVER=;; esac ]) -MALLOC_OFILES= +MALLOC_OFILES=malloc.o AC_ARG_ENABLE(malloc-debugging, [ --enable-malloc-debugging Build a cygwin DLL with heap sanity checking (this is very slow, use only if you have heap corruption problems)], [case "${enableval}" in diff --git a/winsup/cygwin/dlmalloc.c b/winsup/cygwin/dlmalloc.c index de14fcb..a5a7ff0 100644 --- a/winsup/cygwin/dlmalloc.c +++ b/winsup/cygwin/dlmalloc.c @@ -28,6 +28,21 @@ * malloc_usable_size(P) is equivalent to realloc(P, malloc_usable_size(P)) * * $Log$ + * Revision 1.6 2003/08/31 18:26:58 cgf + * * Makefile.in (MALLOC_OFILES): Always fill in with correct malloc object. + * * configure.in: Fill in MALLOC_OFILES with either debugging or regular malloc. + * * configure: Regenerate. + * * dlmalloc.c: Make various fruitless changes to attempt to get to work. + * * dlmalloc.h: Ditto. + * * malloc.cc (free): Check malloc pool when debugging. + * * path.cc (win32_device_name): Eliminate compiler warning. + * * sigproc.cc (sig_dispatch_pending): Remove use of was_pending. Let + * thisframe.call_signal_handler decide if handler should be called rather than + * using bogus was_pending check. + * * exceptions.cc (interrupt_setup): Remove accidentally checked in debugging + * code. + * * heap.cc (sbrk): Save rounded addess in user_heap_max. + * * Revision 1.5 2001/10/03 03:49:25 cgf * * cygheap.cc (cfree): Remove malloc debugging probe. * * dlmalloc.c (errprint): Remove abort() call which causes interesting error @@ -973,31 +988,31 @@ extern Void_t* sbrk(); #else #ifndef cALLOc -#define cALLOc calloc +#define cALLOc dlcalloc #endif #ifndef fREe -#define fREe free +#define fREe dlfree #endif #ifndef mALLOc -#define mALLOc malloc +#define mALLOc dlmalloc #endif #ifndef mEMALIGn -#define mEMALIGn memalign +#define mEMALIGn dlmemalign #endif #ifndef rEALLOc -#define rEALLOc realloc +#define rEALLOc dlrealloc #endif #ifndef vALLOc -#define vALLOc valloc +#define vALLOc dlvalloc #endif #ifndef pvALLOc -#define pvALLOc pvalloc +#define pvALLOc dlpvalloc #endif #ifndef mALLINFo -#define mALLINFo mallinfo +#define mALLINFo dlmallinfo #endif #ifndef mALLOPt -#define mALLOPt mallopt +#define mALLOPt dlmallopt #endif #endif @@ -1012,7 +1027,6 @@ extern Void_t* sbrk(); #define memalign(align, size) memalign_dbg(align, size, __FILE__, __LINE__) #define valloc(size) valloc_dbg(size, __FILE__, __LINE__) #define pvalloc(size) pvalloc_dbg(size, __FILE__, __LINE__) -#define cfree(p) cfree_dbg(p, __FILE__, __LINE__) #define malloc_trim(pad) malloc_trim_dbg(pad, __FILE__, __LINE__) #define malloc_usable_size(p) malloc_usable_size_dbg(p, __FILE__, __LINE__) #define malloc_stats(void) malloc_stats_dbg(__FILE__, __LINE__) @@ -1027,7 +1041,6 @@ Void_t* calloc_dbg(size_t, size_t, const char *, int); Void_t* memalign_dbg(size_t, size_t, const char *, int); Void_t* valloc_dbg(size_t, const char *, int); Void_t* pvalloc_dbg(size_t, const char *, int); -void cfree_dbg(Void_t*, const char *, int); int malloc_trim_dbg(size_t, const char *, int); size_t malloc_usable_size_dbg(Void_t*, const char *, int); void malloc_stats_dbg(const char *, int); @@ -1041,7 +1054,6 @@ Void_t* calloc_dbg(); Void_t* memalign_dbg(); Void_t* valloc_dbg(); Void_t* pvalloc_dbg(); -void cfree_dbg(); int malloc_trim_dbg(); size_t malloc_usable_size_dbg(); void malloc_stats_dbg(); @@ -1060,7 +1072,6 @@ Void_t* cALLOc(size_t, size_t); Void_t* mEMALIGn(size_t, size_t); Void_t* vALLOc(size_t); Void_t* pvALLOc(size_t); -void cfree(Void_t*); int malloc_trim(size_t); size_t malloc_usable_size(Void_t*); void malloc_stats(void); @@ -1074,7 +1085,6 @@ Void_t* cALLOc(); Void_t* mEMALIGn(); Void_t* vALLOc(); Void_t* pvALLOc(); -void cfree(); int malloc_trim(); size_t malloc_usable_size(); void malloc_stats(); @@ -1102,7 +1112,6 @@ extern "C" { #undef memalign #undef valloc #undef pvalloc -#undef cfree #undef malloc_trim #undef malloc_usable_size #undef malloc_stats @@ -1117,7 +1126,6 @@ Void_t* cALLOc(size_t, size_t); Void_t* mEMALIGn(size_t, size_t); Void_t* vALLOc(size_t); Void_t* pvALLOc(size_t); -void cfree(Void_t*); int malloc_trim(size_t); size_t malloc_usable_size(Void_t*); void malloc_stats(void); @@ -1131,7 +1139,6 @@ Void_t* cALLOc(); Void_t* mEMALIGn(); Void_t* vALLOc(); Void_t* pvALLOc(); -void cfree(); int malloc_trim(); size_t malloc_usable_size(); void malloc_stats(); @@ -1901,7 +1908,6 @@ static void malloc_err(const char *err, mchunkptr p) #undef valloc #undef pvalloc #undef calloc -#undef cfree #undef malloc_trim #undef malloc_usable_size #undef malloc_stats @@ -1959,20 +1965,17 @@ Void_t* realloc_dbg(Void_t *oldmem, size_t bytes, dbgargs) { skelr(Void_t*, realloc(oldmem, bytes)); } Void_t* memalign_dbg(size_t alignment, size_t bytes, dbgargs) { - skelr(Void_t*, memalign(alignment, bytes)); + skelr(Void_t*, dlmemalign(alignment, bytes)); } Void_t* valloc_dbg(size_t bytes, dbgargs) { - skelr(Void_t*, valloc(bytes)); + skelr(Void_t*, dlvalloc(bytes)); } Void_t* pvalloc_dbg(size_t bytes, dbgargs) { - skelr(Void_t*, pvalloc(bytes)); + skelr(Void_t*, dlpvalloc(bytes)); } Void_t* calloc_dbg(size_t n, size_t elem_size, dbgargs) { skelr(Void_t*, calloc(n, elem_size)); } -void cfree_dbg(Void_t *mem, dbgargs) { - skelv(cfree(mem)); -} int malloc_trim_dbg(size_t pad, dbgargs) { skelr(int, malloc_trim(pad)); } @@ -1983,10 +1986,10 @@ void malloc_stats_dbg(dbgargs) { skelv(malloc_stats()); } int mallopt_dbg(int flag, int value, dbgargs) { - skelr(int, mallopt(flag, value)); + skelr(int, dlmallopt(flag, value)); } struct mallinfo mallinfo_dbg(dbgargs) { - skelr(struct mallinfo, mallinfo()); + skelr(struct mallinfo, dlmallinfo()); } #undef skel @@ -3536,24 +3539,6 @@ Void_t* cALLOc(n, elem_size) size_t n; size_t elem_size; } } -/* - - cfree just calls free. It is needed/defined on some systems - that pair it with calloc, presumably for odd historical reasons. - -*/ - -#if !defined(INTERNAL_LINUX_C_LIB) || !defined(__ELF__) -#if __STD_C -void cfree(Void_t *mem) -#else -void cfree(mem) Void_t *mem; -#endif -{ - free(mem); -} -#endif - /* @@ -3580,7 +3565,7 @@ void cfree(mem) Void_t *mem; */ #if __STD_C -int malloc_trim(size_t pad) +int dlmalloc_trim(size_t pad) #else int malloc_trim(pad) size_t pad; #endif @@ -3653,7 +3638,7 @@ int malloc_trim(pad) size_t pad; */ #if __STD_C -size_t malloc_usable_size(Void_t* mem) +size_t dlmalloc_usable_size(Void_t* mem) #else size_t malloc_usable_size(mem) Void_t* mem; #endif @@ -3745,7 +3730,7 @@ static void malloc_update_mallinfo(void) */ -void malloc_stats(void) +void dlmalloc_stats(void) { malloc_update_mallinfo(); fprintf(stderr, "max system bytes = %10u\n", diff --git a/winsup/cygwin/dlmalloc.h b/winsup/cygwin/dlmalloc.h index 15b25db..b8d7ebe 100644 --- a/winsup/cygwin/dlmalloc.h +++ b/winsup/cygwin/dlmalloc.h @@ -8,7 +8,7 @@ * * bbclabel: autogenerated */ - +#define _INCLUDE_MALLOC_H_ 1 void malloc_outofmem(void (*)(void)); @@ -41,19 +41,18 @@ struct mallinfo { #ifdef MALLOC_DEBUG -#define malloc(size) malloc_dbg(size, __FILE__, __LINE__) -#define free(p) free_dbg(p, __FILE__, __LINE__) -#define realloc(p, size) realloc_dbg(p, size, __FILE__, __LINE__) -#define calloc(n, size) calloc_dbg(n, size, __FILE__, __LINE__) -#define memalign(align, size) memalign_dbg(align, size, __FILE__, __LINE__) -#define valloc(size) valloc_dbg(size, __FILE__, __LINE__) -#define pvalloc(size) pvalloc_dbg(size, __FILE__, __LINE__) -#define cfree(p) cfree_dbg(p, __FILE__, __LINE__) -#define malloc_trim(pad) malloc_trim_dbg(pad, __FILE__, __LINE__) -#define malloc_usable_size(p) malloc_usable_size_dbg(p, __FILE__, __LINE__) -#define malloc_stats() malloc_stats_dbg(__FILE__, __LINE__) -#define mallopt(flag, val) mallopt_dbg(flag, val, __FILE__, __LINE__) -#define mallinfo() mallinfo_dbg(__FILE__, __LINE__) +#define dmalloc(size) malloc_dbg(size, __FILE__, __LINE__) +#define dfree(p) free_dbg(p, __FILE__, __LINE__) +#define drealloc(p, size) realloc_dbg(p, size, __FILE__, __LINE__) +#define dcalloc(n, size) calloc_dbg(n, size, __FILE__, __LINE__) +#define dmemalign(align, size) memalign_dbg(align, size, __FILE__, __LINE__) +#define dvalloc(size) valloc_dbg(size, __FILE__, __LINE__) +#define dpvalloc(size) pvalloc_dbg(size, __FILE__, __LINE__) +#define dmalloc_trim(pad) malloc_trim_dbg(pad, __FILE__, __LINE__) +#define dmalloc_usable_size(p) malloc_usable_size_dbg(p, __FILE__, __LINE__) +#define dmalloc_stats() malloc_stats_dbg(__FILE__, __LINE__) +#define dmallopt(flag, val) mallopt_dbg(flag, val, __FILE__, __LINE__) +#define dmallinfo() mallinfo_dbg(__FILE__, __LINE__) #ifdef __cplusplus @@ -66,7 +65,6 @@ void* calloc_dbg(size_t, size_t, const char *, int); void* memalign_dbg(size_t, size_t, const char *, int); void* valloc_dbg(size_t, const char *, int); void* pvalloc_dbg(size_t, const char *, int); -void cfree_dbg(void*, const char *, int); int malloc_trim_dbg(size_t, const char *, int); size_t malloc_usable_size_dbg(void*, const char *, int); void malloc_stats_dbg(const char *, int); @@ -87,7 +85,6 @@ void* calloc(size_t, size_t); void* memalign(size_t, size_t); void* valloc(size_t); void* pvalloc(size_t); -void cfree(void*); int malloc_trim(size_t); size_t malloc_usable_size(void*); void malloc_stats(void); diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index ba86274..075b3cc 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -688,7 +688,6 @@ interrupt_setup (int sig, void *handler, DWORD retaddr, DWORD *retaddr_on_stack, { sigsave.retaddr = retaddr; sigsave.retaddr_on_stack = retaddr_on_stack; -small_printf ("retaddr_on_stack %p\n", retaddr_on_stack); /* FIXME: Not multi-thread aware */ sigsave.oldmask = myself->getsigmask (); sigsave.newmask = sigsave.oldmask | siga.sa_mask | SIGTOMASK (sig); diff --git a/winsup/cygwin/malloc.cc b/winsup/cygwin/malloc.cc index 383a590..7c85bd6 100644 --- a/winsup/cygwin/malloc.cc +++ b/winsup/cygwin/malloc.cc @@ -3744,6 +3744,7 @@ void fREe(mem) Void_t* mem; mchunkptr bck; /* misc temp for linking */ mchunkptr fwd; /* misc temp for linking */ + check_malloc_state(); /* free(0) has no effect */ if (mem != 0) { p = mem2chunk(mem); @@ -3878,6 +3879,7 @@ void fREe(mem) Void_t* mem; #endif } } + check_malloc_state(); } /* diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 26b6aa8..5811497 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -1124,7 +1124,7 @@ win32_device_name (const char *src_path, char *win32_path, case FH_SOCKET: char *c; strcpy (win32_path, src_path); - while (c = strchr (win32_path, '/')) + while ((c = strchr (win32_path, '/'))) *c = '\\'; break; case FH_RANDOM: diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 69234f5..af20541 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -540,12 +540,11 @@ sig_dispatch_pending () sigframe thisframe (mainthread); - int was_pending = pending_signals; #ifdef DEBUGGING - sigproc_printf ("pending_signals %d", was_pending); + sigproc_printf ("pending_signals %d", pending_signals); #endif - if (!was_pending) + if (!pending_signals) #ifdef DEBUGGING sigproc_printf ("no need to wake anything up"); #else @@ -559,7 +558,7 @@ sig_dispatch_pending () #endif } - return was_pending; + return thisframe.call_signal_handler (); } /* Message initialization. Called from dll_crt0_1 |