Removed memwatch debugger

This commit is contained in:
Michiel Broek 2003-08-16 20:45:01 +00:00
parent aaee430a6f
commit 8fe34c922c
270 changed files with 282 additions and 6593 deletions

View File

@ -6,6 +6,11 @@ $Id$
v0.37.6 10-Aug-2003 v0.37.6 10-Aug-2003
general:
Changed all Linux references into GNU/Linux.
Changed the address of the FSF in all sources.
Removed memwatch debugger.
v0.37.5 12-Jul-2003 - 10-Aug-2003 v0.37.5 12-Jul-2003 - 10-Aug-2003

View File

@ -8,9 +8,6 @@
#undef VERSION_REVISION #undef VERSION_REVISION
#undef VERSION #undef VERSION
/* Memory debugging */
#undef MEMWATCH
/* Define if you have the snprintf function. */ /* Define if you have the snprintf function. */
#undef HAVE_SNPRINTF #undef HAVE_SNPRINTF

20
configure vendored
View File

@ -837,11 +837,6 @@ if test -n "$ac_init_help"; then
cat <<\_ACEOF cat <<\_ACEOF
Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-memwatch MEMWATCH debugging
Optional Packages: Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
@ -1781,21 +1776,6 @@ fi
CFLAGS="$CFLAGS -Wall -Wshadow -Wwrite-strings -Wstrict-prototypes" CFLAGS="$CFLAGS -Wall -Wshadow -Wwrite-strings -Wstrict-prototypes"
# Check whether --enable-memwatch or --disable-memwatch was given.
if test "${enable_memwatch+set}" = set; then
enableval="$enable_memwatch"
memwatch=$enableval
else
memwatch=no
fi;
if test "$memwatch" = "yes"; then
cat >>confdefs.h <<\_ACEOF
#define MEMWATCH 1
_ACEOF
fi
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
#define RESTAMP_OLD_POSTINGS 21 #define RESTAMP_OLD_POSTINGS 21
_ACEOF _ACEOF

View File

@ -52,13 +52,6 @@ AC_CHECK_PROG(ZIP, zip, zip)
AC_PATH_PROG(CHOWN, chown, chown, /bin:/sbin:/usr/bin:/usr/sbin:) AC_PATH_PROG(CHOWN, chown, chown, /bin:/sbin:/usr/bin:/usr/sbin:)
CFLAGS="$CFLAGS -Wall -Wshadow -Wwrite-strings -Wstrict-prototypes" CFLAGS="$CFLAGS -Wall -Wshadow -Wwrite-strings -Wstrict-prototypes"
dnl Additional commandline switches
AC_ARG_ENABLE(memwatch, [ --enable-memwatch MEMWATCH debugging], [ memwatch=$enableval ], [ memwatch=no ])
if test "$memwatch" = "yes"; then
AC_DEFINE(MEMWATCH)
fi
dnl Defines for MBSE BBS (must use tests or --enable-stuff later) dnl Defines for MBSE BBS (must use tests or --enable-stuff later)
AC_DEFINE_UNQUOTED(RESTAMP_OLD_POSTINGS, 21) AC_DEFINE_UNQUOTED(RESTAMP_OLD_POSTINGS, 21)
AC_DEFINE(RESTAMP_FUTURE_POSTINGS) AC_DEFINE(RESTAMP_FUTURE_POSTINGS)

106
lib/FAQ
View File

@ -1,106 +0,0 @@
Frequently Asked Questions for memwatch
Q. I'm not getting any log file! What's wrong??
A. Did you define MEMWATCH when compiling all files?
Did you include memwatch.h in all the files?
If you did, then...:
Memwatch creates the file when it initializes. If you're not
getting the log file, it's because a) memwatch is not
initializing or b) it's initializing, but can't create the
file.
Memwatch has two functions, mwInit() and mwTerm(), that
initialize and terminate memwatch, respectively. They are
nestable. You USUALLY don't need to call mwInit() and
mwTerm(), since memwatch will auto-initialize on the first
call to a memory function, and then add mwTerm() to the
atexit() list.
You can call mwInit() and mwTerm() manually, if it's not
initializing properly or if your system doesn't support
atexit(). Call mwInit() as soon as you can, and mwTerm() at
the logical no-error ending of your program. Call mwAbort()
if the program is stopping due to an error; this will
terminate memwatch even if more than one call to mwTerm() is
outstanding.
If you are using C++, remember that global and static C++
objects constructors execute before main() when considering
where to put mwInit(). Also, their destructors execute after
main(). You may want to create a global object very early
with mwInit() in the constructor and mwTerm() in the
destructor. Too bad C++ does not guarantee initialization
order for global objects.
If this didn't help, try adding a call to mwDoFlush(1) after
mwInit(). If THAT didn't help, then memwatch is unable to
create the log file. Check write permissions.
If you can't use a log file, you can still use memwatch by
redirecting the output to a function of your choice. See the
next question.
Q. I'd like memwatch's output to pipe to my fave debugger! How?
A. Call mwSetOutFunc() with the addres of a "void func(int c)"
function. You should also consider doing something about
the ARI handler, see memwatch.h for more details about that.
Q. Why isn't there any C++ support?
A. Because C++ is for sissies! =) Just kidding.
C++ comes with overridable allocation/deallocation
built-in. You can define your own new/delete operators
for any class, and thus circumvent memwatch, or confuse
it to no end. Also, the keywords "new" and "delete" may
appear in declarations in C++, making the preprocessor
replacement approach shaky. You can do it, but it's not
very stable.
If someone were to write a rock solid new/delete checker
for C++, there is no conflict with memwatch; use them both.
Q. I'm getting "WILD free" errors, but the code is bug-free!
A. If memwatch's free() recieves a pointer that wasn't allocated
by memwatch, a "WILD free" message appears. If the source of
the memory buffer is outside of memwatch (a non-standard
library function, for instance), you can use mwFree_() to
release it. mwFree_() calls free() on the pointer given if
memwatch can't recognize it, instead of blocking it.
Another source of "WILD free" messages is that if memwatch
is terminated before all memory allocated is freed, memwatch
will have forgotten about it, and thus generate the errors.
This is commonly caused by having memwatch auto-initialize,
and then using atexit() to clean up. When auto-initializing,
memwatch registers mwTerm() with atexit(), but if mwTerm()
runs before all memory is freed, then you will get "unfreed"
and "WILD free" messages when your own atexit()-registered
cleanup code runs, and frees the memory.
Q. I'm getting "unfreed" errors, but the code is bug-free!
A. You can get erroneous "unfreed" messages if memwatch
terminates before all memory has been freed. Try using
mwInit() and mwTerm() instead of auto-initialization.
If you _are_ using mwInit() and mwTerm(), it may be that
some code in your program executes before mwInit() or
after mwTerm(). Make sure that mwInit() is the first thing
executed, and mwTerm() the last.
Q. When compiling memwatch I get these 'might get clobbered'
errors, and something about a longjmp() inside memwatch.
A. You are using a non-Win32 platform, and most likely using
gcc or egcs, and is probably running with the highest
possible warning levels. This is a Good Thing.
Unfortunately, it seems some compilers get a bit too
paranoid at those levels. There is nothing wrong with
memwatch's code. Nothing that matters will get
clobbered, if the compiler adheres to the ANSI C
standard. Just ignore the warnings.

View File

@ -33,20 +33,17 @@ MBINET_HDRS = mbinet.h
DIESEL_SRCS = diesel.c mbdiesel.c DIESEL_SRCS = diesel.c mbdiesel.c
DIESEL_HDRS = diesel.h DIESEL_HDRS = diesel.h
DIESEL_OBJS = diesel.o mbdiesel.o DIESEL_OBJS = diesel.o mbdiesel.o
MEMWATCH_SRCS = memwatch.c
MEMWATCH_OBJS = memwatch.o
MEMWATCH_HDRS = memwatch.h
OTHER_HDRS = ansi.h bluewave.h libs.h mbse.h records.h structs.h users.h mberrors.h OTHER_HDRS = ansi.h bluewave.h libs.h mbse.h records.h structs.h users.h mberrors.h
SRCS = ${CLCOMM_SRCS} ${COMMON_SRCS} ${DBASE_SRCS} ${MSGBASE_SRCS} ${MBINET_SRCS} \ SRCS = ${CLCOMM_SRCS} ${COMMON_SRCS} ${DBASE_SRCS} ${MSGBASE_SRCS} ${MBINET_SRCS} \
${DIESEL_SRCS} ${MEMWATCH_SRCS} ${NODELIST_SRCS} ${DIESEL_SRCS} ${NODELIST_SRCS}
OBJS = ${CLCOMM_OBJS} ${COMMON_OBJS} ${DBASE_OBJS} ${MSGBASE_OBJS} ${MBINET_OBJS} \ OBJS = ${CLCOMM_OBJS} ${COMMON_OBJS} ${DBASE_OBJS} ${MSGBASE_OBJS} ${MBINET_OBJS} \
${DIESEL_OBJS} ${MEMWATCH_OBJS} ${NODELIST_OBJS} ${DIESEL_OBJS} ${NODELIST_OBJS}
HDRS = ${CLCOMM_HDRS} ${COMMON_HDRS} ${DBASE_HDRS} ${MSGBASE_HDRS} ${MBINET_HDRS} \ HDRS = ${CLCOMM_HDRS} ${COMMON_HDRS} ${DBASE_HDRS} ${MSGBASE_HDRS} ${MBINET_HDRS} \
${DIESEL_HDRS} ${MEMWATCH_HDRS} ${NODELIST_HDRS} ${OTHER_HDRS} ${DIESEL_HDRS} ${NODELIST_HDRS} ${OTHER_HDRS}
OTHER = Makefile README ftscprod.006 mkprod.awk FAQ README.memwatch USING test.c \ OTHER = Makefile README ftscprod.006 mkprod.awk \
memwatch.c.org README.diesel README.macro Diesel.doc nodelist.conf README.diesel README.macro Diesel.doc nodelist.conf
TARGET = libclcomm.a libcommon.a libdbase.a libmsgbase.a libmbinet.a libdiesel.a \ TARGET = libclcomm.a libcommon.a libdbase.a libmsgbase.a libmbinet.a libdiesel.a \
libmemwatch.a libnodelist.a libnodelist.a
############################################################################# #############################################################################
@ -82,10 +79,6 @@ libdiesel.a: ${DIESEL_OBJS}
ar r $@ $? ar r $@ $?
${RANLIB} $@ ${RANLIB} $@
libmemwatch.a: ${MEMWATCH_OBJS}
ar r $@ $?
${RANLIB} $@
libnodelist.a: ${NODELIST_OBJS} libnodelist.a: ${NODELIST_OBJS}
ar r $@ $? ar r $@ $?
${RANLIB} $@ ${RANLIB} $@
@ -124,56 +117,56 @@ depend: ftscprod.c
# DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT # DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT
# Dependencies generated by make depend # Dependencies generated by make depend
clcomm.o: ../config.h libs.h memwatch.h mberrors.h clcomm.h clcomm.o: ../config.h libs.h mberrors.h clcomm.h
client.o: ../config.h libs.h memwatch.h clcomm.h client.o: ../config.h libs.h clcomm.h
crc.o: ../config.h libs.h memwatch.h clcomm.h crc.o: ../config.h libs.h clcomm.h
semafore.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h semafore.o: ../config.h libs.h structs.h clcomm.h common.h
signame.o: ../config.h libs.h memwatch.h clcomm.h signame.o: ../config.h libs.h clcomm.h
attach.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h common.h attach.o: ../config.h libs.h structs.h users.h records.h clcomm.h common.h
falists.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h falists.o: ../config.h libs.h structs.h clcomm.h common.h
hdr.o: ../config.h libs.h memwatch.h structs.h common.h hdr.o: ../config.h libs.h structs.h common.h
parsedate.o: ../config.h libs.h memwatch.h structs.h common.h parsedate.o: ../config.h libs.h structs.h common.h
rfcmsg.o: ../config.h libs.h memwatch.h structs.h users.h records.h common.h clcomm.h rfcmsg.o: ../config.h libs.h structs.h users.h records.h common.h clcomm.h
unpacker.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h common.h unpacker.o: ../config.h libs.h structs.h users.h records.h clcomm.h common.h
batchrd.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h batchrd.o: ../config.h libs.h structs.h clcomm.h common.h
ftn.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h dbftn.h common.h ftn.o: ../config.h libs.h structs.h users.h records.h clcomm.h dbftn.h common.h
pktname.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h common.h pktname.o: ../config.h libs.h structs.h users.h records.h clcomm.h common.h
mangle.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h mangle.o: ../config.h libs.h structs.h clcomm.h common.h
sectest.o: ../config.h libs.h structs.h common.h clcomm.h sectest.o: ../config.h libs.h structs.h common.h clcomm.h
dostran.o: ../config.h libs.h memwatch.h structs.h users.h records.h common.h proglock.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h
ftnmsg.o: ../config.h libs.h memwatch.h structs.h common.h clcomm.h dostran.o: ../config.h libs.h structs.h users.h records.h common.h
mbfile.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h ftnmsg.o: ../config.h libs.h structs.h common.h clcomm.h
nodelock.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h mbfile.o: ../config.h libs.h structs.h clcomm.h common.h
rawio.o: ../config.h libs.h memwatch.h structs.h common.h mberrors.h nodelock.o: ../config.h libs.h structs.h clcomm.h common.h
strcasestr.o: ../config.h libs.h memwatch.h rawio.o: ../config.h libs.h structs.h common.h mberrors.h
execute.o: ../config.h libs.h memwatch.h structs.h clcomm.h mberrors.h common.h strcasestr.o: ../config.h libs.h
expipe.o: ../config.h libs.h memwatch.h structs.h clcomm.h mberrors.h common.h execute.o: ../config.h libs.h structs.h clcomm.h mberrors.h common.h
getheader.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h common.h expipe.o: ../config.h libs.h structs.h clcomm.h mberrors.h common.h
noderecord.o: ../config.h libs.h memwatch.h structs.h common.h users.h records.h dbnode.h common.h getheader.o: ../config.h libs.h structs.h users.h records.h clcomm.h common.h
rfcaddr.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h common.h noderecord.o: ../config.h libs.h structs.h common.h users.h records.h dbnode.h common.h
strutil.o: ../config.h libs.h memwatch.h structs.h common.h rfcaddr.o: ../config.h libs.h structs.h users.h records.h clcomm.h common.h
faddr.o: ../config.h libs.h memwatch.h structs.h common.h strutil.o: ../config.h libs.h structs.h common.h
gmtoffset.o: ../config.h libs.h memwatch.h structs.h common.h faddr.o: ../config.h libs.h structs.h common.h
packet.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h common.h dbnode.h gmtoffset.o: ../config.h libs.h structs.h common.h
rfcdate.o: ../config.h libs.h memwatch.h structs.h common.h clcomm.h packet.o: ../config.h libs.h structs.h users.h records.h clcomm.h common.h dbnode.h
term.o: ../config.h libs.h memwatch.h structs.h users.h ansi.h records.h common.h rfcdate.o: ../config.h libs.h structs.h common.h clcomm.h
endian.o: ../config.h libs.h memwatch.h structs.h common.h term.o: ../config.h libs.h structs.h users.h ansi.h records.h common.h
dbcfg.o: ../config.h libs.h memwatch.h mbse.h structs.h users.h records.h mberrors.h dbcfg.h endian.o: ../config.h libs.h structs.h common.h
dbdupe.o: ../config.h libs.h memwatch.h structs.h clcomm.h mberrors.h dbdupe.h dbcfg.o: ../config.h libs.h mbse.h structs.h users.h records.h mberrors.h dbcfg.h
dbftn.o: ../config.h libs.h memwatch.h structs.h users.h records.h dbcfg.h dbftn.h dbdupe.o: ../config.h libs.h structs.h clcomm.h mberrors.h dbdupe.h
dbmsgs.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h dbcfg.h dbmsgs.h dbftn.o: ../config.h libs.h structs.h users.h records.h dbcfg.h dbftn.h
dbnode.o: ../config.h libs.h memwatch.h structs.h common.h users.h records.h clcomm.h dbcfg.h dbnode.h dbmsgs.o: ../config.h libs.h structs.h users.h records.h clcomm.h dbcfg.h dbmsgs.h
dbtic.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h dbcfg.h dbtic.h dbnode.o: ../config.h libs.h structs.h common.h users.h records.h clcomm.h dbcfg.h dbnode.h
dbuser.o: ../config.h libs.h memwatch.h structs.h users.h records.h dbcfg.h dbuser.h dbtic.o: ../config.h libs.h structs.h users.h records.h clcomm.h dbcfg.h dbtic.h
jammsg.o: ../config.h libs.h memwatch.h clcomm.h msgtext.h msg.h jam.h jammsg.h dbuser.o: ../config.h libs.h structs.h users.h records.h dbcfg.h dbuser.h
msg.o: ../config.h libs.h memwatch.h msgtext.h msg.h jammsg.h jammsg.o: ../config.h libs.h clcomm.h msgtext.h msg.h jam.h jammsg.h
msgtext.o: ../config.h libs.h memwatch.h msgtext.h msg.h msg.o: ../config.h libs.h msgtext.h msg.h jammsg.h
nntp.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h mbinet.h msgtext.o: ../config.h libs.h msgtext.h msg.h
pop3.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h mbinet.h nntp.o: ../config.h libs.h structs.h users.h records.h clcomm.h mbinet.h
smtp.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h mbinet.h pop3.o: ../config.h libs.h structs.h users.h records.h clcomm.h mbinet.h
diesel.o: ../config.h libs.h memwatch.h diesel.h smtp.o: ../config.h libs.h structs.h users.h records.h clcomm.h mbinet.h
mbdiesel.o: ../config.h libs.h memwatch.h structs.h users.h records.h common.h clcomm.h diesel.h diesel.o: ../config.h libs.h diesel.h
memwatch.o: ../config.h libs.h memwatch.h mbdiesel.o: ../config.h libs.h structs.h users.h records.h common.h clcomm.h diesel.h
nodelist.o: ../config.h libs.h structs.h users.h records.h clcomm.h common.h mberrors.h nodelist.h nodelist.o: ../config.h libs.h structs.h users.h records.h clcomm.h common.h mberrors.h nodelist.h
ftscprod.o: ../config.h libs.h memwatch.h structs.h common.h ftscprod.o: ../config.h libs.h structs.h common.h
# End of generated dependencies # End of generated dependencies

View File

@ -1,98 +0,0 @@
README for MEMWATCH 2.62
This file should be enough to get you started, and should be
enough for small projects. For more info, see the files USING
and the FAQ. If this is not enough, see memwatch.h, which is
well documented.
If you choose to use memwatch to validate your projects, I
would love to hear about it. Please drop me a line at
johan@link-data.com about the project itself, the hardware,
operating system, compiler and any URL(s) you feel is
appropriate. I will then post it at:
http://www.link-data.com/memwatchusers.html
***** To run the test program:
Look at the source code for test.c first. It does some really
nasty things, and I want you to be aware of that. If memwatch
can't capture SIGSEGV (General Protection Fault for Windoze),
your program will dump core (crash for Windoze).
Once you've done that, you can build the test program.
Linux and other *nixes with gcc:
gcc -o test -DMEMWATCH -DMEMWATCH_STDIO test.c memwatch.c
Windows 95, Windows NT with MS Visual C++:
cl -DMEMWATCH -DMEMWATCH_STDIO test.c memwatch.c
Then simply run the test program.
./test
***** Quick-start instructions:
1. Make sure that memwatch.h is included in all of the
source code files. If you have an include file that
all of the source code uses, you might be able to include
memwatch.h from there.
2. Recompile the program with MEMWATCH defined. See your
compiler's documentation if you don't know how to do this.
The usual switch looks like "-DMEMWATCH". To have MEMWATCH
use stderr for some output (like, "Abort, Retry, Ignore?"),
please also define MW_STDIO (or MEMWATCH_STDIO, same thing).
3. Run the program and examine the output in the
log file "memwatch.log". If you didn't get a log file,
you probably didn't do step 1 and 2 correctly, or your
program crashed before memwatch flushed the file buffer.
To have memwatch _always_ flush the buffer, add a call
to "mwDoFlush(1)" at the top of your main function.
4. There is no fourth step... but remember that there
are limits to what memwatch can do, and that you need
to be aware of them:
***** Limits to memwatch:
Memwatch cannot catch all wild pointer writes. It can catch
those it could make itself due to your program trashing
memwatch's internal data structures. It can catch, sort of,
wild writes into No Mans Land buffers (see the header file for
more info). Anything else and you're going to get core dumped,
or data corruption if you're lucky.
There are other limits of course, but that one is the most
serious one, and the one that you're likely to be suffering
from.
***** Can use memwatch with XXXXX?
Probably the answer is yes. It's been tested with several
different platforms and compilers. It may not work on yours
though... but there's only one way to find out.
***** Need more assistance?
I don't want e-mail on "how to program in C", or "I've got a
bug, help me". I _do_ want you to send email to me if you
find a bug in memwatch, or if it won't compile cleanly on your
system (assuming it's an ANSI-C compiler of course).
If you need help with using memwatch, read the header file.
If, after reading the header file, you still can't resolve the
problem, please mail me with the details.
I can be reached at "johan@link-data.com".
The latest version of memwatch should be found at
"http://www.link-data.com/".
Johan Lindh

169
lib/USING
View File

@ -1,169 +0,0 @@
Using memwatch
==============
What is it?
Memwatch is primarily a memory leak detector for C. Besides
detecting leaks, it can do a bunch of other stuff, but lets
stay to the basics. If you _really_ want to know all the
gory details, you should check out the header file,
memwatch.h, and the source code. It's actually got some
comments! (Whoa, what a concept!)
How do I get the latest version?
http://www.link-data.com/sourcecode.html
ftp://ftp.link-data.com/pub/memwatch/
How does it work?
Using the C preprocessor, memwatch replaces all your
programs calls to ANSI C memory allocation functions with
calls to it's own functions, which keeps a record of all
allocations.
Memwatch is very unobtrusive; unless the define MEMWATCH is
defined, memwatch removes all traces of itself from the
code (using the preprocessor).
Memwatch normally writes it's data to the file
memwatch.log, but this can be overridden; see the section
on I/O, later.
Initialization and cleanup
In order to do it's work in a timely fashion, memwatch
needs to do some startup and cleanup work. mwInit()
initializes memwatch and mwTerm() terminates it. Memwatch
can auto-initialize, and will do so if you don't call
mwInit() yourself. If this is the case, memwatch will use
atexit() to register mwTerm() to the atexit-queue.
The auto-init technique has a caveat; if you are using
atexit() yourself to do cleanup work, memwatch may
terminate before your program is done. To be on the safe
side, use mwInit() and mwTerm().
mwInit() and mwTerm() is nestable, so you can call mwInit()
several times, requiring mwTerm() to be called an equal
number of times to terminate memwatch.
In case of the program aborting in a controlled way, you
may want to call mwAbort() instead of mwTerm(). mwAbort()
will terminate memwatch even if there are outstanding calls
to mwTerm().
I/O operations
During normal operations, memwatch creates a file named
memwatch.log. Sometimes, memwatch.log can't be created;
then memwatch tries to create files name memwatNN.log,
where NN is between 01 and 99. If that fails, no log will
be produced.
If you can't use a file log, or don't want to, no worry.
Just call mwSetOutFunc() with the address of a "void
func(int c)" function, and all output will be directed
there, character by character.
Memwatch also has an Abort/Retry/Ignore handler that is
used when an ASSERT or VERIFY fails. The default handler
does no I/O, but automatically aborts the program. You can
use any handler you want; just send the address of a "int
func(const char*)" to mwSetAriFunc(). For more details on
that, see memwatch.h.
TRACE/ASSERT/VERIFY macros
Memwatch defines (if not already defined) the macros TRACE,
ASSERT and VERIFY. If you are already using macros with
these names, memwatch 2.61 and later will not override
them. Memwatch 2.61 and later will also always define the
macros mwTRACE, mwASSERT and mwVERIFY, so you can use these
to make sure you're talking to memwatch. Versions previous
to 2.61 will OVERRIDE TRACE, ASSERT and VERIFY.
To make sure that existing TRACE, ASSERT and VERIFY macros
are preserved, you can define MW_NOTRACE, MW_NOASSERT and
MW_NOVERIFY. All versions of memwatch will abide by these.
Stress-testing the application
You can simulate low-memory conditions using mwLimit().
mwLimit() takes the maximum number of bytes to be
allocated; when the limit is hit, allocation requests will
fail, and a "limit" message will be logged.
If you hit a real low-memory situation, memwatch logs that
too. Memwatch itself has some reserve memory tucked away so
it should continue running even in the worst conditions.
Hunting down wild writes and other Nasty Things
Wild writes are usually caused by using pointers that arent
initialized, or that were initialized, but then the memory
they points to is moved or freed. The best way to avoid
these kind of problems is to ALWAYS initialize pointers to
NULL, and after freeing a memory buffer, setting all
pointers that pointed to it to NULL.
To aid in tracking down uninitialized pointers memwatch
zaps all memory with certain values. Recently allocated
memory (unless calloc'd, of course), contains 0xFE.
Recently freed memory contains 0xFD. So if your program
crashes when using memwatch and not without memwatch, it's
most likely because you are not initializing your allocated
buffers, or using the buffers after they've been freed.
In the event that a wild pointer should damage memwatch's
internal data structures, memwatch employs checksums,
multiple copies of some values, and can also repair it's
own data structures.
If you are a paranoid person, and as programmer you should
be, you can use memwatch's mwIsReadAddr() and
mwIsSafeAddr() functions to check the accessibility of
memory. These are implemented for both ANSI C systems and
Win32 systems. Just put an mwASSERT() around the check and
forget about it.
Can I help?
Well, sure. For instance, I like memwatch to compile
without any warnings or errors. If you are using an ANSI C
compliant compiler, and are getting warnings or errors,
please mail me the details and instructions on how to fix
them, if you can.
Another thing you can do if you decide to use memwatch is
to mail me the name of the project(s) (and URL, if any),
hardware and operating system, compiler and what user
(organization). I will then post this info on the list of
memwatch users.
(http://www.link-data.com/memwatchusers.html)
Top five problems using memwatch
5. Passed a non-memwatch allocated pointer to memwatch's
free(). Symtom: Causes an erroneous "WILD free" log
entry to appear. Cure: Either include memwatch.h for
the file that allocates, or use mwFree_() to free it.
4. Relied on auto-initialization when using atexit().
Symptom: Causes incorrect "unfreed" and "WILD free"
messages. Cure: Use mwInit() and mwTerm().
3. Forgot to include memwatch.h in all files. Symptom:
Tends to generate "WILD free" and "unfreed" messages.
Cure: Make sure to include memwatch.h!
2. No write permissions in currect directory. Symptom:
Seems like memwatch 'just aint working'. Cure: Use
mwSetOutFunc() to redirect output.
...and the number one problem is...
1. Didn't define MEMWATCH when compiling. Symptom:
Memwatch dutifully disables itself. Cure: Try adding
-DMEMWATCH to the command line.

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "users.h" #include "users.h"
#include "records.h" #include "records.h"

View File

@ -31,7 +31,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "clcomm.h" #include "clcomm.h"
#include "common.h" #include "common.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "mberrors.h" #include "mberrors.h"
#include "clcomm.h" #include "clcomm.h"
@ -143,9 +142,6 @@ void ExitClient(int errcode)
if (pbuff) if (pbuff)
free(pbuff); free(pbuff);
#ifdef MEMWATCH
mwTerm();
#endif
exit(errcode); exit(errcode);
} }

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "clcomm.h" #include "clcomm.h"
static int sock = -1; /* Unix Datagram socket */ static int sock = -1; /* Unix Datagram socket */

View File

@ -31,7 +31,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "clcomm.h" #include "clcomm.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "mbse.h" #include "mbse.h"
#include "structs.h" #include "structs.h"
#include "users.h" #include "users.h"
@ -67,9 +66,6 @@ void LoadConfig(void)
printf("Please run mbsetup to create configuration file.\n"); printf("Please run mbsetup to create configuration file.\n");
printf("Or check that your MBSE_ROOT variable is set to the BBS path!\n\n"); printf("Or check that your MBSE_ROOT variable is set to the BBS path!\n\n");
free(FileName); free(FileName);
#ifdef MEMWATCH
mwTerm();
#endif
exit(MBERR_CONFIG_ERROR); exit(MBERR_CONFIG_ERROR);
} }

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "clcomm.h" #include "clcomm.h"
#include "mberrors.h" #include "mberrors.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "users.h" #include "users.h"
#include "records.h" #include "records.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "users.h" #include "users.h"
#include "records.h" #include "records.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "common.h" #include "common.h"
#include "users.h" #include "users.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "users.h" #include "users.h"
#include "records.h" #include "records.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "users.h" #include "users.h"
#include "records.h" #include "records.h"

View File

@ -328,7 +328,6 @@ documented above, in outstring.
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "diesel.h" #include "diesel.h"
/* Get(<var>, <structure_type>) allocates a new <structure_type> and /* Get(<var>, <structure_type>) allocates a new <structure_type> and

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "users.h" #include "users.h"
#include "records.h" #include "records.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "common.h" #include "common.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "clcomm.h" #include "clcomm.h"
#include "mberrors.h" #include "mberrors.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "clcomm.h" #include "clcomm.h"
#include "mberrors.h" #include "mberrors.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "common.h" #include "common.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "clcomm.h" #include "clcomm.h"
#include "common.h" #include "common.h"

View File

@ -33,7 +33,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "users.h" #include "users.h"
#include "records.h" #include "records.h"

View File

@ -31,7 +31,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "common.h" #include "common.h"
#include "clcomm.h" #include "clcomm.h"

View File

@ -32,7 +32,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "users.h" #include "users.h"
#include "records.h" #include "records.h"

View File

@ -31,7 +31,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "common.h" #include "common.h"

View File

@ -31,7 +31,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "common.h" #include "common.h"

View File

@ -36,7 +36,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "clcomm.h" #include "clcomm.h"
#include "msgtext.h" #include "msgtext.h"
#include "msg.h" #include "msg.h"

View File

@ -32,7 +32,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "clcomm.h" #include "clcomm.h"
#include "common.h" #include "common.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "users.h" #include "users.h"
#include "records.h" #include "records.h"

View File

@ -41,7 +41,6 @@
#define MBERR_GENERAL 131 /* General error */ #define MBERR_GENERAL 131 /* General error */
#define MBERR_TIMEOUT 132 /* Timeout error */ #define MBERR_TIMEOUT 132 /* Timeout error */
#define MBERR_TTYIO 200 /* Base for ttyio errors */ #define MBERR_TTYIO 200 /* Base for ttyio errors */
#define MBERR_MEMWATCH 255 /* Memwatch error */
#define MBERR_EXTERNAL 256 /* Status external prog + 256 */ #define MBERR_EXTERNAL 256 /* Status external prog + 256 */
#endif #endif

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "clcomm.h" #include "clcomm.h"
#include "common.h" #include "common.h"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,701 +0,0 @@
/*
** MEMWATCH.H
** Nonintrusive ANSI C memory leak / overwrite detection
** Copyright (C) 1992-99 Johan Lindh
** All rights reserved.
** Version 2.62
**
************************************************************************
**
** PURPOSE:
**
** MEMWATCH has been written to allow guys and gals that like to
** program in C a public-domain memory error control product.
** I hope you'll find it's as advanced as most commercial packages.
** The idea is that you use it during the development phase and
** then remove the MEMWATCH define to produce your final product.
** MEMWATCH is distributed in source code form in order to allow
** you to compile it for your platform with your own compiler.
** It's aim is to be 100% ANSI C, but some compilers are more stingy
** than others. If it doesn't compile without warnings, please mail
** me the configuration of operating system and compiler you are using
** along with a description of how to modify the source, and the version
** number of MEMWATCH that you are using.
**
************************************************************************
**
** And now for some legalese...
**
** LICENSE:
**
** You are granted a non-exclusive right to use MEMWATCH in your
** programs, provided that you agree to the following terms:
**
** 1. Johan Lindh retains the full copyright of MEMWATCH, and owns
** all rights to it. This means you can't sell it yourself, or
** ship it as part of another product, or as part of a package.
** 2. If you modify any of the files, you must not give them to
** anyone else. But please send me a copy of the changes,
** along with a text as to why they should be implemented.
** 3. You read and agree to the DISCLAIMER, below.
**
** DISCLAIMER:
**
** THIS SOFTWARE IS PROVIDED FREE OF CHARGE 'AS IS' AND JOHAN LINDH MAKES
** NO EXPRESS OR IMPLIED WARRANTIES WITH RESPECT TO IT. JOHAN LINDH WILL
** NOT BE LIABLE FOR ANY DAMAGES, DIRECT OR INDIRECT, ARISING FROM THE
** USAGE OR HANDLING OF THIS SOFTWARE.
**
************************************************************************
**
** REVISION HISTORY:
**
** 920810 JLI [1.00]
** 920830 JLI [1.10 double-free detection]
** 920912 JLI [1.15 mwPuts, mwGrab/Drop, mwLimit]
** 921022 JLI [1.20 ASSERT and VERIFY]
** 921105 JLI [1.30 C++ support and TRACE]
** 921116 JLI [1.40 mwSetOutFunc]
** 930215 JLI [1.50 modified ASSERT/VERIFY]
** 930327 JLI [1.51 better auto-init & PC-lint support]
** 930506 JLI [1.55 MemWatch class, improved C++ support]
** 930507 JLI [1.60 mwTest & CHECK()]
** 930809 JLI [1.65 Abort/Retry/Ignore]
** 930820 JLI [1.70 data dump when unfreed]
** 931016 JLI [1.72 modified C++ new/delete handling]
** 931108 JLI [1.77 mwSetAssertAction() & some small changes]
** 940110 JLI [1.80 no-mans-land alloc/checking]
** 940328 JLI [2.00 version 2.0 rewrite]
** Improved NML (no-mans-land) support.
** Improved performance (especially for free()ing!).
** Support for 'read-only' buffers (checksums)
** ^^ NOTE: I never did this... maybe I should?
** FBI (free'd block info) tagged before freed blocks
** Exporting of the mwCounter variable
** mwBreakOut() localizes debugger support
** Allocation statistics (global, per-module, per-line)
** Self-repair ability with relinking
** 950913 JLI [2.10 improved garbage handling]
** 951201 JLI [2.11 improved auto-free in emergencies]
** 960125 JLI [X.01 implemented auto-checking using mwAutoCheck()]
** 960514 JLI [2.12 undefining of existing macros]
** 960515 JLI [2.13 possibility to use default new() & delete()]
** 960516 JLI [2.20 suppression of file flushing on unfreed msgs]
** 960516 JLI [2.21 better support for using MEMWATCH with DLL's]
** 960710 JLI [X.02 multiple logs and mwFlushNow()]
** 960801 JLI [2.22 merged X.01 version with current]
** 960805 JLI [2.30 mwIsXXXXAddr() to avoid unneeded GP's]
** 960805 JLI [2.31 merged X.02 version with current]
** 961002 JLI [2.32 support for realloc() + fixed STDERR bug]
** 961222 JLI [2.40 added mwMark() & mwUnmark()]
** 970101 JLI [2.41 added over/underflow checking after failed ASSERT/VERIFY]
** 970113 JLI [2.42 added support for PC-Lint 7.00g]
** 970207 JLI [2.43 added support for strdup()]
** 970209 JLI [2.44 changed default filename to lowercase]
** 970405 JLI [2.45 fixed bug related with atexit() and some C++ compilers]
** 970723 JLI [2.46 added MW_ARI_NULLREAD flag]
** 970813 JLI [2.47 stabilized marker handling]
** 980317 JLI [2.48 ripped out C++ support; wasn't working good anyway]
** 980318 JLI [2.50 improved self-repair facilities & SIGSEGV support]
** 980417 JLI [2.51 more checks for invalid addresses]
** 980512 JLI [2.52 moved MW_ARI_NULLREAD to occur before aborting]
** 990112 JLI [2.53 added check for empty heap to mwIsOwned]
** 990217 JLI [2.55 improved the emergency repairs diagnostics and NML]
** 990224 JLI [2.56 changed ordering of members in structures]
** 990303 JLI [2.57 first maybe-fixit-for-hpux test]
** 990516 JLI [2.58 added 'static' to the definition of mwAutoInit]
** 990517 JLI [2.59 fixed some high-sensitivity warnings]
** 990610 JLI [2.60 fixed some more high-sensitivity warnings]
** 990715 JLI [2.61 changed TRACE/ASSERT/VERIFY macro names]
** 991001 JLI [2.62 added CHECK_BUFFER() and mwTestBuffer()]
**
** To use, simply include 'MEMWATCH.H' as a header file,
** and add MEMWATCH.C to your list of files, and define the macro
** 'MEMWATCH'. If this is not defined, MEMWATCH will disable itself.
**
** To call the standard C malloc / realloc / calloc / free; use mwMalloc_(),
** mwCalloc_() and mwFree_(). Note that mwFree_() will correctly
** free both malloc()'d memory as well as mwMalloc()'d.
**
** 980317: C++ support has been disabled.
** The code remains, but is not compiled.
**
** For use with C++, which allows use of inlining in header files
** and class specific new/delete, you must also define 'new' as
** 'mwNew' and 'delete' as 'mwDelete'. Do this *after* you include
** C++ header files from libraries, otherwise you can mess up their
** class definitions. If you don't define these, the C++ allocations
** will not have source file and line number information. Also note,
** most C++ class libraries implement their own C++ memory management,
** and don't allow anyone to override them. MFC belongs to this crew.
** In these cases, the only thing to do is to use MEMWATCH_NOCPP.
**
** You can capture output from MEMWATCH using mwSetOutFunc().
** Just give it the adress of a "void myOutFunc(int c)" function,
** and all characters to be output will be redirected there.
**
** A failing ASSERT() or VERIFY() will normally always abort your
** program. This can be changed using mwSetAriFunc(). Give it a
** pointer to a "int myAriFunc(const char *)" function. Your function
** must ask the user whether to Abort, Retry or Ignore the trap.
** Return 2 to Abort, 1 to Retry or 0 to Ignore. Beware retry; it
** causes the expression to be evaluated again! MEMWATCH has a
** default ARI handler. It's disabled by default, but you can enable
** it by calling 'mwDefaultAri()'. Note that this will STILL abort
** your program unless you define MEMWATCH_STDIO to allow MEMWATCH
** to use the standard C I/O streams. Also, setting the ARI function
** will cause MEMWATCH *NOT* to write the ARI error to stderr. The
** error string is passed to the ARI function instead, as the
** 'const char *' parameter.
**
** You can disable MEMWATCH's ASSERT/VERIFY and/or TRACE implementations.
** This can be useful if you're using a debug terminal or smart debugger.
** Disable them by defining MW_NOASSERT, MW_NOVERIFY or MW_NOTRACE.
**
** MEMWATCH fills all allocated memory with the byte 0xFE, so if
** you're looking at erroneous data which are all 0xFE:s, the
** data probably was not initialized by you. The exception is
** calloc(), which will fill with zero's. All freed buffers are
** zapped with 0xFD. If this is what you look at, you're using
** data that has been freed. If this is the case, be aware that
** MEMWATCH places a 'free'd block info' structure immediately
** before the freed data. This block contains info about where
** the block was freed. The information is in readable text,
** in the format "FBI<counter>filename(line)", for example:
** "FBI<267>test.c(12)". Using FBI's slows down free(), so it's
** disabled by default. Use mwFreeBufferInfo(1) to enable it.
**
** To aid in tracking down wild pointer writes, MEMWATCH can perform
** no-mans-land allocations. No-mans-land will contain the byte 0xFC.
** MEMWATCH will, when this is enabled, convert recently free'd memory
** into NML allocations.
**
** MEMWATCH protects it's own data buffers with checksums. If you
** get an internal error, it means you're overwriting wildly,
** or using an uninitialized pointer.
**
************************************************************************
**
** Note when compiling with Microsoft C:
** - MSC ignores fflush() by default. This is overridden, so that
** the disk log will always be current.
**
** This utility has been tested with:
** PC-lint 7.0k, passed as 100% ANSI C compatible
** Microsoft Visual C++ on Win16 and Win32
** Microsoft C on DOS
** SAS C on an Amiga 500
** Gnu C on a PC running Red Hat Linux
** ...and using an (to me) unknown compiler on an Atari machine.
**
************************************************************************
**
** Format of error messages in MEMWATCH.LOG:
** message: <sequence-number> filename(linenumber), information
**
** Errors caught by MemWatch, when they are detected, and any
** actions taken besides writing to the log file MEMWATCH.LOG:
**
** Double-freeing:
** A pointer that was recently freed and has not since been
** reused was freed again. The place where the previous free()
** was executed is displayed.
** Detect: delete or free() using the offending pointer.
** Action: The delete or free() is cancelled, execution continues.
** Underflow:
** You have written just ahead of the allocated memory.
** The size and place of the allocation is displayed.
** Detect: delete or free() of the damaged buffer.
** Action: The buffer is freed, but there may be secondary damage.
** Overflow:
** Like underflow, but you've written after the end of the buffer.
** Detect: see Underflow.
** Action: see Underflow.
** WILD free:
** An unrecognized pointer was passed to delete or free().
** The pointer may have been returned from a library function;
** in that case, use mwFree_() to force free() of it.
** Also, this may be a double-free, but the previous free was
** too long ago, causing MEMWATCH to 'forget' it.
** Detect: delete or free() of the offending pointer.
** Action: The delete or free() is cancelled, execution continues.
** NULL free:
** It's unclear to me whether or not freeing of NULL pointers
** is legal in ANSI C, therefore a warning is written to the log file,
** but the error counter remains the same. This is legal using C++,
** so the warning does not appear with delete.
** Detect: When you free(NULL).
** Action: The free() is cancelled.
** Failed:
** A request to allocate memory failed. If the allocation is
** small, this may be due to memory depletion, but is more likely
** to be memory fragmentation problems. The amount of memory
** allocated so far is displayed also.
** Detect: When you new, malloc(), realloc() or calloc() memory.
** Action: NULL is returned.
** Realloc:
** A request to re-allocate a memory buffer failed for reasons
** other than out-of-memory. The specific reason is shown.
** Detect: When you realloc()
** Action: realloc() is cancelled, NULL is returned
** Limit fail:
** A request to allocate memory failed since it would violate
** the limit set using mwLimit(). mwLimit() is used to stress-test
** your code under simulated low memory conditions.
** Detect: At new, malloc(), realloc() or calloc().
** Action: NULL is returned.
** Assert trap:
** An ASSERT() failed. The ASSERT() macro works like C's assert()
** macro/function, except that it's interactive. See your C manual.
** Detect: On the ASSERT().
** Action: Program ends with an advisory message to stderr, OR
** Program writes the ASSERT to the log and continues, OR
** Program asks Abort/Retry/Ignore? and takes that action.
** Verify trap:
** A VERIFY() failed. The VERIFY() macro works like ASSERT(),
** but if MEMWATCH is not defined, it still evaluates the
** expression, but it does not act upon the result.
** Detect: On the VERIFY().
** Action: Program ends with an advisory message to stderr, OR
** Program writes the VERIFY to the log and continues, OR
** Program asks Abort/Retry/Ignore? and takes that action.
** Wild pointer:
** A no-mans-land buffer has been written into. MEMWATCH can
** allocate and distribute chunks of memory solely for the
** purpose of trying to catch random writes into memory.
** Detect: Always on CHECK(), but can be detected in several places.
** Action: The error is logged, and if an ARI handler is installed,
** it is executed, otherwise, execution continues.
** Unfreed:
** A memory buffer you allocated has not been freed.
** You are informed where it was allocated, and whether any
** over or underflow has occured. MemWatch also displays up to
** 16 bytes of the data, as much as it can, in hex and text.
** Detect: When MemWatch terminates.
** Action: The buffer is freed.
** Check:
** An error was detected during a CHECK() operation.
** The associated pointer is displayed along with
** the file and line where the CHECK() was executed.
** Followed immediately by a normal error message.
** Detect: When you CHECK()
** Action: Depends on the error
** Relink:
** After a MEMWATCH internal control block has been trashed,
** MEMWATCH tries to repair the damage. If successful, program
** execution will continue instead of aborting. Some information
** about the block may be gone permanently, though.
** Detect: N/A
** Action: Relink successful: program continues.
** Relink fails: program aborts.
** Internal:
** An internal error is flagged by MEMWATCH when it's control
** structures have been damaged. You are likely using an uninitialized
** pointer somewhere in your program, or are zapping memory all over.
** The message may give you additional diagnostic information.
** If possible, MEMWATCH will recover and continue execution.
** Detect: Various actions.
** Action: Whatever is needed
** Mark:
** The program terminated without umarking all marked pointers. Marking
** can be used to track resources other than memory. mwMark(pointer,text,...)
** when the resource is allocated, and mwUnmark(pointer) when it's freed.
** The 'text' is displayed for still marked pointers when the program
** ends.
** Detect: When MemWatch terminates.
** Action: The error is logged.
**
**
************************************************************************
**
** The author may be reached by e-mail at the address below. If you
** mail me about source code changes in MEMWATCH, remember to include
** MW's version number.
**
** Johan Lindh
** johan@link-data.com
**
** The latest version of MEMWATCH may be downloaded from
** http://www.link-data.com/
*/
#ifdef MEMWATCH
#ifndef __MEMWATCH_H
#define __MEMWATCH_H
/* Make sure that malloc(), realloc(), calloc() and free() are declared. */
/*lint -save -e537 */
#include <stdlib.h>
/*lint -restore */
#ifdef __cplusplus
extern "C" {
#endif
/*
** Constants used
** All MEMWATCH constants start with the prefix MW_, followed by
** a short mnemonic which indicates where the constant is used,
** followed by a descriptive text about it.
*/
#define MW_ARI_NULLREAD 0x10 /* Null read (to start debugger) */
#define MW_ARI_ABORT 0x04 /* ARI handler says: abort program! */
#define MW_ARI_RETRY 0x02 /* ARI handler says: retry action! */
#define MW_ARI_IGNORE 0x01 /* ARI handler says: ignore error! */
#define MW_VAL_NEW 0xFE /* value in newly allocated memory */
#define MW_VAL_DEL 0xFD /* value in newly deleted memory */
#define MW_VAL_NML 0xFC /* value in no-mans-land */
#define MW_VAL_GRB 0xFB /* value in grabbed memory */
#define MW_TEST_ALL 0xFFFF /* perform all tests */
#define MW_TEST_CHAIN 0x0001 /* walk the heap chain */
#define MW_TEST_ALLOC 0x0002 /* test allocations & NML guards */
#define MW_TEST_NML 0x0004 /* test all-NML areas for modifications */
#define MW_NML_NONE 0 /* no NML */
#define MW_NML_FREE 1 /* turn FREE'd memory into NML */
#define MW_NML_ALL 2 /* all unused memory is NML */
#define MW_NML_DEFAULT 0 /* the default NML setting */
#define MW_STAT_GLOBAL 0 /* only global statistics collected */
#define MW_STAT_MODULE 1 /* collect statistics on a module basis */
#define MW_STAT_LINE 2 /* collect statistics on a line basis */
#define MW_STAT_DEFAULT 0 /* the default statistics setting */
/*
** MemWatch internal constants
** You may change these and recompile MemWatch to change the limits
** of some parameters. Respect the recommended minimums!
*/
#define MW_TRACE_BUFFER 256 /* (min 160) size of TRACE()'s output buffer */
#define MW_FREE_LIST 64 /* (min 4) number of free()'s to track */
/*
** Exported variables
** In case you have to remove the 'const' keyword because your compiler
** doesn't support it, be aware that changing the values may cause
** unpredictable behaviour.
** - mwCounter contains the current action count. You can use this to
** place breakpoints using a debugger, if you want.
*/
#ifndef __MEMWATCH_C
extern const unsigned long mwCounter;
#endif
/*
** System functions
** Normally, it is not nessecary to call any of these. MEMWATCH will
** automatically initialize itself on the first MEMWATCH function call,
** and set up a call to mwAbort() using atexit(). Some C++ implementations
** run the atexit() chain before the program has terminated, so you
** may have to use mwInit() or the MemWatch C++ class to get good
** behaviour.
** - mwInit() can be called to disable the atexit() usage. If mwInit()
** is called directly, you must call mwTerm() to end MemWatch, or
** mwAbort().
** - mwTerm() is usually not nessecary to call; but if called, it will
** call mwAbort() if it finds that it is cancelling the 'topmost'
** mwInit() call.
** - mwAbort() cleans up after MEMWATCH, reports unfreed buffers, etc.
*/
void mwInit( void );
void mwTerm( void );
void mwAbort( void );
/*
** Setup functions
** These functions control the operation of MEMWATCH's protective features.
** - mwFlushNow() causes MEMWATCH to flush it's buffers.
** - mwDoFlush() controls whether MEMWATCH flushes the disk buffers after
** writes. The default is smart flushing: MEMWATCH will not flush buffers
** explicitly until memory errors are detected. Then, all writes are
** flushed until program end or mwDoFlush(0) is called.
** - mwLimit() sets the allocation limit, an arbitrary limit on how much
** memory your program may allocate in bytes. Used to stress-test app.
** Also, in virtual-memory or multitasking environs, puts a limit on
** how much MW_NML_ALL can eat up.
** - mwGrab() grabs up X kilobytes of memory. Allocates actual memory,
** can be used to stress test app & OS both.
** - mwDrop() drops X kilobytes of grabbed memory.
** - mwNoMansLand() sets the behaviour of the NML logic. See the
** MW_NML_xxx for more information. The default is MW_NML_DEFAULT.
** - mwStatistics() sets the behaviour of the statistics collector. See
** the MW_STAT_xxx defines for more information. Default MW_STAT_DEFAULT.
** - mwFreeBufferInfo() enables or disables the tagging of free'd buffers
** with freeing information. This information is written in text form,
** using sprintf(), so it's pretty slow. Disabled by default.
** - mwAutoCheck() performs a CHECK() operation whenever a MemWatch function
** is used. Slows down performance, of course.
** - mwCalcCheck() calculates checksums for all data buffers. Slow!
** - mwDumpCheck() logs buffers where stored & calc'd checksums differ. Slow!!
** - mwMark() sets a generic marker. Returns the pointer given.
** - mwUnmark() removes a generic marker. If, at the end of execution, some
** markers are still in existence, these will be reported as leakage.
** returns the pointer given.
*/
void mwFlushNow( void );
void mwDoFlush( int onoff );
void mwLimit( long bytes );
unsigned mwGrab( unsigned kilobytes );
unsigned mwDrop( unsigned kilobytes );
void mwNoMansLand( int mw_nml_level );
void mwStatistics( int level );
void mwFreeBufferInfo( int onoff );
void mwAutoCheck( int onoff );
void mwCalcCheck( void );
void mwDumpCheck( void );
void * mwMark( void *p, const char *description, const char *file, unsigned line );
void * mwUnmark( void *p, const char *file, unsigned line );
/*
** Testing/verification/tracing
** All of these macros except VERIFY() evaluates to a null statement
** if MEMWATCH is not defined during compilation.
** - mwIsReadAddr() checks a memory area for read privilige.
** - mwIsSafeAddr() checks a memory area for both read & write privilige.
** This function and mwIsReadAddr() is highly system-specific and
** may not be implemented. If this is the case, they will default
** to returning nonzero for any non-NULL pointer.
** - CHECK() does a complete memory integrity test. Slow!
** - CHECK_THIS() checks only selected components.
** - CHECK_BUFFER() checks the indicated buffer for errors.
** - mwASSERT() or ASSERT() If the expression evaluates to nonzero, execution continues.
** Otherwise, the ARI handler is called, if present. If not present,
** the default ARI action is taken (set with mwSetAriAction()).
** ASSERT() can be disabled by defining MW_NOASSERT.
** - mwVERIFY() or VERIFY() works just like ASSERT(), but when compiling without
** MEMWATCH the macro evaluates to the expression.
** VERIFY() can be disabled by defining MW_NOVERIFY.
** - mwTRACE() or TRACE() writes some text and data to the log. Use like printf().
** Note: there is a limit to the maximum resulting string length that
** can be written. This defaults to MW_TRACE_BUFFER characters.
** TRACE() can be disabled by defining MW_NOTRACE.
*/
int mwIsReadAddr( const void *p, unsigned len );
int mwIsSafeAddr( void *p, unsigned len );
int mwTest( const char *file, int line, int mw_test_flags );
int mwTestBuffer( const char *file, int line, void *p );
int mwAssert( int, const char*, const char*, int );
int mwVerify( int, const char*, const char*, int );
/*
** User I/O functions
** - mwTrace() works like printf(), but dumps output either to the
** function specified with mwSetOutFunc(), or the log file.
** - mwPuts() works like puts(), dumps output like mwTrace().
** - mwSetOutFunc() allows you to give the adress of a function
** where all user output will go. (exeption: see mwSetAriFunc)
** Specifying NULL will direct output to the log file.
** - mwSetAriFunc() gives MEMWATCH the adress of a function to call
** when an 'Abort, Retry, Ignore' question is called for. The
** actual error message is NOT printed when you've set this adress,
** but instead it is passed as an argument. If you call with NULL
** for an argument, the ARI handler is disabled again. When the
** handler is disabled, MEMWATCH will automatically take the
** action specified by mwSetAriAction().
** - mwSetAriAction() sets the default ARI return value MEMWATCH should
** use if no ARI handler is specified. Defaults to MW_ARI_ABORT.
** - mwAriHandler() is an ANSI ARI handler you can use if you like. It
** dumps output to stderr, and expects input from stdin.
** - mwBreakOut() is called in certain cases when MEMWATCH feels it would
** be nice to break into a debugger. If you feel like MEMWATCH, place
** an execution breakpoint on this function.
*/
void mwTrace( const char* format_string, ... );
void mwPuts( const char* text );
void mwSetOutFunc( void (*func)(int) );
void mwSetAriFunc( int (*func)(const char*) );
void mwSetAriAction( int mw_ari_value );
int mwAriHandler( const char* cause );
void mwBreakOut( const char* cause );
/*
** Allocation/deallocation functions
** These functions are the ones actually to perform allocations
** when running MEMWATCH, for both C and C++ calls.
** - mwMalloc() debugging allocator
** - mwMalloc_() always resolves to a clean call of malloc()
** - mwRealloc() debugging re-allocator
** - mwRealloc_() always resolves to a clean call of realloc()
** - mwCalloc() debugging allocator, fills with zeros
** - mwCalloc_() always resolves to a clean call of calloc()
** - mwFree() debugging free. Can only free memory which has
** been allocated by MEMWATCH.
** - mwFree_() resolves to a) normal free() or b) debugging free.
** Can free memory allocated by MEMWATCH and malloc() both.
** Does not generate any runtime errors.
*/
void* mwMalloc( size_t, const char*, int );
void* mwMalloc_( size_t );
void* mwRealloc( void *, size_t, const char*, int );
void* mwRealloc_( void *, size_t );
void* mwCalloc( size_t, size_t, const char*, int );
void* mwCalloc_( size_t, size_t );
void mwFree( void*, const char*, int );
void mwFree_( void* );
char* mwStrdup( char *, const char*, int );
/*
** Enable/disable precompiler block
** This block of defines and if(n)defs make sure that references
** to MEMWATCH is completely removed from the code if the MEMWATCH
** manifest constant is not defined.
*/
#ifndef __MEMWATCH_C
#ifdef MEMWATCH
#define mwASSERT(exp) while(mwAssert((int)(exp),#exp,__FILE__,__LINE__))
#ifndef MW_NOASSERT
#ifndef ASSERT
#define ASSERT mwASSERT
#endif /* !ASSERT */
#endif /* !MW_NOASSERT */
#define mwVERIFY(exp) while(mwVerify((int)(exp),#exp,__FILE__,__LINE__))
#ifndef MW_NOVERIFY
#ifndef VERIFY
#define VERIFY mwVERIFY
#endif /* !VERIFY */
#endif /* !MW_NOVERIFY */
#define mwTRACE mwTrace
#ifndef MW_NOTRACE
#ifndef TRACE
#define TRACE mwTRACE
#endif /* !TRACE */
#endif /* !MW_NOTRACE */
#define malloc(n) mwMalloc(n,__FILE__,__LINE__)
#ifdef strdup
#undef strdup
#endif
#define strdup(p) mwStrdup(p,__FILE__,__LINE__)
#define realloc(p,n) mwRealloc(p,n,__FILE__,__LINE__)
#define calloc(n,m) mwCalloc(n,m,__FILE__,__LINE__)
#define free(p) mwFree(p,__FILE__,__LINE__)
#define CHECK() mwTest(__FILE__,__LINE__,MW_TEST_ALL)
#define CHECK_THIS(n) mwTest(__FILE__,__LINE__,n)
#define CHECK_BUFFER(b) mwTestBuffer(__FILE__,__LINE__,b)
#define MARK(p) mwMark(p,#p,__FILE__,__LINE__)
#define UNMARK(p) mwUnmark(p,__FILE__,__LINE__)
#else /* MEMWATCH */
#define mwASSERT(exp)
#ifndef MW_NOASSERT
#ifndef ASSERT
#define ASSERT mwASSERT
#endif /* !ASSERT */
#endif /* !MW_NOASSERT */
#define mwVERIFY(exp) exp
#ifndef MW_NOVERIFY
#ifndef VERIFY
#define VERIFY mwVERIFY
#endif /* !VERIFY */
#endif /* !MW_NOVERIFY */
/*lint -esym(773,mwTRACE) */
#define mwTRACE /*lint -save -e506 */ 1?(void)0:mwDummyTraceFunction /*lint -restore */
#ifndef MW_NOTRACE
#ifndef TRACE
/*lint -esym(773,TRACE) */
#define TRACE mwTRACE
#endif /* !TRACE */
#endif /* !MW_NOTRACE */
extern void mwDummyTraceFunction(const char *,...);
/*lint -save -e652 */
#define mwDoFlush(n)
#define mwPuts(s)
#define mwInit()
#define mwGrab(n)
#define mwDrop(n)
#define mwLimit(n)
#define mwTest(f,l)
#define mwSetOutFunc(f)
#define mwSetAriFunc(f)
#define mwDefaultAri()
#define mwNomansland()
#define mwStatistics(f)
#define mwMark(p,t,f,n) (p)
#define mwUnmark(p,f,n) (p)
#define mwMalloc(n,f,l) malloc(n)
#define mwStrdup(p,f,l) strdup(p)
#define mwRealloc(p,n,f,l) realloc(p,n)
#define mwCalloc(n,m,f,l) calloc(n,m)
#define mwFree(p) free(p)
#define mwMalloc_(n) malloc(n)
#define mwRealloc_(p,n) realloc(p,n)
#define mwCalloc_(n,m) calloc(n,m)
#define mwFree_(p) free(p)
#define mwAssert(e,es,f,l)
#define mwVerify(e,es,f,l) (e)
#define mwTrace mwDummyTrace
#define mwTestBuffer(f,l,b) (0)
#define CHECK()
#define CHECK_THIS(n)
#define CHECK_BUFFER(b)
#define MARK(p) (p)
#define UNMARK(p) (p)
/*lint -restore */
#endif /* MEMWATCH */
#endif /* !__MEMWATCH_C */
#ifdef __cplusplus
}
#endif
#if 0 /* 980317: disabled C++ */
/*
** C++ support section
** Implements the C++ support. Please note that in order to avoid
** messing up library classes, C++ support is disabled by default.
** You must NOT enable it until AFTER the inclusion of all header
** files belonging to code that are not compiled with MEMWATCH, and
** possibly for some that are! The reason for this is that a C++
** class may implement it's own new() function, and the preprocessor
** would substitute this crucial declaration for MEMWATCH new().
** You can forcibly deny C++ support by defining MEMWATCH_NOCPP.
** To enble C++ support, you must be compiling C++, MEMWATCH must
** be defined, MEMWATCH_NOCPP must not be defined, and finally,
** you must define 'new' to be 'mwNew', and 'delete' to be 'mwDelete'.
** Unlike C, C++ code can begin executing *way* before main(), for
** example if a global variable is created. For this reason, you can
** declare a global variable of the class 'MemWatch'. If this is
** is the first variable created, it will then check ALL C++ allocations
** and deallocations. Unfortunately, this evaluation order is not
** guaranteed by C++, though the compilers I've tried evaluates them
** in the order encountered.
*/
#ifdef __cplusplus
#ifndef __MEMWATCH_C
#ifdef MEMWATCH
#ifndef MEMWATCH_NOCPP
extern int mwNCur;
extern const char *mwNFile;
extern int mwNLine;
class MemWatch {
public:
MemWatch();
~MemWatch();
};
void * operator new(size_t);
void * operator new(size_t,const char *,int);
void operator delete(void *);
#define mwNew new(__FILE__,__LINE__)
#define mwDelete (mwNCur=1,mwNFile=__FILE__,mwNLine=__LINE__),delete
#endif /* MEMWATCH_NOCPP */
#endif /* MEMWATCH */
#endif /* !__MEMWATCH_C */
#endif /* __cplusplus */
#endif /* 980317: disabled C++ */
#endif /* __MEMWATCH_H */
#endif /* EOF MEMWATCH.H */

View File

@ -4,7 +4,6 @@
BEGIN { BEGIN {
print "#include \"../config.h\"" print "#include \"../config.h\""
print "#include \"libs.h\"" print "#include \"libs.h\""
print "#include \"memwatch.h\""
print "#include \"structs.h\"" print "#include \"structs.h\""
print "#include \"common.h\"" print "#include \"common.h\""
print "" print ""

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "msgtext.h" #include "msgtext.h"
#include "msg.h" #include "msg.h"
#include "jammsg.h" #include "jammsg.h"

View File

@ -31,7 +31,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "msgtext.h" #include "msgtext.h"
#include "msg.h" #include "msg.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "users.h" #include "users.h"
#include "records.h" #include "records.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "clcomm.h" #include "clcomm.h"
#include "common.h" #include "common.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "common.h" #include "common.h"
#include "users.h" #include "users.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "users.h" #include "users.h"
#include "records.h" #include "records.h"

View File

@ -21,7 +21,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "common.h" #include "common.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "users.h" #include "users.h"
#include "records.h" #include "records.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "users.h" #include "users.h"
#include "records.h" #include "records.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "common.h" #include "common.h"
#include "mberrors.h" #include "mberrors.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "users.h" #include "users.h"
#include "records.h" #include "records.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "common.h" #include "common.h"
#include "clcomm.h" #include "clcomm.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "users.h" #include "users.h"
#include "records.h" #include "records.h"

View File

@ -31,7 +31,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "clcomm.h" #include "clcomm.h"
#include "common.h" #include "common.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "clcomm.h" #include "clcomm.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "users.h" #include "users.h"
#include "records.h" #include "records.h"

View File

@ -1,7 +1,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#ifndef HAVE_STRCASESTR #ifndef HAVE_STRCASESTR

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "common.h" #include "common.h"
@ -339,7 +338,7 @@ char *GetDateDMY()
char *OsName() char *OsName()
{ {
#ifdef __linux__ #ifdef __linux__
return (char *)"Linux"; return (char *)"GNU/Linux";
#elif __FreeBSD__ #elif __FreeBSD__
return (char *)"FreeBSD"; return (char *)"FreeBSD";
#elif __NetBSD__ #elif __NetBSD__
@ -372,7 +371,7 @@ char *OsCPU()
/* /*
* Return universal tearline, note if OS and CPU are * Return universal tearline, note if OS and CPU are
* unknow, the tearline is already 39 characters. * unknown, the tearline is already 39 characters.
*/ */
char *TearLine() char *TearLine()
{ {

View File

@ -32,7 +32,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "users.h" #include "users.h"
#include "ansi.h" #include "ansi.h"

View File

@ -1,108 +0,0 @@
/*
** NOTE: Running this program in a Win32 or Unix environment
** will probably result in a segmentation fault or protection
** error. These errors may be caused by MEMWATCH when it's
** looking at memory to see if it owns it, or may be caused by
** the test program writing to memory it does not own.
**
** MEMWATCH has two functions called 'mwIsReadAddr()' and
** 'mwIsSafeAddr()', which are system-specific.
** If they are implemented for your system, and works
** correctly, MEMWATCH will identify garbage pointers and
** avoid causing segmentation faults, GP's etc.
**
** If they are NOT implemented, count on getting the core
** dumped when running this test program! As of this writing,
** the safe-address checking has been implemented for Win32
** and ANSI-C compliant systems. The ANSI-C checking traps
** SIGSEGV and uses setjmp/longjmp to resume processing,
** but I've only tested this under Linux (where it works).
**
** Note for Win95 users: The Win32 IsBadReadPtr() and it's
** similar functions can return incorrect values. This has
** not happened under WinNT, though, just Win95.
**
** 980318 Johan Lindh
**
*/
#include "../config.h"
#include "libs.h"
#include "memwatch.h"
#error "Hey! Don't just compile this program, read the comments first!"
#ifndef SIGSEGV
#error SIGNAL.H does not define SIGSEGV; running this program WILL cause a core dump/crash!
#endif
main()
{
char *p;
/* Collect stats on a line number basis */
mwStatistics( 2 );
/* Slows things down, but OK for this test prg */
/* mwAutoCheck( 1 ); */
TRACE("Hello world!\n");
p = malloc(210);
free(p);
p = malloc(20);
p = malloc(200); /* causes unfreed error */
p[-1] = 0; /* causes underflow error */
free(p);
p = malloc(100);
p[ -(int)(sizeof(long)*8) ] = -1; /* try to damage MW's heap chain */
free( p ); /* should cause relink */
mwSetAriFunc( mwAriHandler );
ASSERT(1==2);
mwLimit(1000000);
mwNoMansLand( MW_NML_ALL );
/* These may cause a general protection fault (segmentation fault) */
/* They're here to help test the no-mans-land protection */
if( mwIsSafeAddr(p+50000,1) ) {
TRACE("Killing byte at %p\n", p+50000);
*(p+50000) = 0;
}
if( mwIsSafeAddr(p+30000,1) ) {
TRACE("Killing byte at %p\n", p+30000);
*(p+30000) = 0;
}
if( mwIsSafeAddr(p+1000,1) ) {
TRACE("Killing byte at %p\n", p+1000);
*(p+1000) = 0;
}
if( mwIsSafeAddr(p-100,1) ) {
TRACE("Killing byte at %p\n", p-100);
*(p-100) = 0;
}
/* This may cause a GP fault as well, since MW data buffers */
/* have been damaged in the above killing spree */
CHECK();
p = malloc(12000);
p[-5] = 1;
p[-10] = 2;
p[-15] = 3;
p[-20] = 4;
/* This may cause a GP fault since MW's buffer list may have */
/* been damaged by above killing, and it will try to repair it. */
free(p);
p = realloc(p,10); /* causes realloc: free'd from error */
/* May cause GP since MW will inspect the memory to see if it owns it. */
free( (void*)main );
return 0;
}

View File

@ -32,7 +32,6 @@
#include "../config.h" #include "../config.h"
#include "libs.h" #include "libs.h"
#include "memwatch.h"
#include "structs.h" #include "structs.h"
#include "users.h" #include "users.h"
#include "records.h" #include "records.h"

View File

@ -31,7 +31,7 @@ MBCICO_OBJS = zmmisc.o zmrle.o zmrecv.o zmsend.o binkp.o md5b.o \
ttyio.o lutil.o scanout.o emsi.o ulock.o \ ttyio.o lutil.o scanout.o emsi.o ulock.o \
callstat.o session.o call.o mbcico.o callstat.o session.o call.o mbcico.o
MBOUT_OBJS = outstat.o nlinfo.o mbout.o scanout.o callstat.o MBOUT_OBJS = outstat.o nlinfo.o mbout.o scanout.o callstat.o
LIBS += ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a \ LIBS += ../lib/libclcomm.a ../lib/libcommon.a \
../lib/libmsgbase.a ../lib/libdbase.a ../lib/libnodelist.a ../lib/libmsgbase.a ../lib/libdbase.a ../lib/libnodelist.a
OTHER = Makefile README OTHER = Makefile README
TARGET = mbcico mbout TARGET = mbcico mbout
@ -87,48 +87,48 @@ depend:
# DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT # DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT
# Dependencies generated by make depend # Dependencies generated by make depend
zmmisc.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ttyio.h session.h zmodem.h zmmisc.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ttyio.h session.h zmodem.h
zmrle.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h ../lib/nodelist.h ttyio.h session.h zmodem.h zmrle.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h ../lib/nodelist.h ttyio.h session.h zmodem.h
zmrecv.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h ../lib/nodelist.h lutil.h ttyio.h session.h zmodem.h config.h emsi.h openfile.h filelist.h openport.h zmrecv.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h ../lib/nodelist.h lutil.h ttyio.h session.h zmodem.h config.h emsi.h openfile.h filelist.h openport.h
zmsend.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ttyio.h session.h zmodem.h lutil.h emsi.h filelist.h zmsend.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ttyio.h session.h zmodem.h lutil.h emsi.h filelist.h
binkp.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/dbnode.h ../lib/clcomm.h ../lib/mberrors.h ttyio.h session.h statetbl.h config.h emsi.h openfile.h respfreq.h filelist.h opentcp.h rdoptions.h lutil.h binkp.h config.h md5b.h binkp.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/dbnode.h ../lib/clcomm.h ../lib/mberrors.h ttyio.h session.h statetbl.h config.h emsi.h openfile.h respfreq.h filelist.h opentcp.h rdoptions.h lutil.h binkp.h config.h md5b.h
md5b.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h lutil.h md5b.h md5b.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h lutil.h md5b.h
xmsend.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h session.h ttyio.h statetbl.h xmsend.h m7send.h filelist.h filetime.h xmsend.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h session.h ttyio.h statetbl.h xmsend.h m7send.h filelist.h filetime.h
xmrecv.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h session.h ttyio.h statetbl.h config.h lutil.h openfile.h m7recv.h xmrecv.h filelist.h filetime.h xmrecv.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h session.h ttyio.h statetbl.h config.h lutil.h openfile.h m7recv.h xmrecv.h filelist.h filetime.h
m7recv.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h statetbl.h ttyio.h m7recv.h m7recv.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h statetbl.h ttyio.h m7recv.h
m7send.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h statetbl.h ttyio.h m7send.h m7send.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h statetbl.h ttyio.h m7send.h
hydra.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/mberrors.h session.h filelist.h filetime.h ttyio.h statetbl.h config.h emsi.h openfile.h lutil.h respfreq.h mbcico.h hydra.h hydra.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/mberrors.h session.h filelist.h filetime.h ttyio.h statetbl.h config.h emsi.h openfile.h lutil.h respfreq.h mbcico.h hydra.h
answer.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/dbnode.h ../lib/mberrors.h lutil.h session.h config.h answer.h openport.h portsel.h dial.h rdoptions.h mbcico.h answer.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/dbnode.h ../lib/mberrors.h lutil.h session.h config.h answer.h openport.h portsel.h dial.h rdoptions.h mbcico.h
chat.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h config.h chat.h ttyio.h chat.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h config.h chat.h ttyio.h
dial.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/dbnode.h ../lib/mberrors.h config.h chat.h ttyio.h session.h dial.h dial.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/dbnode.h ../lib/mberrors.h config.h chat.h ttyio.h session.h dial.h
dietifna.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ttyio.h session.h emsi.h dietifna.h respfreq.h filelist.h xmrecv.h xmsend.h dietifna.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ttyio.h session.h emsi.h dietifna.h respfreq.h filelist.h xmrecv.h xmsend.h
emsidat.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h emsi.h session.h lutil.h config.h emsidat.h filetime.h emsidat.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h emsi.h session.h lutil.h config.h emsidat.h filetime.h
filelist.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/nodelist.h config.h session.h filelist.h filelist.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/nodelist.h config.h session.h filelist.h
openfile.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h config.h lutil.h openfile.h openfile.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h config.h lutil.h openfile.h
openport.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ulock.h ttyio.h openport.h openport.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ulock.h ttyio.h openport.h
opentcp.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h session.h ttyio.h openport.h opentcp.h opentcp.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h session.h ttyio.h openport.h opentcp.h
rdoptions.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h session.h config.h rdoptions.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h session.h config.h
yoohoo.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/nodelist.h ../lib/dbnode.h ../lib/mberrors.h statetbl.h ttyio.h session.h config.h emsi.h hydra.h rdoptions.h wazoo.h dietifna.h yoohoo.h yoohoo.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/nodelist.h ../lib/dbnode.h ../lib/mberrors.h statetbl.h ttyio.h session.h config.h emsi.h hydra.h rdoptions.h wazoo.h dietifna.h yoohoo.h
recvbark.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ttyio.h session.h statetbl.h recvbark.h respfreq.h filelist.h recvbark.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ttyio.h session.h statetbl.h recvbark.h respfreq.h filelist.h
respfreq.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h session.h lutil.h config.h atoul.h respfreq.h filelist.h respfreq.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h session.h lutil.h config.h atoul.h respfreq.h filelist.h
sendbark.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ttyio.h session.h statetbl.h sendbark.h xmrecv.h sendbark.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ttyio.h session.h statetbl.h sendbark.h xmrecv.h
tcp.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ttyio.h session.h statetbl.h config.h emsi.h respfreq.h filelist.h tcpproto.h tcp.h tcp.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ttyio.h session.h statetbl.h config.h emsi.h respfreq.h filelist.h tcpproto.h tcp.h
tcpproto.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/mberrors.h ttyio.h session.h config.h emsi.h lutil.h openfile.h filelist.h tcpproto.h tcpproto.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/mberrors.h ttyio.h session.h config.h emsi.h lutil.h openfile.h filelist.h tcpproto.h
wazoo.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/mberrors.h ttyio.h session.h statetbl.h config.h emsi.h respfreq.h filelist.h wazoo.h zmodem.h wazoo.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/mberrors.h ttyio.h session.h statetbl.h config.h emsi.h respfreq.h filelist.h wazoo.h zmodem.h
filetime.o: ../config.h ../lib/libs.h ../lib/memwatch.h filetime.h filetime.o: ../config.h ../lib/libs.h filetime.h
ftsc.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/mberrors.h session.h ttyio.h statetbl.h config.h ftsc.h rdoptions.h recvbark.h filelist.h sendbark.h respfreq.h xmrecv.h xmsend.h ftsc.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/mberrors.h session.h ttyio.h statetbl.h config.h ftsc.h rdoptions.h recvbark.h filelist.h sendbark.h respfreq.h xmrecv.h xmsend.h
atoul.o: ../config.h ../lib/libs.h ../lib/memwatch.h atoul.h atoul.o: ../config.h ../lib/libs.h atoul.h
portsel.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h portsel.h portsel.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h portsel.h
ttyio.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ttyio.h lutil.h ttyio.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ttyio.h lutil.h
lutil.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h lutil.h lutil.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h lutil.h
scanout.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbftn.h config.h scanout.h lutil.h scanout.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbftn.h config.h scanout.h lutil.h
emsi.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/dbnode.h ../lib/clcomm.h ../lib/mberrors.h ttyio.h session.h statetbl.h config.h emsi.h emsidat.h hydra.h rdoptions.h tcp.h wazoo.h emsi.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/dbnode.h ../lib/clcomm.h ../lib/mberrors.h ttyio.h session.h statetbl.h config.h emsi.h emsidat.h hydra.h rdoptions.h tcp.h wazoo.h
ulock.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/clcomm.h ulock.o: ../config.h ../lib/libs.h ../lib/clcomm.h
callstat.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h callstat.h callstat.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h callstat.h
session.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/mberrors.h ttyio.h statetbl.h emsi.h ftsc.h session.h yoohoo.h mbcico.h binkp.h callstat.h session.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/mberrors.h ttyio.h statetbl.h emsi.h ftsc.h session.h yoohoo.h mbcico.h binkp.h callstat.h
call.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/dbnode.h ../lib/mberrors.h session.h callstat.h call.h config.h dial.h lutil.h portsel.h openport.h opentcp.h rdoptions.h call.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/dbnode.h ../lib/mberrors.h session.h callstat.h call.h config.h dial.h lutil.h portsel.h openport.h opentcp.h rdoptions.h
mbcico.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbftn.h ../lib/mberrors.h config.h answer.h call.h lutil.h mbcico.h session.h mbcico.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbftn.h ../lib/mberrors.h config.h answer.h call.h lutil.h mbcico.h session.h
outstat.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbftn.h ../lib/mberrors.h scanout.h callstat.h outstat.h outstat.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbftn.h ../lib/mberrors.h scanout.h callstat.h outstat.h
nlinfo.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h nlinfo.h nlinfo.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h nlinfo.h
mbout.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbftn.h ../lib/mberrors.h outstat.h nlinfo.h mbout.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbftn.h ../lib/mberrors.h outstat.h nlinfo.h
# End of generated dependencies # End of generated dependencies

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/users.h" #include "../lib/users.h"
#include "../lib/records.h" #include "../lib/records.h"

View File

@ -31,7 +31,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "atoul.h" #include "atoul.h"

View File

@ -31,7 +31,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/users.h" #include "../lib/users.h"
#include "../lib/records.h" #include "../lib/records.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/users.h" #include "../lib/users.h"
#include "../lib/records.h" #include "../lib/records.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/users.h" #include "../lib/users.h"
#include "../lib/records.h" #include "../lib/records.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/users.h" #include "../lib/users.h"
#include "../lib/records.h" #include "../lib/records.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/users.h" #include "../lib/users.h"
#include "../lib/records.h" #include "../lib/records.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/common.h" #include "../lib/common.h"
#include "../lib/nodelist.h" #include "../lib/nodelist.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/users.h" #include "../lib/users.h"
#include "../lib/records.h" #include "../lib/records.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/users.h" #include "../lib/users.h"
#include "../lib/records.h" #include "../lib/records.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/users.h" #include "../lib/users.h"
#include "../lib/records.h" #include "../lib/records.h"

View File

@ -31,7 +31,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "filetime.h" #include "filetime.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/users.h" #include "../lib/users.h"
#include "../lib/records.h" #include "../lib/records.h"

View File

@ -43,7 +43,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/common.h" #include "../lib/common.h"
#include "../lib/nodelist.h" #include "../lib/nodelist.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/common.h" #include "../lib/common.h"
#include "../lib/clcomm.h" #include "../lib/clcomm.h"

View File

@ -31,7 +31,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/common.h" #include "../lib/common.h"
#include "../lib/clcomm.h" #include "../lib/clcomm.h"

View File

@ -31,7 +31,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/common.h" #include "../lib/common.h"
#include "../lib/clcomm.h" #include "../lib/clcomm.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/users.h" #include "../lib/users.h"
#include "../lib/records.h" #include "../lib/records.h"
@ -157,10 +156,6 @@ int main(int argc, char *argv[])
char temp[PATH_MAX]; char temp[PATH_MAX];
#endif #endif
#ifdef MEMWATCH
mwInit();
#endif
/* /*
* The next trick is to supply a fake environment variable * The next trick is to supply a fake environment variable
* MBSE_ROOT in case we are started from inetd or mgetty, * MBSE_ROOT in case we are started from inetd or mgetty,
@ -178,9 +173,6 @@ int main(int argc, char *argv[])
usage(); usage();
if (envptr) if (envptr)
free(envptr); free(envptr);
#ifdef MEMWATCH
mwTerm();
#endif
exit(MBERR_COMMANDLINE); exit(MBERR_COMMANDLINE);
} }
@ -304,9 +296,6 @@ int main(int argc, char *argv[])
free_mem(); free_mem();
if (envptr) if (envptr)
free(envptr); free(envptr);
#ifdef MEMWATCH
mwTerm();
#endif
exit(MBERROR_EXEC_FAILED); exit(MBERROR_EXEC_FAILED);
} }
#endif #endif

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/users.h" #include "../lib/users.h"
#include "../lib/records.h" #include "../lib/records.h"
@ -180,9 +179,6 @@ int main(int argc, char *argv[])
FILE *fl; FILE *fl;
unsigned long cmmask; unsigned long cmmask;
#ifdef MEMWATCH
mwInit();
#endif
InitConfig(); InitConfig();
InitNode(); InitNode();
InitFidonet(); InitFidonet();
@ -364,9 +360,6 @@ int main(int argc, char *argv[])
} }
Help(); Help();
#ifdef MEMWATCH
mwTerm();
#endif
return MBERR_OK; return MBERR_OK;
} }

View File

@ -56,7 +56,6 @@ documentation and/or software.
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/common.h" #include "../lib/common.h"
#include "../lib/nodelist.h" #include "../lib/nodelist.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/common.h" #include "../lib/common.h"
#include "../lib/nodelist.h" #include "../lib/nodelist.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/clcomm.h" #include "../lib/clcomm.h"
#include "../lib/common.h" #include "../lib/common.h"

View File

@ -31,7 +31,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/common.h" #include "../lib/common.h"
#include "../lib/clcomm.h" #include "../lib/clcomm.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/users.h" #include "../lib/users.h"
#include "../lib/records.h" #include "../lib/records.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/users.h" #include "../lib/users.h"
#include "../lib/records.h" #include "../lib/records.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/users.h" #include "../lib/users.h"
#include "../lib/records.h" #include "../lib/records.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/users.h" #include "../lib/users.h"
#include "../lib/records.h" #include "../lib/records.h"

View File

@ -31,7 +31,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/common.h" #include "../lib/common.h"
#include "../lib/nodelist.h" #include "../lib/nodelist.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/users.h" #include "../lib/users.h"
#include "../lib/records.h" #include "../lib/records.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/users.h" #include "../lib/users.h"
#include "../lib/records.h" #include "../lib/records.h"

View File

@ -31,7 +31,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/common.h" #include "../lib/common.h"
#include "../lib/nodelist.h" #include "../lib/nodelist.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/users.h" #include "../lib/users.h"
#include "../lib/records.h" #include "../lib/records.h"

View File

@ -34,7 +34,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/common.h" #include "../lib/common.h"
#include "../lib/nodelist.h" #include "../lib/nodelist.h"

View File

@ -34,7 +34,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/common.h" #include "../lib/common.h"
#include "../lib/clcomm.h" #include "../lib/clcomm.h"

View File

@ -33,7 +33,6 @@
*/ */
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/users.h" #include "../lib/users.h"
#include "../lib/records.h" #include "../lib/records.h"

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/clcomm.h" #include "../lib/clcomm.h"
#ifndef LOCKDIR #ifndef LOCKDIR

View File

@ -30,7 +30,6 @@
#include "../config.h" #include "../config.h"
#include "../lib/libs.h" #include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../lib/common.h" #include "../lib/common.h"
#include "../lib/clcomm.h" #include "../lib/clcomm.h"

Some files were not shown because too many files have changed in this diff Show More