1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-23 00:43:28 +00:00

Add LeakTracer - a small tool for checking a C++ program for memory leaks.

Submitted by:	Alexey Dokuchaev <danfe@regency.nsu.ru>
This commit is contained in:
Sergey A. Osokin 2004-02-04 12:13:23 +00:00
parent a27e6afa7b
commit 1c52d085f0
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=99942
6 changed files with 106 additions and 0 deletions

View File

@ -333,6 +333,7 @@
SUBDIR += kprof
SUBDIR += kyra
SUBDIR += lbpp
SUBDIR += leaktracer
SUBDIR += lemon
SUBDIR += leoarg
SUBDIR += libIDL

37
devel/leaktracer/Makefile Normal file
View File

@ -0,0 +1,37 @@
# New ports collection makefile for: LeakTracer
# Date created: 04 Feb 2004
# Whom: Alexey Dokuchaev <danfe@regency.nsu.ru>
#
# $FreeBSD$
#
PORTNAME= leaktracer
PORTVERSION= 2.4
CATEGORIES= devel
MASTER_SITES= http://www.andreasen.org/LeakTracer/ \
http://freebsd.nsu.ru/distfiles/
DISTNAME= LeakTracer
MAINTAINER= danfe@regency.nsu.ru
COMMENT= Trace and analyze memory leaks in C++ programs
INSTALLS_SHLIB= yes
USE_GMAKE= yes
USE_PERL5_RUN= yes
MAKE_ENV= CXX="${CXX}" \
PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" \
PTHREAD_LIBS="${PTHREAD_LIBS}"
PLIST_FILES= bin/LeakCheck bin/leak-analyze lib/LeakTracer.so
PORTDOCS= README README.html
do-install:
${INSTALL_SCRIPT} ${WRKSRC}/LeakCheck ${PREFIX}/bin
${INSTALL_SCRIPT} ${WRKSRC}/leak-analyze ${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/LeakTracer.so ${PREFIX}/lib
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/README.html ${DOCSDIR}
.endif
.include <bsd.port.mk>

View File

@ -0,0 +1 @@
MD5 (LeakTracer.tar.gz) = e1cf9d03c12a45d39f253e558d231438

View File

@ -0,0 +1,11 @@
--- LeakCheck.orig Wed Feb 4 16:49:49 2004
+++ LeakCheck Wed Feb 4 16:50:09 2004
@@ -7,7 +7,7 @@
# this looks in the same directory, this
# LeakCheck script resides; modify to your
# needs:
-SHLIB=`dirname $0`/LeakTracer.so
+SHLIB=`dirname $0`/../lib/LeakTracer.so
if [ ! -x $SHLIB ] ; then
echo "$SHLIB not found"
exit 1

View File

@ -0,0 +1,41 @@
--- Makefile.orig Tue Nov 18 19:42:21 2003
+++ Makefile Wed Feb 4 18:02:25 2004
@@ -1,14 +1,14 @@
-CC = g++
+CXX ?= g++
# Source files
SRC := LeakTracer.cc
# Comment out to disable thread safetly
-THREAD=-DTHREAD_SAVE -D_REENTRANT -D_THREAD_SAFE -pthread
+THREAD=-DTHREAD_SAVE
# Common flags
-C_FLAGS = -g -pipe -Wall -W $(THREAD)
-O_FLAGS = $(C_FLAGS)
+C_FLAGS = $(CFLAGS) -Wall -W $(THREAD) $(PTHREAD_CFLAGS)
+O_FLAGS = $(C_FLAGS) $(PTHREAD_LIBS)
# Object files
OBJ_DIR = .
@@ -32,16 +32,16 @@
(cd .. && tar cvfz /u/erwin/drylock/LeakTracer/LeakTracer.tar.gz -X LeakTracer/.tarexcl LeakTracer/)
$(OBJ_DIR)/%.o: %.cc
- $(CC) -fPIC -c $(C_FLAGS) $< -o $@
+ $(CXX) -fPIC -c $(C_FLAGS) $< -o $@
$(OBJ_DIR)/%.so : $(OBJ_DIR)/%.o
- $(CC) $(O_FLAGS) -shared -o $@ $<
+ $(CXX) $(O_FLAGS) -shared -o $@ $<
README.html: README
/u/erwin/ed/mcl/util/htmlize.pl README
test:
- $(CC) $(C_FLAGS) test.cc -o test
+ $(CXX) $(C_FLAGS) test.cc -o test
./test
./LeakCheck ./test
./leak-analyze ./test

View File

@ -0,0 +1,15 @@
LeakTracer is a small tool for checking a C++ program for memory leaks.
To use LeakTracer, run your program using the provided LeakCheck script. It
uses the LD_PRELOAD feature to "overlay" some functions on top of your
functions (no recompile needed).
LeakTracer uses gdb to print out the exact line where the memory was allocated
and not freed -- this of course means you have to free all dynamically
allocated data. LeakTracer also overrides the global operator new and operator
delete -- this will give problems if you override them as well.
LeakTracer traces only new/new[] and delete calls -- it does not look at
malloc/free/realloc.
WWW: http://www.andreasen.org/LeakTracer/