Remove exp-omega's code. It was disabled in 3.4.0 to few complaints.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10247
This commit is contained in:
Nicholas Nethercote 2009-06-04 23:11:50 +00:00
parent 71114c3b13
commit b67eef4699
30 changed files with 9 additions and 4606 deletions

View File

@ -52,7 +52,6 @@ Josef Weidendorfer, Josef.Weidendorfer@gmx.de.
Josef wrote Callgrind and the associated KCachegrind GUI.
Omega was written by Bryan Meredith and is maintained by Rich Coe.
DRD was written by and is maintained by Bart Van Assche.
Frederic Gobry helped with autoconf and automake. Daniel Berlin

View File

@ -38,7 +38,6 @@ Clifton, for use in Valgrind.
Michael Matz and Simon Hausmann modified the GNU binutils
demangler(s) for use in Valgrind.
Omega was written by Bryan Meredith and is maintained by Rich Coe.
DRD was written by and is maintained by Bart Van Assche.
And lots and lots of other people sent bug reports, patches, and very

View File

@ -12,8 +12,7 @@ TOOLS = memcheck \
helgrind \
drd
EXP_TOOLS = exp-omega \
exp-ptrcheck
EXP_TOOLS = exp-ptrcheck
# DDD: once all tools work on Darwin, TEST_TOOLS and TEST_EXP_TOOLS can be
# replaced with TOOLS and EXP_TOOLS.
@ -28,7 +27,7 @@ else
lackey \
none
TEST_EXP_TOOLS = exp-omega
TEST_EXP_TOOLS =
endif
# Put docs last because building the HTML is slow and we want to get

6
NEWS
View File

@ -75,6 +75,12 @@ Release 3.5.0 (???)
gap until the next snapshot. This makes it clear that the memory
usage has not dropped to zero between snapshots.
* exp-Omega, an experimental instantaneous leak-detecting tool, was disabled
in 3.4.0 due to a lack of interest and maintenance, although the source
code was still in the distribution. The source code has now been removed
from the distribution. For anyone interested, the removal occurred in SVN
revision r10247.
* The location of some install files has changed. This should not affect
most users. Those who might be affected:
- For people who use Valgrind with MPI programs, the installed

View File

@ -78,7 +78,7 @@ Valgrind. The following notes may save you some trouble.
-- Don't strip symbols from lib/valgrind/$platform/{cachegrind,
callgrind,drd,exp-omega,helgrind,lackey,massif,memcheck,none}
callgrind,drd,helgrind,lackey,massif,memcheck,none}
in the installation tree. Doing so will likely cause problems.
Removing the line number info is probably OK, although that has not
been tested by the Valgrind developers.

View File

@ -1893,9 +1893,6 @@ AC_OUTPUT(
none/tests/darwin/Makefile
none/tests/x86-linux/Makefile
none/docs/Makefile
exp-omega/Makefile
exp-omega/tests/Makefile
exp-omega/docs/Makefile
exp-ptrcheck/Makefile
exp-ptrcheck/tests/Makefile
exp-ptrcheck/docs/Makefile

View File

@ -1,190 +0,0 @@
# Don't build Omega. Bundle all the relevant stuff up into
# the tarfile, though.
SUBDIRS = docs tests
EXTRA_DIST = exp-omega.h o_main.c o_replace_memops.c
###--- The original Makefile.am begins here ---###
##zz
##zz include $(top_srcdir)/Makefile.tool.am
##zz
##zz # include memcheck/ for mac_shared.h
##zz noinst_PROGRAMS =
##zz if VGCONF_PLATFORMS_INCLUDE_X86_LINUX
##zz noinst_PROGRAMS += exp-omega-x86-linux vgpreload_exp-omega-x86-linux.so
##zz endif
##zz if VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX
##zz noinst_PROGRAMS += exp-omega-amd64-linux vgpreload_exp-omega-amd64-linux.so
##zz endif
##zz if VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX
##zz noinst_PROGRAMS += exp-omega-ppc32-linux vgpreload_exp-omega-ppc32-linux.so
##zz endif
##zz if VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX
##zz noinst_PROGRAMS += exp-omega-ppc64-linux vgpreload_exp-omega-ppc64-linux.so
##zz endif
##zz if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
##zz noinst_PROGRAMS += exp-omega-ppc32-aix5 vgpreload_exp-omega-ppc32-aix5.so
##zz endif
##zz if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5
##zz noinst_PROGRAMS += exp-omega-ppc64-aix5 vgpreload_exp-omega-ppc64-aix5.so
##zz endif
##zz if VGCONF_PLATFORMS_INCLUDE_X86_DARWIN
##zz noinst_PROGRAMS += exp-omega-x86-darwin vgpreload_exp-omega-x86-darwin.so
##zz endif
##zz if VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN
##zz noinst_PROGRAMS += exp-omega-amd64-darwin vgpreload_exp-omega-amd64-darwin.so
##zz endif
##zz
##zz VGPRELOAD_OMEGA_SOURCES_COMMON = o_replace_memops.c
##zz
##zz vgpreload_exp_omega_x86_linux_so_SOURCES = $(VGPRELOAD_OMEGA_SOURCES_COMMON)
##zz vgpreload_exp_omega_x86_linux_so_CPPFLAGS = $(AM_CPPFLAGS_X86_LINUX)
##zz vgpreload_exp_omega_x86_linux_so_CFLAGS = $(AM_CFLAGS_X86_LINUX) $(AM_CFLAGS_PIC) -O2
##zz vgpreload_exp_omega_x86_linux_so_CCASFLAGS = $(AM_CCASFLAGS_X86_LINUX)
##zz vgpreload_exp_omega_x86_linux_so_DEPENDENCIES = $(LIBREPLACEMALLOC_X86_LINUX)
##zz vgpreload_exp_omega_x86_linux_so_LDFLAGS = \
##zz $(PRELOAD_LDFLAGS_X86_LINUX) \
##zz $(LIBREPLACEMALLOC_LDFLAGS_X86_LINUX)
##zz
##zz vgpreload_exp_omega_amd64_linux_so_SOURCES = $(VGPRELOAD_OMEGA_SOURCES_COMMON)
##zz vgpreload_exp_omega_amd64_linux_so_CPPFLAGS = $(AM_CPPFLAGS_AMD64_LINUX)
##zz vgpreload_exp_omega_amd64_linux_so_CFLAGS = $(AM_CFLAGS_AMD64_LINUX) $(AM_CFLAGS_PIC) -O2
##zz vgpreload_exp_omega_amd64_linux_so_CCASFLAGS = $(AM_CCASFLAGS_AMD64_LINUX)
##zz vgpreload_exp_omega_amd64_linux_so_DEPENDENCIES = $(LIBREPLACEMALLOC_AMD64_LINUX)
##zz vgpreload_exp_omega_amd64_linux_so_LDFLAGS = \
##zz $(PRELOAD_LDFLAGS_AMD64_LINUX) \
##zz $(LIBREPLACEMALLOC_LDFLAGS_AMD64_LINUX)
##zz
##zz vgpreload_exp_omega_ppc32_linux_so_SOURCES = $(VGPRELOAD_OMEGA_SOURCES_COMMON)
##zz vgpreload_exp_omega_ppc32_linux_so_CPPFLAGS = $(AM_CPPFLAGS_PPC32_LINUX)
##zz vgpreload_exp_omega_ppc32_linux_so_CFLAGS = $(AM_CFLAGS_PPC32_LINUX) $(AM_CFLAGS_PIC) -O2
##zz vgpreload_exp_omega_ppc32_linux_so_CCASFLAGS = $(AM_CCASFLAGS_PPC32_LINUX)
##zz vgpreload_exp_omega_ppc32_linux_so_DEPENDENCIES = $(LIBREPLACEMALLOC_PPC32_LINUX)
##zz vgpreload_exp_omega_ppc32_linux_so_LDFLAGS = \
##zz $(PRELOAD_LDFLAGS_PPC32_LINUX) \
##zz $(LIBREPLACEMALLOC_LDFLAGS_PPC32_LINUX)
##zz
##zz vgpreload_exp_omega_ppc64_linux_so_SOURCES = $(VGPRELOAD_OMEGA_SOURCES_COMMON)
##zz vgpreload_exp_omega_ppc64_linux_so_CPPFLAGS = $(AM_CPPFLAGS_PPC64_LINUX)
##zz vgpreload_exp_omega_ppc64_linux_so_CFLAGS = $(AM_CFLAGS_PPC64_LINUX) $(AM_CFLAGS_PIC) -O2
##zz vgpreload_exp_omega_ppc64_linux_so_CCASFLAGS = $(AM_CCASFLAGS_PPC64_LINUX)
##zz vgpreload_exp_omega_ppc64_linux_so_DEPENDENCIES = $(LIBREPLACEMALLOC_PPC64_LINUX)
##zz vgpreload_exp_omega_ppc64_linux_so_LDFLAGS = \
##zz $(PRELOAD_LDFLAGS_PPC64_LINUX) \
##zz $(LIBREPLACEMALLOC_LDFLAGS_PPC64_LINUX)
##zz
##zz vgpreload_exp_omega_ppc32_aix5_so_SOURCES = $(VGPRELOAD_OMEGA_SOURCES_COMMON)
##zz vgpreload_exp_omega_ppc32_aix5_so_CPPFLAGS = $(AM_CPPFLAGS_PPC32_AIX5)
##zz vgpreload_exp_omega_ppc32_aix5_so_CFLAGS = $(AM_CFLAGS_PPC32_AIX5) $(AM_CFLAGS_PIC) -O2
##zz vgpreload_exp_omega_ppc32_aix5_so_CCASFLAGS = $(AM_CCASFLAGS_PPC32_AIX5)
##zz vgpreload_exp_omega_ppc32_aix5_so_DEPENDENCIES = $(LIBREPLACEMALLOC_PPC32_AIX5)
##zz vgpreload_exp_omega_ppc32_aix5_so_LDFLAGS = \
##zz $(PRELOAD_LDFLAGS_PPC32_AIX5) \
##zz $(LIBREPLACEMALLOC_LDFLAGS_PPC32_AIX5)
##zz
##zz vgpreload_exp_omega_ppc64_aix5_so_SOURCES = $(VGPRELOAD_OMEGA_SOURCES_COMMON)
##zz vgpreload_exp_omega_ppc64_aix5_so_CPPFLAGS = $(AM_CPPFLAGS_PPC64_AIX5)
##zz vgpreload_exp_omega_ppc64_aix5_so_CFLAGS = $(AM_CFLAGS_PPC64_AIX5) $(AM_CFLAGS_PIC) -O2
##zz vgpreload_exp_omega_ppc64_aix5_so_CCASFLAGS = $(AM_CCASFLAGS_PPC64_AIX5)
##zz vgpreload_exp_omega_ppc64_aix5_so_DEPENDENCIES = $(LIBREPLACEMALLOC_PPC64_AIX5)
##zz vgpreload_exp_omega_ppc64_aix5_so_LDFLAGS = \
##zz $(PRELOAD_LDFLAGS_PPC64_AIX5) \
##zz $(LIBREPLACEMALLOC_LDFLAGS_PPC64_AIX5)
##zz
##zz vgpreload_exp_omega_x86_darwin_so_SOURCES = $(VGPRELOAD_OMEGA_SOURCES_COMMON)
##zz vgpreload_exp_omega_x86_darwin_so_CPPFLAGS = $(AM_CPPFLAGS_X86_DARWIN)
##zz vgpreload_exp_omega_x86_darwin_so_CFLAGS = $(AM_CFLAGS_X86_DARWIN) $(AM_CFLAGS_PIC) -O2
##zz vgpreload_exp_omega_x86_darwin_so_CCASFLAGS = $(AM_CCASFLAGS_X86_DARWIN)
##zz vgpreload_exp_omega_x86_darwin_so_DEPENDENCIES = $(LIBREPLACEMALLOC_X86_DARWIN)
##zz vgpreload_exp_omega_x86_darwin_so_LDFLAGS = \
##zz $(PRELOAD_LDFLAGS_X86_DARWIN) \
##zz $(LIBREPLACEMALLOC_LDFLAGS_X86_DARWIN)
##zz
##zz vgpreload_exp_omega_amd64_darwin_so_SOURCES = $(VGPRELOAD_OMEGA_SOURCES_COMMON)
##zz vgpreload_exp_omega_amd64_darwin_so_CPPFLAGS = $(AM_CPPFLAGS_AMD64_DARWIN)
##zz vgpreload_exp_omega_amd64_darwin_so_CFLAGS = $(AM_CFLAGS_AMD64_DARWIN) $(AM_CFLAGS_PIC) -O2
##zz vgpreload_exp_omega_amd64_darwin_so_CCASFLAGS = $(AM_CCASFLAGS_AMD64_DARWIN)
##zz vgpreload_exp_omega_amd64_darwin_so_DEPENDENCIES = $(LIBREPLACEMALLOC_AMD64_DARWIN)
##zz vgpreload_exp_omega_amd64_darwin_so_LDFLAGS = \
##zz $(PRELOAD_LDFLAGS_AMD64_DARWIN) \
##zz $(LIBREPLACEMALLOC_LDFLAGS_AMD64_DARWIN)
##zz
##zz OMEGA_SOURCES_COMMON = \
##zz o_main.c
##zz
##zz exp_omega_x86_linux_SOURCES = $(OMEGA_SOURCES_COMMON)
##zz exp_omega_x86_linux_CPPFLAGS = $(AM_CPPFLAGS_X86_LINUX)
##zz exp_omega_x86_linux_CFLAGS = $(AM_CFLAGS_X86_LINUX) -O2
##zz exp_omega_x86_linux_CCASFLAGS = $(AM_CCASFLAGS_X86_LINUX)
##zz exp_omega_x86_linux_DEPENDENCIES = $(COREGRIND_LIBS_X86_LINUX)
##zz exp_omega_x86_linux_LDADD = $(TOOL_LDADD_X86_LINUX)
##zz exp_omega_x86_linux_LDFLAGS = $(TOOL_LDFLAGS_X86_LINUX)
##zz
##zz exp_omega_amd64_linux_SOURCES = $(OMEGA_SOURCES_COMMON)
##zz exp_omega_amd64_linux_CPPFLAGS = $(AM_CPPFLAGS_AMD64_LINUX)
##zz exp_omega_amd64_linux_CFLAGS = $(AM_CFLAGS_AMD64_LINUX) -g -O0 #-O2
##zz exp_omega_amd64_linux_CCASFLAGS = $(AM_CCASFLAGS_AMD64_LINUX)
##zz exp_omega_amd64_linux_DEPENDENCIES = $(COREGRIND_LIBS_AMD64_LINUX)
##zz exp_omega_amd64_linux_LDADD = $(TOOL_LDADD_AMD64_LINUX)
##zz exp_omega_amd64_linux_LDFLAGS = $(TOOL_LDFLAGS_AMD64_LINUX)
##zz
##zz exp_omega_ppc32_linux_SOURCES = $(OMEGA_SOURCES_COMMON)
##zz exp_omega_ppc32_linux_CPPFLAGS = $(AM_CPPFLAGS_PPC32_LINUX)
##zz exp_omega_ppc32_linux_CFLAGS = $(AM_CFLAGS_PPC32_LINUX) -O2
##zz exp_omega_ppc32_linux_CCASFLAGS = $(AM_CCASFLAGS_PPC32_LINUX)
##zz exp_omega_ppc32_linux_DEPENDENCIES = $(COREGRIND_LIBS_PPC32_LINUX)
##zz exp_omega_ppc32_linux_LDADD = $(TOOL_LDADD_PPC32_LINUX)
##zz exp_omega_ppc32_linux_LDFLAGS = $(TOOL_LDFLAGS_PPC32_LINUX)
##zz
##zz exp_omega_ppc64_linux_SOURCES = $(OMEGA_SOURCES_COMMON)
##zz exp_omega_ppc64_linux_CPPFLAGS = $(AM_CPPFLAGS_PPC64_LINUX)
##zz exp_omega_ppc64_linux_CFLAGS = $(AM_CFLAGS_PPC64_LINUX) -O2
##zz exp_omega_ppc64_linux_CCASFLAGS = $(AM_CCASFLAGS_PPC64_LINUX)
##zz exp_omega_ppc64_linux_DEPENDENCIES = $(COREGRIND_LIBS_PPC64_LINUX)
##zz exp_omega_ppc64_linux_LDADD = $(TOOL_LDADD_PPC64_LINUX)
##zz exp_omega_ppc64_linux_LDFLAGS = $(TOOL_LDFLAGS_PPC64_LINUX)
##zz
##zz exp_omega_ppc32_aix5_SOURCES = $(OMEGA_SOURCES_COMMON)
##zz exp_omega_ppc32_aix5_CPPFLAGS = $(AM_CPPFLAGS_PPC32_AIX5)
##zz exp_omega_ppc32_aix5_CFLAGS = $(AM_CFLAGS_PPC32_AIX5) -O2
##zz exp_omega_ppc32_aix5_CCASFLAGS = $(AM_CCASFLAGS_PPC32_AIX5)
##zz exp_omega_ppc32_aix5_DEPENDENCIES = $(COREGRIND_LIBS_PPC32_AIX5)
##zz exp_omega_ppc32_aix5_LDADD = $(TOOL_LDADD_PPC32_AIX5)
##zz exp_omega_ppc32_aix5_LDFLAGS = $(TOOL_LDFLAGS_PPC32_AIX5)
##zz
##zz exp_omega_ppc64_aix5_SOURCES = $(OMEGA_SOURCES_COMMON)
##zz exp_omega_ppc64_aix5_CPPFLAGS = $(AM_CPPFLAGS_PPC64_AIX5)
##zz exp_omega_ppc64_aix5_CFLAGS = $(AM_CFLAGS_PPC64_AIX5) -O2
##zz exp_omega_ppc64_aix5_CCASFLAGS = $(AM_CCASFLAGS_PPC64_AIX5)
##zz exp_omega_ppc64_aix5_DEPENDENCIES = $(COREGRIND_LIBS_PPC64_AIX5)
##zz exp_omega_ppc64_aix5_LDADD = $(TOOL_LDADD_PPC64_AIX5)
##zz exp_omega_ppc64_aix5_LDFLAGS = $(TOOL_LDFLAGS_PPC64_AIX5)
##zz
##zz exp_omega_x86_darwin_SOURCES = $(OMEGA_SOURCES_COMMON)
##zz exp_omega_x86_darwin_CPPFLAGS = $(AM_CPPFLAGS_X86_DARWIN)
##zz exp_omega_x86_darwin_CFLAGS = $(AM_CFLAGS_X86_DARWIN) -O2
##zz exp_omega_x86_darwin_CCASFLAGS = $(AM_CCASFLAGS_X86_DARWIN)
##zz exp_omega_x86_darwin_DEPENDENCIES = $(COREGRIND_LIBS_X86_DARWIN)
##zz exp_omega_x86_darwin_LDADD = $(TOOL_LDADD_X86_DARWIN)
##zz exp_omega_x86_darwin_LDFLAGS = $(TOOL_LDFLAGS_X86_DARWIN)
##zz
##zz exp_omega_amd64_darwin_SOURCES = $(OMEGA_SOURCES_COMMON)
##zz exp_omega_amd64_darwin_CPPFLAGS = $(AM_CPPFLAGS_AMD64_DARWIN)
##zz exp_omega_amd64_darwin_CFLAGS = $(AM_CFLAGS_AMD64_DARWIN) -g -O0 #-O2
##zz exp_omega_amd64_darwin_CCASFLAGS = $(AM_CCASFLAGS_AMD64_DARWIN)
##zz exp_omega_amd64_darwin_DEPENDENCIES = $(COREGRIND_LIBS_AMD64_DARWIN)
##zz exp_omega_amd64_darwin_LDADD = $(TOOL_LDADD_AMD64_DARWIN)
##zz exp_omega_amd64_darwin_LDFLAGS = $(TOOL_LDFLAGS_AMD64_DARWIN)
##zz
##zz oincludedir = $(includedir)/valgrind
##zz
##zz oinclude_HEADERS = exp-omega.h
##zz
##zz noinst_HEADERS =
##zz
##zz o_replace_memops.o: CFLAGS += -fno-omit-frame-pointer
##zz
##zz o_main.o: CFLAGS += -fno-omit-frame-pointer #-fomit-frame-pointer
##zz

View File

@ -1,5 +0,0 @@
EXTRA_DIST = o-manual.xml omega_introduction.txt
###--- The original Makefile.am begins here ---###
##zz EXTRA_DIST = o-manual.xml

View File

@ -1,44 +0,0 @@
<?xml version="1.0"?> <!-- -*- sgml -*- -->
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<chapter id="o-manual" xreflabel="Omega">
<title>Omega: an instant memory leak detector</title>
<para>Omega is a Valgrind tool that traces pointers to memory
allocations and produces debug output as the last reference
is removed to a block that has not been de-allocated.</para>
<para>Omega works by tracking pointers with the use of p-bits.
In similar fashion to the methods used by memcheck and
addrcheck, each memory location is flagged by a p-bit which
indicates if the location is holding a pointer to an allocated
block. Since pointers are multibyte, we gain by only requiring
a single p-bit per pointer thus needing one p-bit per 4 bytes
on 32bit machines and one p-bit per 8 bytes on 64bit
architectures.</para>
<para>Whilst this simplifies and reduces the memory footprint of
one aspect of the tracking methodology, the other aspect can be
a bit of a memory hog. As each block is allocated, we need to
maintain data about the block and hold back-references to any
live pointers. There are various ways of doing this and as the
tool evolves further upon its release, doubtless you will all
improve upon it (and that's why I love open source).</para>
<para>This tool has been checked against the simple test cases in
the tests directory. Again, you will all have many more that
can be added.</para>
<para>Note that in order to reduce the overheads that this tool
incurs, it is assumed that the only problems left are memory
leaks. This assumption allows many corner cases to be left
un-coded. As we stumble upon those that cannot be avoided,
they can be added. A major assumption in the tracking is
that all pointers are aligned in memory. If this one fails,
the tracking code will have to be re-jigged.</para>
<para>Bryan "Brain Murders" Meredith, 2006</para>
</chapter>

View File

@ -1,190 +0,0 @@
Title
=====
Omega - A Valgrind tool for instant memory leak detection.
Designed by Bryan "Brain Murders" Meredith with grateful thanks to the
Valgrind team for making their tool and techniques available under the
GPL and my employer Apertio (www.apertio.com) for allowing the use of
their time, equipment for 64bit testing and providing moral support.
Synopsis
========
Whilst Valgrind's MemCheck tool can currently detect and report that a
memory leak has occurred, the debugging output only shows where the
memory that has leaked was allocated. There are no clues as to where
the last reference to the allocated block was lost. Omega uses a
modified version of MemCheck's "definedness" ('V' bit tracking)
technique in order to help track pointers to allocated memory,
outputting debugging information when the final (hence Omega) pointer
to an allocated block is over-written or lost through a call to free()
or the stack unwinding.
How it Works
============
The main task in tracking leaks is when a checking whenever a value is
written into memory or a register. This can result in the creation of
a new reference to an allocated block, the destruction of a current
reference to an allocated block or both. If we determine that either
the register to be written or the memory location to be written
contains a pointer that we are tracking, we update our tracking system
and report if we are losing the last pointer to a block.
Because checking every single write to memory causes a huge overhead,
we make a couple of assumptions about what constitutes a pointer in
order to reduce hash table lookups of the internal data. In order to
optimise checking for pointers during free() and stack unwinding, we
maintain a set of PBits (Pointer Bits) that allow us to quickly check
a range of addresses for pointers that will be lost.
A Simple Example
----------------
The program under test calls malloc (or one of the other heap
allocation functions). We generate an internal record to track the
address and size of the new block.
At each time we write to memory or a register is loaded, we check to
see if we have a tracked pointer record for the location about to be
written. If so, we remove this record and decrement the reference
count for the block that it pointed to, generating an alarm if this
was the last reference. We check if the value that we are writing
matches the address of an allocated block. If we get a match, we add a
tracked pointer record for the written address and increment the
reference count. To speed things up, the internal records are stored
in hash tables.
When we call free (or one of the other heap de-allocation functions),
we do cleanup processing on our internal record. There are two key
activities that must be performed at this point.
1) Clear and deallocate any hanging pointers.
2) Recursively remove references to any pointers that are within the
memory area that we are about to free.
As an option, during stage 1 we could report on the hanging pointers.
Note that stack unwinding also performs stage 2 to ensure that we
don't leak through automatic variables going out of scope.
'P' bit Propagation
-------------------
Each time we see an address of a memory block being written into an
address or register, in addition to setting up the tracked pointer
record, we also set a PBit to show that there is a tracked record for
the address. By using PBit lookups and caching the PBit nodes between
lookups (along with a dedicated PBit node for registers) we can get a
significant performance gain. The time when PBits really come into
their own is when we need to clear all of the tracked pointer records
from a range of memory ie. invalidating the stack, calling
free(). Using the PBit mechanism, we can check upto 64K in one
go. This can be a huge gain as many structures do not hold nested
pointers to allocated memory.
Stuff that I really want to add
===============================
Client Calls - This would allow us to track client based memory pool
implementations, MALLOC_LIKE_BLOCK() etc.
Summary Report - I want some feedback on what the output of the Omega
should be so watch this space.
Suppression Support - I don't know how much this is needed but it
would probably be worthwhile.
What We Can Detect
==================
Using the above techniques, we can track the following leaks:
Simple over-write of a tracked pointer.
lastP = blah;
Tracked pointer being modified (we wont raise a leak report on this -
we will track the offset within the block - see "Shadowing").
lastP++;
Automatic variable going out of scope.
{
void *lastP = malloc(64);
return;
}
Tracked pointer within allocated block being returned to OS.
{
void *arrayP = malloc(10 * sizeof(void *));
arrayP[1] = malloc(64);
free(arrayP);
}
Shadowing
=========
This helps to solve the problem of where a program does its own memory
management of the kind:
1 secret *foo = malloc(sizeof(bar) + sizeof(secret) + alignment_correction);
2 foo->secret_stuff = magic_key;
3 etc.
4 foo++;
5 return (bar*)foo;
If the pointer to foo is shadowed at some internal offset to the block
start, we create a shadow record and link it to the main block so that
we can track references to either. Without this we do a leak alert at
line 4 instead which is undesireable. There can only be one shadow to
a block unless we really need more and someone wants to code it and
send me a patch.
What We Don't Detect
--------------------
Actually, we do pretty well here but there are a couple of things you
need to know about.
1) We track pointers in registers. Therefore, whilst the final code
reference (on the stack say) may be lost, the pointer can (and
does) live on within a register until the register is
overwritten. The best way to help prevent this from making late
reports is to compile with -O0. On x86, this makes quite a
difference, especially to non-trivial functions.
2) Some code is a little naughty when it comes to memory blocks that
have been returned to the OS. Memcheck reports these read accesses
to free()ed blocks as illegal reads. Omega also reports them as it
gets annoyed when it has just reported a block as leaked only for a
pointer to appear from "no-where". (Calling free() on a block does
not erase the contents of the block so even though Omega removes
all tracked pointer records for addresses within the block, the
pointers themselves still exist. Once one of these pointers is
read, Omega tracks it being loaded into a register at which point,
it complains and resumes tracking the "leaked" block.)
What Next?
==========
Feedback!!!
The core of the tool is done and working. Now I need feedback from
anyone out there that is interested in using it so I can make the
output as usefull as it can be.
If anyone is interested in helping me out on this, send your
patches. I hope to get this accepted into Valgrind so it can get some
serious attention but I dont know if that will happen so I will try to
maintain a patch against svn or a tar of the whole thing if that gets
too troublesome.
Bryan "Brain Murders" Meredith. The current maintainer of Omega is
Rich Coe <richard.coe@med.ge.com>. Please send all email regarding
Omega to Rich.

View File

@ -1,61 +0,0 @@
/*------------------------------------------------------------------------*/
/*--- Definitions needing to be shared between source files. ---*/
/*--- omega.h ---*/
/*------------------------------------------------------------------------*/
/*
This file is part of Omega, a Valgrind tool for instantly detecting
memory leaks.
Copyright (C) 2006-2009 Bryan "Brain Murders" Meredith
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307, USA.
The GNU General Public License is contained in the file COPYING.
The current maintainer is Rich Coe <richard.coe@med.ge.com>.
*/
#ifndef __omega_h
#define __omega_h
#include "valgrind.h"
/*
** Setup client request calls so we can track entering and leaving main().
*/
typedef
enum {
VG_USERREQ__ENTERING_MAIN = VG_USERREQ_TOOL_BASE('O','M'),
VG_USERREQ__LEAVING_MAIN
} Vg_OmegaClientRequest;
#define VALGRIND_DO_ENTER_MAIN \
{unsigned int _qzz_res; \
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
VG_USERREQ__ENTERING_MAIN, \
0, 0, 0, 0, 0); \
}
#define VALGRIND_DO_LEAVE_MAIN \
{unsigned int _qzz_res; \
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
VG_USERREQ__LEAVING_MAIN, \
0, 0, 0, 0, 0); \
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,171 +0,0 @@
/*------------------------------------------------------------------------*/
/*--- Replacements for memcpy() et al, which run on the simulated CPU. ---*/
/*--- o_replace_memops.c ---*/
/*------------------------------------------------------------------------*/
/*
This file is part of Omega, a Valgrind tool for instantly detecting
memory leaks.
Copyright (C) 2006-2009 Bryan "Brain Murders" Meredith
Derived from mac_replace_strmem.c
Copyright (C) 2000-2006 Julian Seward
jseward@acm.org
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307, USA.
The GNU General Public License is contained in the file COPYING.
The current maintainer is Rich Coe <richard.coe@med.ge.com>.
*/
#include <stdio.h>
#include "pub_tool_basics.h"
#include "valgrind.h"
#include "exp-omega.h"
/* ---------------------------------------------------------------------
We have our own versions of these functions so that we can correctly
track pointers that are duplicated or overwritten.
THEY RUN ON THE SIMD CPU!
------------------------------------------------------------------ */
int I_WRAP_SONAME_FNNAME_ZU(NONE,main) ( int n, char *a[], char *e[] );
int I_WRAP_SONAME_FNNAME_ZU(NONE,main) ( int n, char *a[], char *e[] )
{
int r;
OrigFn fn;
VALGRIND_GET_ORIG_FN(fn);
VALGRIND_DO_ENTER_MAIN;
CALL_FN_W_WWW(r, fn, n, a, e);
VALGRIND_DO_LEAVE_MAIN;
return r;
}
void* I_WRAP_SONAME_FNNAME_ZU(NONE,memcpy)( void *dst, const void *src, SizeT len );
void* I_WRAP_SONAME_FNNAME_ZU(NONE,memcpy)( void *dst, const void *src, SizeT len )
{
register char *d;
register char *s;
if (len == 0)
return dst;
if ( dst > src ) {
d = (char *)dst + len - 1;
s = (char *)src + len - 1;
while ( len >= 4 ) {
*d-- = *s--;
*d-- = *s--;
*d-- = *s--;
*d-- = *s--;
len -= 4;
}
while ( len-- ) {
*d-- = *s--;
}
} else if ( dst < src ) {
d = (char *)dst;
s = (char *)src;
while ( len >= 4 ) {
*d++ = *s++;
*d++ = *s++;
*d++ = *s++;
*d++ = *s++;
len -= 4;
}
while ( len-- ) {
*d++ = *s++;
}
}
return dst;
}
void* I_WRAP_SONAME_FNNAME_ZU(NONE,mempcpy)( void *dst, const void *src, SizeT len );
void* I_WRAP_SONAME_FNNAME_ZU(NONE,mempcpy)( void *dst, const void *src, SizeT len )
{
register char *d;
register char *s;
if (len == 0)
return dst;
if ( dst > src ) {
d = (char *)dst + len - 1;
s = (char *)src + len - 1;
while ( len >= 4 ) {
*d-- = *s--;
*d-- = *s--;
*d-- = *s--;
*d-- = *s--;
len -= 4;
}
while ( len-- ) {
*d-- = *s--;
}
} else if ( dst < src ) {
d = (char *)dst;
s = (char *)src;
while ( len >= 4 ) {
*d++ = *s++;
*d++ = *s++;
*d++ = *s++;
*d++ = *s++;
len -= 4;
}
while ( len-- ) {
*d++ = *s++;
}
}
return ((Char*)dst + len);
}
void* I_WRAP_SONAME_FNNAME_ZU(NONE,memmove)(void *dstV, const void *srcV, SizeT n);
void* I_WRAP_SONAME_FNNAME_ZU(NONE,memmove)(void *dstV, const void *srcV, SizeT n)
{
SizeT i;
Char* dst = (Char*)dstV;
Char* src = (Char*)srcV;
if (dst < src) {
for (i = 0; i < n; i++)
dst[i] = src[i];
}
else
if (dst > src) {
for (i = 0; i < n; i++)
dst[n-i-1] = src[n-i-1];
}
return dst;
}
void* I_WRAP_SONAME_FNNAME_ZU(NONE,memset)(void *s, Int c, SizeT n);
void* I_WRAP_SONAME_FNNAME_ZU(NONE,memset)(void *s, Int c, SizeT n)
{
unsigned char *cp = s;
while(n--)
*cp++ = c;
return s;
}
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/

View File

@ -1,49 +0,0 @@
EXTRA_DIST = block1.c \
block2.c \
block3.c \
overwrite1.c \
overwrite2.c \
overwrite3.c \
overwrite4.c \
overwrite5.c \
scope1.c \
scope2.c \
scope3.c \
scope4.cpp \
scope5.c \
scope6.c \
shadow1.c \
static1.c
###--- The original Makefile.am begins here ---###
##zz
##zz noinst_SCRIPTS =
##zz
##zz #EXTRA_DIST = $(noinst_SCRIPTS)
##zz
##zz check_PROGRAMS = \
##zz overwrite1 \
##zz overwrite2 \
##zz overwrite3 \
##zz overwrite4 \
##zz overwrite5 \
##zz scope1 \
##zz scope2 \
##zz scope3 \
##zz scope4 \
##zz scope5 \
##zz scope6 \
##zz block1 \
##zz block2 \
##zz block3 \
##zz shadow1 \
##zz static1
##zz
##zz AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O0 -g
##zz AM_CXXFLAGS = $(AM_CFLAGS) -Wall -O0 -g
##zz
##zz # C++ tests
##zz scope4_SOURCES = scope4.cpp
##zz

View File

@ -1,19 +0,0 @@
#include <stdlib.h>
int main(int argc, char *argv[])
{
typedef struct
{
char *spointer1;
} structure;
structure *pointer1 = 0;
pointer1 = malloc(4 * sizeof(structure)); /* Line 12 */
pointer1[1].spointer1 = malloc(64); /* Line 13 */
free(pointer1); /* Leak report Line 15 */
free(pointer1); /* Double/Invalid free report Line 16 */
return 0;
}

View File

@ -1,19 +0,0 @@
#include <stdlib.h>
int main(int argc, char *argv[])
{
typedef struct
{
char *spointer1;
} structure;
structure **pointer1 = 0;
pointer1 = (structure **)malloc(4 * sizeof(structure *)); /* Line 12 */
pointer1[1] = (structure *)malloc(sizeof(structure)); /* Line 13 */
pointer1[1]->spointer1 = (char *)malloc(64); /* Line 14 */
free(pointer1); /* Leak reports Line 16 */
return 0;
} /* Leak reports actually on Line 19 due to timing of stack invalidation */

View File

@ -1,27 +0,0 @@
#include <stdlib.h>
typedef struct
{
char *spointer1;
} structure;
structure **func1(void)
{
structure **pointer1 = 0;
pointer1 = (structure **)malloc(4 * sizeof(structure *)); /* Line 13 */
pointer1[1] = (structure *)malloc(sizeof(structure)); /* Line 14 */
pointer1[1]->spointer1 = (char *)malloc(64); /* Line 15 */
return pointer1;
}
int main(int argc, char *argv[])
{
structure **pointer1 = func1();
free(pointer1); /* Leak reports Line 24 */
return 0;
}

View File

@ -1,11 +0,0 @@
#include <stdlib.h>
int main(int argc, char *argv[])
{
char *pointer = 0;
pointer = malloc(64); /* Line 7 */
pointer = 0; /* Leak report Line 8 */
return 0;
}

View File

@ -1,11 +0,0 @@
#include <stdlib.h>
int main(int argc, char *argv[])
{
char *pointer = 0;
pointer = malloc(64); /* Line 7 */
pointer++; /* Creates shadow to track the block. */
return 0;
} /* Leak report Line 11. */

View File

@ -1,14 +0,0 @@
#include <stdlib.h>
int main(int argc, char *argv[])
{
char *pointer1 = 0;
char *pointer2 = 0;
pointer1 = malloc(64); /* Line 8. */
pointer2 = pointer1;
pointer1 = NULL;
pointer2 = NULL; /* Leak report Line 11. */
return 0;
}

View File

@ -1,15 +0,0 @@
#include <stdlib.h>
int main(int argc, char *argv[])
{
char *pointer1 = 0;
pointer1 = malloc(64); /* Line 7 */
{
char *pointer2 = (char *)&pointer1;
pointer2[1] = 1; /* Leak Line 11. */
}
return 0;
}

View File

@ -1,12 +0,0 @@
#include <stdlib.h>
int main(int argc, char *argv[])
{
char *pointer1 = 0;
pointer1 = malloc(64); /* Line 7 */
pointer1 = malloc(32); /* Leak report Line 8 */
pointer1 = NULL; /* Leak report Line 9 */
return 0;
}

View File

@ -1,10 +0,0 @@
#include <stdlib.h>
int main(int argc, char *argv[])
{
char *pointer = 0;
pointer = malloc(64); /* Line 7 */
return 0;
} /* Leak report Line 10 */

View File

@ -1,17 +0,0 @@
#include <stdlib.h>
static void func1(void)
{
char *pointer = 0;
pointer = malloc(64); /* Line 7 */
return;
} /* Leak report Line 10 */
int main(int argc, char *argv[])
{
func1();
return 0;
}

View File

@ -1,14 +0,0 @@
#include <stdlib.h>
static void func1(char *pointer)
{
__attribute__((unused)) int dummy = 0;
return;
} /* Line 7 x86-64*/
int main(int argc, char *argv[])
{
func1((char *)malloc(64)); /* Line 11 */
return 0;
} /* Line 14 x86 due to timing of stack invalidation */

View File

@ -1,38 +0,0 @@
#include <stdlib.h>
class Class1
{
public:
Class1(char *cpointer = NULL) : p(cpointer){};
~Class1()
{
if(p)
{
free(p);
}
};
private:
char *p;
};
Class1 function1(void)
{
Class1 c((char *)malloc(64));
return c;
}
void function2(void)
{
Class1 c = function1();
return;
}
int main(int argc, char* argv[])
{
function2();
return 0;
}

View File

@ -1,22 +0,0 @@
#include <stdlib.h>
static void func1(void)
{
char *pointer = 0;
pointer = malloc(64); /* Line 7 */
return;
} /* Leak report here Line 10 */
int main(int argc, char *argv[])
{
int i = 0;
for(i = 0; i < 5; i++)
{
func1();
}
return 0;
}

View File

@ -1,19 +0,0 @@
#include <stdlib.h>
int main(int argc, char *argv[])
{
char *pointer = 0;
pointer = malloc(64); /* Line 7 */
do
{
char *pointer2 = 0;
pointer2 = malloc(32); /* Line 13 */
} while (0);
return 0;
} /* Leak report Line 19 */

View File

@ -1,44 +0,0 @@
#include <stdlib.h>
typedef struct
{
int tracking;
unsigned long alignment;
} structure1;
void *fake_malloc(size_t length)
{
structure1 *pointer1 = 0;
pointer1 = malloc(sizeof(structure1) + length);
if(pointer1)
{
pointer1->tracking = 3;
pointer1++;
}
return pointer1;
}
void fake_free(void *pointer2)
{
structure1 *pointer3 = (structure1 *)pointer2;
if(pointer3)
{
pointer3--;
free(pointer3);
}
return;
}
int main(int argc, char *argv[])
{
void *pointer4 = 0;
pointer4 = fake_malloc(50);
fake_free(pointer4);
return 0;
} /* No leaks. */

View File

@ -1,10 +0,0 @@
#include <stdlib.h>
static char *pointer1 = NULL;
int main(int argc, char *argv[])
{
pointer1 = malloc(64);
return 0;
} /* No leak. */