Add D.U.M.A., the Electric Fence successor.

This commit is contained in:
Yann E. MORIN" 2007-07-12 08:47:15 +00:00
parent 429be50c73
commit 21842b5910
5 changed files with 240 additions and 1 deletions

44
config/debug/duma.in Normal file
View File

@ -0,0 +1,44 @@
# D.U.M.A. - Detect Unintended Memory Access - Memory checker
menuconfig DUMA
bool
prompt "D.U.M.A."
default n
depends on EXPERIMENTAL
help
D.U.M.A. - Detect Unintended Memory Access
A memory bound checker, with additional features.
Formerly known as Electric Fence.
if DUMA
config DUMA_A
bool
prompt "Build a static library"
default y
config DUMA_SO
bool
prompt "Build a shared library"
default y if SHARED_LIBS
default n if ! SHARED_LIBS
choice
bool
prompt "D.U.M.A. version"
config DUMA_V_2_5_1
bool
prompt "2_5_1"
# CT_INSERT_VERSION_ABOVE
# Don't remove above line!
endchoice
config DUMA_VERSION
string
default "2_5_1" if DUMA_V_2_5_1
# CT_INSERT_VERSION_STRING_ABOVE
# Don't remove above line!
endif

View File

@ -0,0 +1,110 @@
diff -dur duma_2_5_1/Makefile duma_2_5_1.orig/Makefile
--- duma_2_5_1/Makefile 2006-06-18 06:02:13.000000000 +0200
+++ duma_2_5_1.orig/Makefile 2007-07-11 17:49:43.000000000 +0200
@@ -98,10 +98,6 @@
LIBS=-lpthread
endif
-
-CC=gcc
-CXX=g++
-AR=ar
INSTALL=install
############################################################
@@ -169,31 +165,31 @@
createconf: createconf.o
- rm -f createconf
- $(CC) $(CFLAGS) $(DUMA_OPTIONS) createconf.o -o createconf
+ $(HOSTCC) $(CFLAGS) $(DUMA_OPTIONS) createconf.o -o createconf
tstheap: libduma.a tstheap.o
- rm -f tstheap
- $(CC) $(CFLAGS) tstheap.o libduma.a -o tstheap $(LIBS)
+ $(HOSTCC) $(CFLAGS) tstheap.o libduma.a -o tstheap $(LIBS)
dumatest: libduma.a dumatest.o
- rm -f dumatest
- $(CC) $(CFLAGS) dumatest.o libduma.a -o dumatest $(LIBS)
+ $(HOSTCC) $(CFLAGS) dumatest.o libduma.a -o dumatest $(LIBS)
dumatestpp: libduma.a dumatestpp.o dumapp.h
- rm -f dumatestpp
- $(CXX) $(CPPFLAGS) dumatestpp.o libduma.a -o dumatestpp $(LIBS)
+ $(HOSTCXX) $(CPPFLAGS) dumatestpp.o libduma.a -o dumatestpp $(LIBS)
testoperators: libduma.a testoperators.o dumapp.h
- rm -f testoperators
- $(CXX) $(CPPFLAGS) testoperators.o libduma.a -o testoperators $(LIBS)
+ $(HOSTCXX) $(CPPFLAGS) testoperators.o libduma.a -o testoperators $(LIBS)
tstheap_so: tstheap_so.o
- rm -f tstheap_so
- $(CC) $(CFLAGS) tstheap_so.o -o tstheap_so $(LIBS)
+ $(HOSTCC) $(CFLAGS) tstheap_so.o -o tstheap_so $(LIBS)
dumatestpp_so: dumatestpp_so.o
- rm -f dumatestpp_so
- $(CXX) $(CPPFLAGS) dumatestpp_so.o -o dumatestpp_so $(LIBS)
+ $(HOSTCXX) $(CPPFLAGS) dumatestpp_so.o -o dumatestpp_so $(LIBS)
$(OBJECTS) tstheap.o dumatest.o dumatestpp.o: duma.h
@@ -211,7 +207,7 @@
# define rules how to build objects for createconf
#
createconf.o:
- $(CC) $(CFLAGS) $(DUMA_OPTIONS) -c createconf.c -o $@
+ $(HOSTCC) $(CFLAGS) $(DUMA_OPTIONS) -c createconf.c -o $@
#
@@ -230,13 +226,6 @@
print_so.o: print.c print.h
$(CC) $(CFLAGS) $(DUMA_SO_OPTIONS) -c print.c -o $@
-# DUMA_SO_OPTIONS needed cause duma.h is included explicitly
-tstheap_so.o:
- $(CC) $(CFLAGS) $(DUMA_SO_OPTIONS) -c tstheap.c -o $@
-
-dumatestpp_so.o:
- $(CXX) $(CPPFLAGS) $(DUMA_SO_OPTIONS) -c dumatestpp.cpp -o $@
-
#
# define rules how to build objects for static library
#
@@ -259,17 +248,23 @@
#
dumatest.o: dumatest.c duma.h duma_config.h
- $(CC) $(CFLAGS) -c dumatest.c -o $@
+ $(HOSTCC) $(CFLAGS) -c dumatest.c -o $@
dumatestpp.o: dumatestpp.cpp duma.h dumapp.h duma_config.h
- $(CXX) $(CPPFLAGS) -c dumatestpp.cpp -o $@
+ $(HOSTCXX) $(CPPFLAGS) -c dumatestpp.cpp -o $@
tstheap.o: tstheap.c duma.h duma_config.h
- $(CC) $(CFLAGS) -c tstheap.c -o $@
+ $(HOSTCC) $(CFLAGS) -c tstheap.c -o $@
testoperators.o: testoperators.cpp duma.h dumapp.h duma_config.h
- $(CXX) $(CPPFLAGS) -c testoperators.cpp -o $@
+ $(HOSTCXX) $(CPPFLAGS) -c testoperators.cpp -o $@
+
+# DUMA_SO_OPTIONS needed cause duma.h is included explicitly
+tstheap_so.o:
+ $(HOSTCC) $(CFLAGS) $(DUMA_SO_OPTIONS) -c tstheap.c -o $@
+dumatestpp_so.o:
+ $(HOSTCXX) $(CPPFLAGS) $(DUMA_SO_OPTIONS) -c dumatestpp.cpp -o $@
#
# default rules
@@ -280,5 +275,3 @@
#.cpp.o:
# $(CXX) $(CPPFLAGS) -c $< -o $@
#
-
-

View File

@ -0,0 +1,20 @@
diff -dur duma_2_5_1.orig/Makefile duma_2_5_1/Makefile
--- duma_2_5_1.orig/Makefile 2007-07-11 17:49:43.000000000 +0200
+++ duma_2_5_1/Makefile 2007-07-11 17:50:46.000000000 +0200
@@ -115,9 +115,14 @@
dumatest.c tstheap.c dumatestpp.cpp testoperators.cpp \
createconf.c
-OBJECTS = dumapp.o duma.o sem_inc.o print.o
+OBJECTS = duma.o sem_inc.o print.o
+SO_OBJECTS = duma_so.o sem_inc_so.o print_so.o
+
+ifeq ($(DUMA_CPP),1)
+OBJECTS += dumapp.o
+SO_OBJECTS += dumapp_so.o
+endif
-SO_OBJECTS = dumapp_so.o duma_so.o sem_inc_so.o print_so.o
all: libduma.a $(DUMASO) tstheap dumatest dumatestpp testoperators tstheap_so dumatestpp_so
@ echo "Testing DUMA."

View File

@ -0,0 +1,64 @@
# Biuld script for D.U.M.A.
is_enabled="${CT_DUMA}"
do_print_filename() {
[ "${CT_DUMA}" = "y" ] || return 0
echo "duma_${CT_DUMA_VERSION}"
}
do_debug_duma_get() {
CT_GetFile "duma_${CT_DUMA_VERSION}" http://mesh.dl.sourceforge.net/sourceforge/duma/
# D.U.M.A. doesn't separate its name from its version with a dash,
# but with an underscore. Create a link so that crosstool-NG can
# work correctly:
cd "${CT_TARBALLS_DIR}"
duma_ext=`CT_GetFileExtension "duma_${CT_DUMA_VERSION}"`
rm -f "duma-${CT_DUMA_VERSION}${duma_ext}"
ln -sf "duma_${CT_DUMA_VERSION}${duma_ext}" "duma-${CT_DUMA_VERSION}${duma_ext}"
}
do_debug_duma_extract() {
CT_ExtractAndPatch "duma-${CT_DUMA_VERSION}"
cd "${CT_SRC_DIR}"
rm -f "duma-${CT_DUMA_VERSION}"
ln -sf "duma_${CT_DUMA_VERSION}" "duma-${CT_DUMA_VERSION}"
}
do_debug_duma_build() {
CT_DoStep INFO "Installing D.U.M.A."
CT_DoLog EXTRA "Copying sources"
cp -a "${CT_SRC_DIR}/duma_${CT_DUMA_VERSION}" "${CT_BUILD_DIR}/build-duma"
CT_Pushd "${CT_BUILD_DIR}/build-duma"
DUMA_CPP=
[ "${CT_CC_LANG_CXX}" = "y" ] && DUMA_CPP=1
libs=
[ "${CT_DUMA_A}" = "y" ] && libs="${libs} libduma.a"
[ "${CT_DUMA_SO}" = "y" ] && libs="${libs} libduma.so.0.0"
for lib in ${libs}; do
CT_DoLog EXTRA "Building library \"${lib}\""
make HOSTCC="${CT_CC_NATIVE}" \
HOSTCXX="${CT_CC_NATIVE}" \
CC="${CT_TARGET}-gcc" \
CXX="${CT_TARGET}-gcc" \
DUMA_CPP="${DUMA_CPP}" \
${lib} 2>&1 |CT_DoLog ALL
CT_DoLog EXTRA "Installing library \"${lib}\""
install -m 644 "${lib}" "${CT_SYSROOT_DIR}/usr/lib" 2>&1 |CT_DoLog ALL
done
if [ "${CT_DUMA_SO}" = "y" ]; then
CT_DoLog EXTRA "Installing shared library links"
ln -vsf libduma.so.0.0 "${CT_SYSROOT_DIR}/usr/lib/libduma.so.0" 2>&1 |CT_DoLog ALL
ln -vsf libduma.so.0.0 "${CT_SYSROOT_DIR}/usr/lib/libduma.so" 2>&1 |CT_DoLog ALL
fi
CT_DoLog EXTRA "Installing LD_PRELOAD wrapper script"
mkdir -p "${CT_DEBUG_INSTALL_DIR}/usr/bin"
cp -v duma.sh \
"${CT_DEBUG_INSTALL_DIR}/usr/bin/duma" 2>&1 |CT_DoLog ALL
CT_EndStep
CT_Popd
}

View File

@ -8,7 +8,7 @@ doHelp() {
Usage: ${myname} <tool> [option] <version> Usage: ${myname} <tool> [option] <version>
'tool' in one of: 'tool' in one of:
--gcc, --binutils, --glibc, --uClibc, --linux, --gcc, --binutils, --glibc, --uClibc, --linux,
--gdb, --dmalloc --gdb, --dmalloc, --duma
Valid options for all tools: Valid options for all tools:
--experimental, -x --experimental, -x
@ -55,6 +55,7 @@ while [ $i -le $# ]; do
--linux) cat=KERNEL; tool=linux; tool_prefix=kernel_; tool_suffix=;; --linux) cat=KERNEL; tool=linux; tool_prefix=kernel_; tool_suffix=;;
--gdb) cat=GDB; tool=gdb; tool_prefix=debug/ tool_suffix=;; --gdb) cat=GDB; tool=gdb; tool_prefix=debug/ tool_suffix=;;
--dmalloc) cat=DMALLOC; tool=dmalloc; tool_prefix=debug/ tool_suffix=;; --dmalloc) cat=DMALLOC; tool=dmalloc; tool_prefix=debug/ tool_suffix=;;
--duma) cat=DUMA; tool=duma; tool_prefix=debug/ tool_suffix=;;
# Tools options: # Tools options:
-x|--experimental) EXP=1; OBS=;; -x|--experimental) EXP=1; OBS=;;
-o|--obsolete) OBS=1; EXP=;; -o|--obsolete) OBS=1; EXP=;;