* dlmalloc.c: New file. Port of Doug Lea's malloc

* dlmalloc.h: Ditto.
* Makefile.in: Add support for MALLOC_DEBUG
* config.h.in: Ditto.
* winsup.h: Ditto.
* configure.in: Add --enable-malloc-debugging option.
* configure: Regenerate.
* debug.h: Include declarations for debugging malloc.
* tty.cc (grantpt): Fix definition.
(unlockpt): Ditto.
This commit is contained in:
Egor Duda 2001-04-24 15:25:31 +00:00
parent 19a90cfeaf
commit 8db71e0169
10 changed files with 4062 additions and 56 deletions

View File

@ -1,3 +1,16 @@
2001-04-24 Egor Duda <deo@logos-m.ru>
* dlmalloc.c: New file. Port of Doug Lea's malloc
* dlmalloc.h: Ditto.
* Makefile.in: Add support for MALLOC_DEBUG
* config.h.in: Ditto.
* winsup.h: Ditto.
* configure.in: Add --enable-malloc-debugging option.
* configure: Regenerate.
* debug.h: Include declarations for debugging malloc.
* tty.cc (grantpt): Fix definition.
(unlockpt): Ditto.
Mon Apr 23 22:00:29 2001 Christopher Faylor <cgf@cygnus.com>
Remove trailing underscore from fhandler_base and friends, throughout.

View File

@ -111,6 +111,8 @@ EXTRA_DLL_OFILES:=${addsuffix .o,${basename ${notdir ${wildcard $(CONFIG_DIR)/*.
EXTRA_OFILES=$(bupdir1)/libiberty/random.o $(bupdir1)/libiberty/strsignal.o
MALLOC_OFILES=@MALLOC_OFILES@
DLL_IMPORTS:=$(w32api_lib)/libkernel32.a
DLL_OFILES:=assert.o autoload.o cygheap.o dcrt0.o debug.o delqueue.o dir.o \
@ -126,7 +128,7 @@ DLL_OFILES:=assert.o autoload.o cygheap.o dcrt0.o debug.o delqueue.o dir.o \
smallprint.o spawn.o strace.o strsep.o sync.o syscalls.o sysconf.o \
syslog.o termios.o thread.o times.o tty.o uinfo.o uname.o wait.o \
window.o \
$(EXTRA_DLL_OFILES) $(EXTRA_OFILES) $(MT_SAFE_OBJECTS)
$(EXTRA_DLL_OFILES) $(EXTRA_OFILES) $(MALLOC_OFILES) $(MT_SAFE_OBJECTS)
GMON_OFILES:= gmon.o mcount.o profil.o

View File

@ -25,6 +25,9 @@
/* Define if DEBUGGING support is requested. */
#undef DEBUGGING
/* Define if MALLOC_DEBUGGING support is requested. */
#undef MALLOC_DEBUG
/* Define if building "extra" thread-safe Cygwin DLL. */
#undef _CYG_THREAD_FAILSAFE

View File

@ -17,6 +17,8 @@ ac_help="$ac_help
--enable-extra-threadsafe-checking Build a cygwin DLL which is thread safe with extra consistency checking"
ac_help="$ac_help
--enable-debugging Build a cygwin DLL which has more consistency checking for debugging"
ac_help="$ac_help
--enable-malloc-debugging Build a cygwin DLL with heap sanity checking (this is very slow, use only if you have heap corruption problems)"
ac_help="$ac_help
--enable-vfork Build a cygwin DLL which uses experimental vfork code"
@ -562,7 +564,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:566: checking for a BSD compatible install" >&5
echo "configure:568: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -648,7 +650,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
echo "configure:652: checking host system type" >&5
echo "configure:654: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@ -669,7 +671,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$host" 1>&6
echo $ac_n "checking target system type""... $ac_c" 1>&6
echo "configure:673: checking target system type" >&5
echo "configure:675: checking target system type" >&5
target_alias=$target
case "$target_alias" in
@ -687,7 +689,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$target" 1>&6
echo $ac_n "checking build system type""... $ac_c" 1>&6
echo "configure:691: checking build system type" >&5
echo "configure:693: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@ -719,7 +721,7 @@ fi
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:723: checking for $ac_word" >&5
echo "configure:725: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -751,7 +753,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:755: checking for $ac_word" >&5
echo "configure:757: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -787,7 +789,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:791: checking for $ac_word" >&5
echo "configure:793: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -836,7 +838,7 @@ fi
fi
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
echo "configure:840: checking whether we are using GNU C" >&5
echo "configure:842: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -845,7 +847,7 @@ else
yes;
#endif
EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:849: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:851: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@ -860,7 +862,7 @@ if test $ac_cv_prog_gcc = yes; then
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
echo "configure:864: checking whether ${CC-cc} accepts -g" >&5
echo "configure:866: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -890,7 +892,7 @@ fi
# Extract the first word of "${ac_tool_prefix}g++", so it can be a program name with args.
set dummy ${ac_tool_prefix}g++; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:894: checking for $ac_word" >&5
echo "configure:896: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -922,7 +924,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "g++", so it can be a program name with args.
set dummy g++; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:926: checking for $ac_word" >&5
echo "configure:928: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -958,7 +960,7 @@ if test -z "$CXX"; then
# Extract the first word of "c++", so it can be a program name with args.
set dummy c++; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:962: checking for $ac_word" >&5
echo "configure:964: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1007,7 +1009,7 @@ esac
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1011: checking for $ac_word" >&5
echo "configure:1013: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1039,7 +1041,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1043: checking for $ac_word" >&5
echo "configure:1045: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1074,7 +1076,7 @@ fi
# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
set dummy ${ac_tool_prefix}as; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1078: checking for $ac_word" >&5
echo "configure:1080: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1106,7 +1108,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "as", so it can be a program name with args.
set dummy as; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1110: checking for $ac_word" >&5
echo "configure:1112: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1141,7 +1143,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1145: checking for $ac_word" >&5
echo "configure:1147: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1173,7 +1175,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1177: checking for $ac_word" >&5
echo "configure:1179: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1208,7 +1210,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args.
set dummy ${ac_tool_prefix}ld; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1212: checking for $ac_word" >&5
echo "configure:1214: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1240,7 +1242,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "ld", so it can be a program name with args.
set dummy ld; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1244: checking for $ac_word" >&5
echo "configure:1246: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1275,7 +1277,7 @@ fi
# Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
set dummy ${ac_tool_prefix}dlltool; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1279: checking for $ac_word" >&5
echo "configure:1281: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1307,7 +1309,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "dlltool", so it can be a program name with args.
set dummy dlltool; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1311: checking for $ac_word" >&5
echo "configure:1313: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1342,7 +1344,7 @@ fi
# Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args.
set dummy ${ac_tool_prefix}windres; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1346: checking for $ac_word" >&5
echo "configure:1348: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1374,7 +1376,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "windres", so it can be a program name with args.
set dummy windres; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1378: checking for $ac_word" >&5
echo "configure:1380: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1408,7 +1410,7 @@ fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:1412: checking how to run the C preprocessor" >&5
echo "configure:1414: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@ -1423,13 +1425,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 1427 "configure"
#line 1429 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1433: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1435: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1440,13 +1442,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 1444 "configure"
#line 1446 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1450: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1452: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1457,13 +1459,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
#line 1461 "configure"
#line 1463 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1467: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1469: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1490,19 +1492,19 @@ echo "$ac_t""$CPP" 1>&6
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments. Useless!
echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
echo "configure:1494: checking for working alloca.h" >&5
echo "configure:1496: checking for working alloca.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1499 "configure"
#line 1501 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() {
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
if { (eval echo configure:1506: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_header_alloca_h=yes
else
@ -1523,12 +1525,12 @@ EOF
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
echo "configure:1527: checking for alloca" >&5
echo "configure:1529: checking for alloca" >&5
if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1532 "configure"
#line 1534 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@ -1556,7 +1558,7 @@ int main() {
char *p = (char *) alloca(1);
; return 0; }
EOF
if { (eval echo configure:1560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_func_alloca_works=yes
else
@ -1588,12 +1590,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
echo "configure:1592: checking whether alloca needs Cray hooks" >&5
echo "configure:1594: checking whether alloca needs Cray hooks" >&5
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1597 "configure"
#line 1599 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@ -1618,12 +1620,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
if test $ac_cv_os_cray = yes; then
for ac_func in _getb67 GETB67 getb67; do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1622: checking for $ac_func" >&5
echo "configure:1624: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1627 "configure"
#line 1629 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -1646,7 +1648,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1652: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -1673,7 +1675,7 @@ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
echo "configure:1677: checking stack direction for C alloca" >&5
echo "configure:1679: checking stack direction for C alloca" >&5
if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1681,7 +1683,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
#line 1685 "configure"
#line 1687 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@ -1700,7 +1702,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
if { (eval echo configure:1704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1706: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_stack_direction=1
else
@ -1722,7 +1724,7 @@ EOF
fi
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
echo "configure:1726: checking whether ${MAKE-make} sets \${MAKE}" >&5
echo "configure:1728: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1759,7 +1761,7 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross
cat > conftest.$ac_ext <<EOF
#line 1763 "configure"
#line 1765 "configure"
#include "confdefs.h"
#include <string.h>
@ -1772,7 +1774,7 @@ int main() {
; return 0; }
EOF
if { (eval echo configure:1776: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1778: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
use_builtin_memset=yes
else
@ -1860,6 +1862,23 @@ esac
fi
MALLOC_OFILES=
# Check whether --enable-malloc-debugging or --disable-malloc-debugging was given.
if test "${enable_malloc_debugging+set}" = set; then
enableval="$enable_malloc_debugging"
case "${enableval}" in
yes) cat >> confdefs.h <<\EOF
#define MALLOC_DEBUG 1
EOF
MALLOC_OFILES=dlmalloc.o
;;
no) ;;
esac
fi
# Check whether --enable-vfork or --disable-vfork was given.
if test "${enable_vfork+set}" = set; then
enableval="$enable_vfork"
@ -1879,7 +1898,7 @@ fi
echo $ac_n "checking if newlib is part of the build tree""... $ac_c" 1>&6
echo "configure:1883: checking if newlib is part of the build tree" >&5
echo "configure:1902: checking if newlib is part of the build tree" >&5
EXE_LDFLAGS=
if test -d ../newlib
@ -1894,9 +1913,9 @@ fi
if test x"$EXE_LDFLAGS" = x
then
echo $ac_n "checking if installed newlib needed""... $ac_c" 1>&6
echo "configure:1898: checking if installed newlib needed" >&5
echo "configure:1917: checking if installed newlib needed" >&5
cat > conftest.$ac_ext <<EOF
#line 1900 "configure"
#line 1919 "configure"
#include "confdefs.h"
int main() {
@ -1904,7 +1923,7 @@ int main() {
; return 0; }
EOF
if { (eval echo configure:1908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""no" 1>&6
@ -1935,6 +1954,7 @@ esac
trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
@ -2101,6 +2121,7 @@ s%@ALLOCA@%$ALLOCA%g
s%@SET_MAKE@%$SET_MAKE%g
s%@MT_SAFE@%$MT_SAFE%g
s%@EXE_LDFLAGS@%$EXE_LDFLAGS%g
s%@MALLOC_OFILES@%$MALLOC_OFILES%g
s%@DLL_ENTRY@%$DLL_ENTRY%g
s%@DEF_DLL_ENTRY@%$DEF_DLL_ENTRY%g
s%@CONFIG_DIR@%$CONFIG_DIR%g

View File

@ -166,6 +166,17 @@ no) ;;
esac
])
MALLOC_OFILES=
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
yes) AC_DEFINE(MALLOC_DEBUG)
MALLOC_OFILES=dlmalloc.o
;;
no) ;;
esac
])
AC_ARG_ENABLE(vfork,
[ --enable-vfork Build a cygwin DLL which uses experimental vfork code],
[case "${enableval}" in
@ -234,6 +245,7 @@ case "$target_cpu" in
*) AC_MSG_ERROR(Invalid target processor \"$target_cpu\") ;;
esac
AC_SUBST(MALLOC_OFILES)
AC_SUBST(DLL_ENTRY)
AC_SUBST(DEF_DLL_ENTRY)
AC_SUBST(ALLOCA)

View File

@ -9,6 +9,8 @@ details. */
#ifndef MALLOC_DEBUG
#define MALLOC_CHECK do {} while (0)
#else
#include <stdlib.h>
#include "dlmalloc.h"
#define MALLOC_CHECK ({\
debug_printf ("checking malloc pool");\
(void)mallinfo ();\

3855
winsup/cygwin/dlmalloc.c Normal file

File diff suppressed because it is too large Load Diff

96
winsup/cygwin/dlmalloc.h Normal file
View File

@ -0,0 +1,96 @@
/*
* Header file for BBCized version of Doug Lea's malloc.c, automatically
* generated by
* /source/prod/libbbc/compat/dlmalloc/cvt
* from
* /source/prod/libbbc/compat/dlmalloc/malloc.c
*
* bbclabel: autogenerated
*/
void malloc_outofmem(void (*)(void));
struct mallinfo {
int arena; /* total space allocated from system */
int ordblks; /* number of non-inuse chunks */
int smblks; /* unused -- always zero */
int hblks; /* number of mmapped regions */
int hblkhd; /* total space in mmapped regions */
int usmblks; /* unused -- always zero */
int fsmblks; /* unused -- always zero */
int uordblks; /* total allocated space */
int fordblks; /* total non-inuse space */
int keepcost; /* top-most, releasable (via malloc_trim) space */
};
#define M_MXFAST 1 /* UNUSED in this malloc */
#define M_NLBLKS 2 /* UNUSED in this malloc */
#define M_GRAIN 3 /* UNUSED in this malloc */
#define M_KEEP 4 /* UNUSED in this malloc */
#define M_TRIM_THRESHOLD -1
#define M_TOP_PAD -2
#define M_MMAP_THRESHOLD -3
#define M_MMAP_MAX -4
#define M_SCANHEAP -5
#define M_FILL
#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__)
#ifdef __cplusplus
extern "C" {
#endif
void* malloc_dbg(size_t, const char *, int);
void free_dbg(void*, const char *, int);
void* realloc_dbg(void*, size_t, const char *, int);
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);
int mallopt_dbg(int, int, const char *, int);
struct mallinfo mallinfo_dbg(const char *, int);
#ifdef __cplusplus
}
#endif
#endif /* MALLOC_DEBUG */
#ifndef MALLOC_DEBUG
void* malloc(size_t);
void free(void*);
void* realloc(void*, size_t);
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);
int mallopt(int, int);
struct mallinfo mallinfo(void);
#endif /* !MALLOC_DEBUG */

View File

@ -29,14 +29,14 @@ extern fhandler_tty_master *tty_master;
extern "C"
int
grantpt (void)
grantpt (int fd)
{
return 0;
}
extern "C"
int
unlockpt (void)
unlockpt (int fd)
{
return 0;
}

View File

@ -58,7 +58,9 @@ extern char case_folded_lower[];
extern char case_folded_upper[];
#define cyg_toupper(c) (case_folded_upper[(unsigned char)(c)])
#ifndef MALLOC_DEBUG
#define cfree newlib_cfree_dont_use
#endif
#define WIN32_LEAN_AND_MEAN 1
#define _WINGDI_H