History log of /external/valgrind/helgrind/hg_main.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
328d6627c26471332610da3f5a0b9cc3cdd410c7 25-May-2015 philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> This patch decreases significantly the memory needed for OldRef and
slightly increases the performance. It also moderately improves
the nr of cases where helgrind can provide the stack trace of the old
access (when using the same amount of memory for the OldRef entries).
The patch also provides a new helgrind monitor command to show
the recorded accesses for an address+len, and adds an optional argument
lock_address to the monitor command 'info locks', to show the info
about just this lock.

Currently, oldref are maintained in a sparse WA, that points to N
entries, as specified by --conflict-cache-size=N.
For each entry (associated to an address), we have the last 5 accesses.

Old entries are recycled in an exact LRU order.
But inside an entry, we could have a recent access, and 4 very
old accesses that are kept 'alive' by a single thread accessing
repetitively the address shared with the 4 other old entries.


The attached patch replaces the sparse WA that maintains the OldREf
by an hash table.
Each OldRef now also only maintains one single access for an address.
As an OldRef now maintains only one access, all the entries are now
strictly in LRU mode.

Memory used for OldRef
-----------------------
For the trunk, an OldRef has a size of 72 bytes (on 32 bits archs)
maintaining up to 5 accesses to the same address.
On 64 bits arch, an OldRef is 104 bytes.

With the patch, an OldRef has a size of 32 bytes (on 32 bits archs)
or 56 bytes (on 64 bits archs).

So, for one single access, the new code needs (on 32 bits)
32 bytes, while the trunk needs only 14.4 bytes.
However, that is the worst case, assuming that the 5 entries in the
accs array are all used.
Looking on 2 big apps (one of them being firefox), we see that
we have very few OldRef entries that have the 5 entries occupied.
On a firefox startup, of the 5x1,000,000 accesses, we only have
1,406,939 accesses that are used.
So, in average, the trunk uses in reality around 52 bytes per access.

The default value for --conflict-cache-size has been doubled to 2000000.
This ensures that the memory used for the OldRef is more or less the
same as the trunk (104Mb for OldRef entries).

Memory used for sparseWA versus hashtable
-----------------------------------------
Looking on 2 big apps (one of them being firefox), we see that
there are big variations on the size of the WA : it can go in a few
seconds from 10MB to 250MB, or can decrease back to 10 MB.
This all depends where the last N accesses were done: if well localised,
the WA will be small.
If the last N accesses were distributed over a big address space,
then the WA will be big: the last level of WA (the biggest memory consumer)
uses slightly more than 1KB (2KB on 64 bits) for each '256 bytes' memory
zone where there is an oldref. So, in the worst case, on 32 bits, we
need > 1_000_000_000 sparseWA memory to keep 1_000_000 OldRef.

The hash table has between 1 to 2 Word overhead per OldRef
(as the chain array is +- doubled each time the hash table is full).
So, unless the OldRef are extremely localised, the overhead of the
hash table will be significantly less.

With the patch, the core arena total alloc is:
5299535/1201448632 totalloc-blocks/bytes
The trunk is
6693111/3959050280 totalloc-blocks/bytes
(so, around 1.20Gb versus 3.95Gb).
This big difference is due to the fact that the sparseWA repetitively
allocates then frees Level0 or LevelN when OldRef in the region covered
by the Level0/N have all been recycled.

In terms of CPU
---------------
With the patch, on amd64, a firefox startup seems slightly faster (around 1%).
The peak memory mmaped/used decreases by 200Mb.
For a libreoffice test, the memory decreases by 230Mb. CPU also decreases
slightly (1%).


In terms of correctness:
-----------------------
The trunk could potentially show not the most recent access
to the memory of a race : the first OldRef entry matching the raced upon
address was used, while we could have a more recent access in a following
OldRef entry. In other words, the trunk only guaranteed to find the
most recent access in an OldRef, but not between the several OldRef that
could cover the raced upon address.
So, assuming it is important to show the most recent access, this patch
ensures we really show the most recent access, even in presence of overlapping
accesses.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15289 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
fc00a2a1f86ba77f905c8ee34b3c8c949bb9c107 15-May-2015 philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> This patch (re-)gains performance in helgrind, following revision 15207, that
reduced memory use doing SecMap GC, but was slowing down some workloads
(typically, workloads doing a lot of malloc/free).

A significant part of the slowdown came from the clear of the filter,
that was not optimised for big ranges : the filter was working byte
per byte till an 8 alignment. Then working per 8 bytes at a time.

With the patch, the filter clear is done the following way:
* all the bytes till 8 alignement are done together
* then 8 bytes at a time till filter_line alignment (32 bytes)
* then 32 bytes at a time.

Moreover, as the filter cache is small (1024 lines of 32 bytes),
clearing filter for ranges bigger than 32Kb was uselessly checking
several times the same entry. This is now avoided by using a range
check rather than a tag equality check.

As the new filter clear is significanly more complex than the previous simple
algorithm, the old algorithm is kept and used to check the new algorithm
when CHECK_ZSM is defined as 1.

The patch also contains a few micro optimisations and
disables
// VG_(track_die_mem_stack) ( evh__die_mem );
as this had no effect and was somewhat costly.

With this patch, we have almost reached for all perf tests the same
performance as we had before revision 15207. Some tests are still
slightly slower than before the SecMap GC (max 2% difference).
Some tests are now significantly faster (e.g. sarp).
For almost all tests, we are now faster than valgrind 3.10.1.
Details below.

Regtested on x86/amd64/ppc64 (and regtested with all compile time
checks set).
I have also regtested with libreoffice and firefox.
(with firefox, also with CHECK_ZSM set to 1).


Details about performance:
hgtrace = this patch
trunk_untouched = trunk
base_secmap = trunk before secmap GC
valgrind 3.10.1 included for comparison
Measured on core i5 2.53GHz


-- Running tests in perf ----------------------------------------------
-- bigcode1 --
bigcode1 hgtrace :0.14s he: 2.6s (18.4x, -----)
bigcode1 trunk_untouched:0.14s he: 2.6s (18.4x, -0.4%)
bigcode1 base_secmap:0.14s he: 2.6s (18.6x, -1.2%)
bigcode1 valgrind-3.10.1:0.14s he: 2.8s (19.8x, -7.8%)
-- bigcode2 --
bigcode2 hgtrace :0.14s he: 6.3s (44.7x, -----)
bigcode2 trunk_untouched:0.14s he: 6.2s (44.6x, 0.2%)
bigcode2 base_secmap:0.14s he: 6.3s (45.0x, -0.6%)
bigcode2 valgrind-3.10.1:0.14s he: 6.6s (47.1x, -5.4%)
-- bz2 --
bz2 hgtrace :0.64s he:11.3s (17.7x, -----)
bz2 trunk_untouched:0.64s he:11.7s (18.2x, -3.2%)
bz2 base_secmap:0.64s he:11.1s (17.3x, 1.9%)
bz2 valgrind-3.10.1:0.64s he:12.6s (19.7x,-11.3%)
-- fbench --
fbench hgtrace :0.29s he: 3.4s (11.8x, -----)
fbench trunk_untouched:0.29s he: 3.4s (11.7x, 0.6%)
fbench base_secmap:0.29s he: 3.6s (12.4x, -5.0%)
fbench valgrind-3.10.1:0.29s he: 3.5s (12.2x, -3.5%)
-- ffbench --
ffbench hgtrace :0.26s he: 9.8s (37.7x, -----)
ffbench trunk_untouched:0.26s he:10.0s (38.4x, -1.9%)
ffbench base_secmap:0.26s he: 9.8s (37.8x, -0.2%)
ffbench valgrind-3.10.1:0.26s he:10.0s (38.4x, -1.9%)
-- heap --
heap hgtrace :0.11s he: 9.2s (84.0x, -----)
heap trunk_untouched:0.11s he: 9.6s (87.1x, -3.7%)
heap base_secmap:0.11s he: 9.0s (81.9x, 2.5%)
heap valgrind-3.10.1:0.11s he: 9.1s (82.9x, 1.3%)
-- heap_pdb4 --
heap_pdb4 hgtrace :0.13s he:10.7s (82.3x, -----)
heap_pdb4 trunk_untouched:0.13s he:11.0s (84.8x, -3.0%)
heap_pdb4 base_secmap:0.13s he:10.5s (80.8x, 1.8%)
heap_pdb4 valgrind-3.10.1:0.13s he:10.6s (81.8x, 0.7%)
-- many-loss-records --
many-loss-records hgtrace :0.01s he: 1.5s (152.0x, -----)
many-loss-records trunk_untouched:0.01s he: 1.6s (157.0x, -3.3%)
many-loss-records base_secmap:0.01s he: 1.6s (158.0x, -3.9%)
many-loss-records valgrind-3.10.1:0.01s he: 1.7s (167.0x, -9.9%)
-- many-xpts --
many-xpts hgtrace :0.03s he: 2.8s (91.7x, -----)
many-xpts trunk_untouched:0.03s he: 2.8s (94.7x, -3.3%)
many-xpts base_secmap:0.03s he: 2.8s (94.0x, -2.5%)
many-xpts valgrind-3.10.1:0.03s he: 2.9s (97.7x, -6.5%)
-- memrw --
memrw hgtrace :0.06s he: 7.3s (121.2x, -----)
memrw trunk_untouched:0.06s he: 7.2s (120.3x, 0.7%)
memrw base_secmap:0.06s he: 7.1s (117.7x, 2.9%)
memrw valgrind-3.10.1:0.06s he: 8.1s (135.2x,-11.6%)
-- sarp --
sarp hgtrace :0.02s he: 7.6s (378.5x, -----)
sarp trunk_untouched:0.02s he: 8.4s (422.0x,-11.5%)
sarp base_secmap:0.02s he: 8.6s (431.0x,-13.9%)
sarp valgrind-3.10.1:0.02s he: 8.8s (442.0x,-16.8%)
-- tinycc --
tinycc hgtrace :0.20s he:12.4s (62.0x, -----)
tinycc trunk_untouched:0.20s he:12.6s (63.2x, -1.9%)
tinycc base_secmap:0.20s he:12.6s (63.0x, -1.6%)
tinycc valgrind-3.10.1:0.20s he:12.7s (63.5x, -2.3%)
-- Finished tests in perf ----------------------------------------------

== 12 programs, 48 timings =================




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15236 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
f54cb66eba8137cac5b3ee8be29bb24c1ddfb535 11-May-2015 philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> This patch decreases the memory used by the helgrind SecMap,
by implementing a Garbage Collection for the SecMap.

The basic change is that freed memory is marked as noaccess
(while before, it kept the previous marking, on the basis that
non buggy applications are not accessing freed memory in any case).
Keeping the previous marking avoids the CPU/memory changes needed
to mark noaccess.

However, marking freed memory noaccess and GC the secmap reduces
the memory on big apps.
For example, a firefox test needs 220Mb less (on about 2.06 Gb).
Similar reduction for libreoffice batch (260 MB less on 1.09 Gb).
On such applications, the performance with the patch is similar to the trunk.

There is a performance decrease for applications that are doing
a lot of malloc/free repetitively: e.g. on some perf tests, an increase
in cpu of up to 15% has been observed.

Several performance optimisations can be done afterwards to not loose
too much performance. The decrease of memory is expected to produce
in any case significant benefit in memory constrained environments
(e.g. android phones).

So, after discussion with Julian, it was decided to commit as-is
and (re-)gain (part of) performance in follow-up commits.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15207 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
bf37ae8a3e8a9270477c068675d5ec026b676cb0 03-May-2015 philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> Reduce nr of lines produced by laog gc --stats=yes


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15176 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
d005b2ccaa44bd1e4633a806788ad387701b9e69 21-Apr-2015 philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> Add some stats to helgrind stats:
* nr of client malloc-ed blocks
* how many OldRef helgrind has, and the distribution
of these OldRef according to the nr of accs they have



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15128 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
f466eef8e53aafcb617997e1ca18b7c829168db8 02-Jan-2015 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Track the IMark changes in VEX r3055.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14844 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
09a4c794458cdb9dea743fa40e450150a2725257 18-Oct-2014 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Change the definition of VgHashTable to not have pointer type.
This is (a) consistent with how the other containers are defined
and, more importantly, (b) allows the constification of the hash table API.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14639 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
2b9232a557d247308194de5c6d864658243228c5 11-Oct-2014 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Handle (by ignoring) Imbe_CancelReservation. Detected by Florian
Krohm when compiling with -Wswitch-enum.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14618 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
3c0c94777f547bcb5eadbe8cb4328debf0f51875 24-Sep-2014 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Ripple from constifying parameters of instrumentation functions and
callbacks from VexTranslateArgs. See VEX r2958.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14564 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
91ed8ccd3dae8a6abfaa45cc0d250df47b45187f 15-Sep-2014 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Tidy up m_xarray.c.
VG_(newXA) and VG_(cloneXA) never return NULL. Remove pointless asserts.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14539 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
6aa8bd03abedae0a3d210eaaf76b2f25775b731a 15-Sep-2014 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Tidy up m_wordfm.
First, as the allocator function does not fail, there is no need
to assert its return value.
Second, remove commented out (since r8765) function VG_(isEmptyFM).
Third, remove VG_(getNodeSizeFM) from the API. The details of the
implementation do not need to be exposed.
Fourth, for consistency require that the copy functions for keys and
values in VG_(dopyFM) (which are essentially like allocators) return
non-NULL values for non-NULL arguments if they return.
Fifth, document NULL-ness of return values for VG_(newFM), VG_(dopyFM),
and VG_(newBag). Remove pointless asserts at call sites.
Six, change avl_dopy to assert that the node the function is
supposed to copy is not NULL. It is called that way anyhow. With
that change the function never returns NULL which allows us to
simplify the call sites. Checking the return value is no longer needed.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14535 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
68790a73bcb290746a5b34c44538c3b2728eaaec 13-Sep-2014 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> VG_(malloc/calloc/strdup) never return NULL (and never will).
So it's pointless to test or assert their return values.
Remove code doing so.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14528 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
438c471d85bf6c93a8d86576b8754bb6c68b1084 05-Sep-2014 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> evh__new_mem_heap: get rid of pointless conditional. Spotted by
Coverity and Florian Krohm.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14472 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
4fa71081858358c26ad182b82d2ddc305b2e72f1 01-Sep-2014 mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9> Bug 338703 helgrind on arm-linux gets false positives in dynamic loader.

There are a couple of issues with helgrind on arm-linux with glibc:

- Thread creation stack traces cannot unwind through clone
(cfi ends right after syscall)
- ld.so has a special "hard float" name that isn't recognized as special
(ld-linux-armhf.so.3)
- Races are found when manipulating GOT sections.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14407 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
36750c04ace9c967ebb80a8bd43985bd28efc1f2 30-Aug-2014 mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9> Bug 338681 Enable clone backtrace hack for i386-linux in helgrind.

glibc doesn't provide CFI unwind information right after the clone call
(because it would be invalid in the child). Enable the same workaround
for i386-linux that is already used for amd64-linux (subtract 3 from ip).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14398 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
5a460f5eeb55cc7e1fe2edf0bb795c0390d6564b 30-Aug-2014 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix (kludge) stack unwinding through clone on arm64-linux. This is
the same problem as shown in #338681, except for arm64-linux instead
of x86-linux.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14397 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
dcd90513c0ed2c19fe54fea546962e096ffcba19 30-Aug-2014 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Helgrind needs to know the soname of ld.so, and on arm64-linux
it is different (ld-linux-aarch64.so.1) from all other targets.
(Why?) This makes Helgrind at least somewhat usable on arm64-linux.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14396 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
582d58245637ab05272d89fb94b12fd0f18fa0f8 08-Aug-2014 carll <carll@a5019735-40e9-0310-863c-91ae7b9d1cf9> This commit is for Bugzilla 334834. The Bugzilla contains patch 2 of 3
to add PPC64 LE support. The other two patches can be found in Bugzillas
334384 and 334836.

POWER PC, add the functional Little Endian support, patch 2

The IBM POWER processor now supports both Big Endian and Little Endian.
The ABI for Little Endian also changes. Specifically, the function
descriptor is not used, the stack size changed, accessing the TOC
changed. Functions now have a local and a global entry point. Register
r2 contains the TOC for local calls and register r12 contains the TOC
for global calls. This patch makes the functional changes to the
Valgrind tool. The patch makes the changes needed for the
none/tests/ppc32 and none/tests/ppc64 Makefile.am. A number of the
ppc specific tests have Endian dependencies that are not fixed in
this patch. They are fixed in the next patch.

Per Julian's comments renamed coregrind/m_dispatch/dispatch-ppc64-linux.S
to coregrind/m_dispatch/dispatch-ppc64be-linux.S Created new file for LE
coregrind/m_dispatch/dispatch-ppc64le-linux.S. The same was done for
coregrind/m_syswrap/syscall-ppc-linux.S.

Signed-off-by: Carl Love <carll@us.ibm.com>

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14239 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
46daf0d598c38c9251964712d894f0fcd3cc4143 29-Jul-2014 philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> Helgrind lock related error msg improvements.

* Add lock announcements in various helgrind errors that were not
announcing the locks
* ensure locks are also announced in xml (note that this is compatible
with xml protocol version 4, so no impact on GUI which properly
implement the protocol)

Changes done:
* Like other HG record_error functions, HG_(record_error_LockOrder) is
now passing Lock* rather than lock guest addresses.
* update exp files for tests that were showing locks without announcing them
* change tc14_laog_dinphils.c and tc15_laog_lockdel.c so as to
have same sizes on 32 and 64 bits systems for allocated or symbol sizes.
* factorise all code that was announcing first lock observation
* enable xml lock announcement





git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14204 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
0c9ac8d0deca2f2a552fb2b0cab24efe6191bac7 18-Jul-2014 philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> Patch adding (or showing the proper/not confusing) helgrind thread nr for block
and stack address description.

* A race condition on an allocated block shows the stacktrace, but
does not show the thread # that allocated the block.
This patch adds the output of the thread # that allocated the block.

* The patch also fixes the confusion that might appear between
the core threadid and the helgrind thread nr in Stack address description:
A printed stack addrinfo was containing a thread id, while all other helgrind
messages are using (supposed to use) an 'helgrind thread #' which
is used in the thread announcement.

Basically, the idea is to let a tool set a "tool specific thread nr'
in an addrinfo.
The pretty printing of the addrinfo is then by preference showing this
thread nr (if it was set, i.e. different of 0).
Currently, only helgrind uses this addrinfo tnr.

Note: in xml mode, the output is matching the protocol description.
I.e., GUI should not be impacted by this change, if they properly implement
the xml protocol.


* Also, make the output produced by m_addrinfo consistent:
The message 'block was alloc'd at' is changed to be like all other
output : one character indent, and starting with an uppercase



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14175 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
d40aff57c031d626765691a2f1912ad4e95aa0dc 16-Jun-2014 philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> Add helgrind intercepts to have helgrind understanding Ada tasks terination rules
A recent gnatpro version is needed for this to work.

Thanks to these intercepts, some false positive errors are avoided,
and helgrind properly recuperates some internal memory associated
to the terminated task.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14046 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
07c08527f05caeb0062b42ca9a58ee774ec5fba1 14-May-2014 philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> Factorises the address code description and printing
of memcheck and helgrind in a common module:
pub_tool_addrinfo.h pub_core_addrinfo.h m_addrinfo.c

At the same time, the factorised code is made usable by other
tools also (and is used by the gdbserver command 'v.info location'
which replaces the helgrind 'describe addr' introduced 1 week ago
and which is now callable by all tools).

The new address description code can describe more addresses
(e.g. for memcheck, if the block is not on the free list anymore,
but is in an arena free list, this will also be described).

Similarly, helgrind address description can now describe more addresses
when --read-var-info=no is given (e.g. global symbols are
described, or addresses on the stack are described as
being on the stack, freed blocks in the arena free list are
described, ...).
See e.g. the change in helgrind/tests/annotate_rwlock.stderr.exp
or locked_vs_unlocked2.stderr.exp

The patch touches many files, but is basically a lot of improvements
in helgrind output files.
The code changes are mostly refactorisation of existing code.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13965 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
7a596dae711d307643b78441d62fcca779a98a85 06-May-2014 philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix two warnings of unusued variable or variable set but not used


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13939 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
f57743408d27fedf60a7b48d25339d51b1f8a055 03-May-2014 philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> Helgrind : two new gdbserver commands 'describe address' and 'info locks'
- Helgrind GDB server monitor command 'describe <address>'
allowing to describe an address (e.g. where it was allocated).
- Helgrind GDB server monitor command 'info locks' giving
the list of locks, their location, and their status.

In a further patch, it is intended to
1. factorise the describe address code between memcheck and helgrind
2. generalise the describe address gdbsrv command so as to make
it usable for all tools.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13930 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
8587b54312d2ac75d9d9fc7c2d3cb14f5d1ae841 15-Dec-2013 philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> Implement gdbsrv "v.info stats" command giving statistics for valgrind core + tools

* addition of VG_(needs_print_stats) in pub_tool_tooliface.h
* use the above in memcheck and helgrind
* output valgrind stats and calls print_stats in server.c



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13760 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
5fbc97675bb613a9fe3e1d4206d9703f869b731f 01-Dec-2013 philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> Decrease helgrind memory use for applications allocating many blocks

Use a pool allocator for the MallocMeta struct that helgrind maintains
for each client allocated block.

For perf/heap on x86, this decreases the max amount of mmap-ed memory
for the core area from 56Mb to 36Mb.
On amd64, decreases from 104Mb to 62Mb.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13744 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
0f157ddb404bcde7815a1c5bf2d7e41c114f3d73 18-Oct-2013 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Update copyright dates (20XY-2012 ==> 20XY-2013)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13658 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
4e32d67a5b880bf1d871c5141822078d4dcdc3ac 18-Oct-2013 philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> Allow tools to provide some statistics in suppression list produced at the end

Option -v outputs a list of used suppressions. This only gives
the nr of times a suppression was used.
For a leak search, this only gives the nr of loss records that
have been suppressed, but it does not give additional needed details
to understand more precisely what has been suppressed
(i.e. nr of blocks and nr of bytes).

=> Add in the tool interface update_extra_suppression_use and
print_extra_suppression_info functions to allow the tool to record
additioonal use statistics for a suppression. These statistics
can be done depending on the error (and its data) which is suppressed.

Use this in memcheck for the leak suppressions, to maintain and output
the nr of blocks and bytes suppressed by a suppression during
the last leak search.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13651 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
c02f6c4eadb1c7aa4ed25a2e1c25e084bdea30ee 14-Oct-2013 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix #323432: When calling pthread_cond_destroy or pthread_mutex_destroy
with initializers as argument Helgrind (incorrectly) reports errors.
(Peter Boström, valgrind@pbos.me)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13642 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
ff427c931b03df72de7dfb36d5cbb0c636a33705 14-Oct-2013 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> For pthread_cond_destroy, don't report a false it's-still-waited-on
error if in fact the last wait finished with ETIMEDOUT.
Fixes #324149. (Peter Boström, valgrind@pbos.me)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13641 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
19dfe03b731ca69bdfcee4e62010a5b5c98c4b5e 24-Mar-2013 philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> fix 307082 HG false positive: pthread_cond_destroy: destruction of unknown cond var


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13332 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
24111974eef937b157023234be7063f0f45120de 18-Mar-2013 philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> Better fix for 295590
(problem reported in bug 307082, comment 8).
Solution applied is similar to what is in 307082 patch
(i.e. do not destroy the internal helgrind var if nWaiters > 0).
But also do not remove it from the FM.

+ add a test case (re-using the drd test case)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13329 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
ebe2580d8386f8b8d8f11c2dc061df05712d7d14 31-Jan-2013 philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> better handle and better document the case of multi-locks cycles
In case a lock order violation is detected in a multi lock cycle,
then the current code cannot produce the set of locks and the
stack traces involved in the cycle.
However, it is still possible to produce the stack trace of
the new lock and the other lock between which a cycle was discovered.

Also, add a comment in the code clarifying why the set of locks
establishing the required order cannot (currently) be produced.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13281 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
cafe50502ae73d6d6d0f214e06a4619e6cb1b278 17-Jan-2013 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge, from branches/COMEM, revisions 13139 to 13235.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13236 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
6bd9dc18c043927c1196caba20a327238a179c42 23-Nov-2012 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Changes to allow compilation with -Wwrite-strings. That compiler option
is not used for testcases, just for valgrind proper.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13137 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
19f91bbaedb4caef8a60ce94b0f507193cc0bc10 10-Nov-2012 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix more Char/HChar mixups. Closing in...


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13119 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
e543f3024ace2925a0fb81985e9fcfc95b8c555a 21-Oct-2012 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> First round of Char/HChar fixups for coregrind and memcheck.
Little bit of ripple in tools, too.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13074 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
6bf3726ebf7a04ca48a5e6cb1ad7a3065054e54e 21-Oct-2012 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix Char/HChar mixups in helgrind and then some.
Also fix all usages of the wordFM data structure. Once upon a time
wordFM used Words but now it uses UWords.
Likewise for WordBag.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13070 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
ca503be79ca377d89b1692c37c97a06ed14dad3b 07-Oct-2012 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> This is the 2nd installment of the cache info reorganisation.
The host's VexArchInfo is passed to the tool instrumentation
functions. Purely mechanic patch.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13031 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
03f8d3fc25f5a45c5826259d1b33b7f310117279 05-Aug-2012 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Update copyright dates to include 2012.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12843 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
d99c26a4bc18fd3b17c4626c9c1fbd1583388660 01-Aug-2012 philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> Implement --redzone-size and --core-redzone-size

* For tools replacing the malloc library (e.g. Memcheck, Helgrind, ...),
the option --redzone-size=<number> allows to control the padding
blocks (redzones) added before and after each client allocated block.
Smaller redzones decrease the memory needed by Valgrind. Bigger
redzones increase the chance to detect blocks overrun or underrun.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12807 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
8bfc215710b5e77d7dfb96b6ef2d3606b4f3bc08 07-Jul-2012 philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> 295590 Helgrind: Assertion 'cvi->nWaiters > 0' failed when cond var being waited upon destroyed
* when cond var is destroyed, in the PRE, report an error if nwaiters > 0.
* when cond_wait succeeds, get the cond var but do not create one in helgrind
(it must exist if cond_wait was done).
Report an error if cond not found (assuming this is caused by a destroy
done while the thread was cond_wait-ing).
* added a test


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12721 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
291849fb0285e0998b4c9e33eb153eb3373c4a88 21-Apr-2012 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge branches/TCHAIN from r12476 (its creation point) into trunk.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12517 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
ec062e8d96a361af9905b5447027819dfbfee01a 23-Oct-2011 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Update all copyright dates, from 20xy-2010 to 20xy-2011.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12206 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
866c80c01dc585912dec28d62d3650cee60e07ba 22-Oct-2011 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Allow garbage collection of the LAOG data structure(s). This avoids
quadratic growth on some apparently simple test cases. Fixes #267925.
(Philippe Waroquiers, philippe.waroquiers@skynet.be)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12201 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
ffce8159a95134f0a2bc1cea3c3e6e265f096d9f 24-Jun-2011 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge the contents of the HGDEV2 branch into trunk:
* performance and scalability improvements
* show locks held by both threads in a race
* show all 4 locks involved in a lock order violation
* better delimited error messages



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11824 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
fd35d49d5799584a7fe41d2f535c1ba2dd5e17b4 17-Mar-2011 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> When handling client munmaps and mprotects with r=0 & w=0, actually
paint the relevant address range as NoAccess rather than ignoring the
event. This is important for avoiding VTS leaks in libhb_core.
More details in comments in the code.

Also rename the _noaccess_ painters that do nothing to make it clearer
that they do nothing :-)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11654 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
622fe49b55cb60d6132bb100236f591de1515146 11-Mar-2011 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Add free-is-write functionality (experimental, not enabled by default).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11627 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
6015d0e7a11f66cbeafad47c7c92b07f29e9dcb2 11-Mar-2011 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> NB: this is an temporary fix, until such time as bug 243935 is fully
resolved.

Add a client request, ANNOTATE_HAPPENS_BEFORE_FORGET_ALL, to notify
Helgrind that it can forget about any h-b edges previously associated
with the specified tag, and release associated resources.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11625 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
8c50d3c9fda51e7597194a1fd0f962610eb7c48f 11-Mar-2011 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Change the semantics of ANNOTATE_HAPPENS_BEFORE from 'overwrite' to
'add' behaviour, w.r.t. any h-b edges associated with the
synchronisation object prior to the call. This brings the behaviour
into line with DRD and TSan, and is required for correct annotation of
thread safe reference counting. It fixes #243935 -- at least, the
original bug as discussed in comments 0 and 2.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11624 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
0f64c9ef03ba9345ee6fa5914c776e03302ba0d0 10-Mar-2011 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Cleanup: get rid of univ_tsets as it is no longer needed.

Also, fix bug in del_LockN (segfault when the deleted lock is
the last in the list) exposed by r11620. (Prior to r11620,
the last lock in the list was never deleted.)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11622 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
e96dfd02757e18f1bbbf32b0efd4777814f1c5ef 10-Mar-2011 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Cleanup: get rid of 'last lock lossage' mechanism, which is commented
out and no longer relevant.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11621 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
38fee957218598ff03e4903943bba0af997610e3 10-Mar-2011 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Cleanup: get rid of all mention of a Hardware Bus Lock. This
no longer exists.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11620 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
60626649e5fa6cd21af377fde5e83803fc136f61 10-Mar-2011 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Minor cleanup (no functional change): rename 'struct _Thr :: opaque'
to 'hgthread', since that's what it is really.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11619 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
9c08c0fbe977e0f0c3ceefcf705bac2fce076d56 10-Mar-2011 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Bring avg translation size statement closer to reality, for
amd64-linux with --smc-check=all. 350 would be better, but H already
soaks up so much space that a low-side of 320 seems prudent.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11618 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
1132fc277713f6c8ee3c5af69538ae1674aa9858 28-Feb-2011 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> rm pointless comment and #define.
(Philippe Waroquiers, philippe.waroquiers@skynet.be)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11576 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
1d7c3322207f80d9a962a402a171a14e4d628a77 28-Feb-2011 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix sanity check crash in Helgrind. Partial fix for #255353.
(Philippe Waroquiers, philippe.waroquiers@skynet.be)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11575 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
c1fb9d265a0d64216d387684a425125af4aca557 28-Feb-2011 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Don't construct the LAOG at all when --track-lockorders=no (as opposed
to previous behaviour, in which it was constructed but any resulting
errors were not shown, hence wasting CPU and memory.) Partial fix
for #255353. (Philippe Waroquiers, philippe.waroquiers@skynet.be)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11574 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
234e558d6bcb9d97891fdd41df6a37ad12f26705 09-Feb-2011 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> _pre_mem_asciiz handlers in both tools: don't segfault if passed an
obviously invalid address. Fixes #255009. Investigation & initial
patch by Philippe Waroquiers (philippe.waroquiers@skynet.be)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11533 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
61bc2c5f1c1b81df3ab5ecf79b857f0031e6a0f3 09-Feb-2011 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Don't assert in the child after a threaded program does fork().
Fixes #255355 (helgrind part).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11525 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
8fef62537fc0bcc0903d5be3080152f0e0b3979d 29-Jul-2010 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> When reporting an error about an attempt to re-lock an already-locked
lock, also report the stack where the lock was previously locked.
This makes it easier to diagnose deadlocks.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11234 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
c8028add6294793dfc80a80d920c7dba3a89f312 05-May-2010 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Rollup changes for Helgrind:

* Add new client request VALGRIND_HG_CLEAN_MEMORY_HEAPBLOCK. This is
like VALGRIND_HG_CLEAN_MEMORY but doesn't take an address range.
Instead it takes a single argument which is supposed to be a pointer
to the start of, or anywhere within, a heap allocated block.
Helgrind then finds the block and paints it as belonging to the
calling thread. This is needed for correctly describing the
behaviour of threadsafe reference counting when applied to classes
involving inheritance of release methods or involving multiple
inheritance.

* Add statistics counters for all basic VTS operations (tick, join,
cmpLEQ, cmp_structural).

* Rewrite VTS__cmp_structural to be much faster.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11123 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
9eecbbb9a9cbbd30b903c09a9e04d8efc20bda33 03-May-2010 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Update copyright dates to 2010.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11121 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
1f77fec86a76091770688839c1ad3ff547d69343 12-Apr-2010 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Take account the ABI-mandated stack redzone when changing stack
shvals. AFAIR this has never been handled correctly by Helgrind.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11101 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
095d61eef541731e77e2c648983aee9ea2bf5e59 11-Mar-2010 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> If a race error is detected, check to see whether the raced-on address
is inside a heap block, and if so, print the allocation point of the
heap block. It's stupid not to do this considering that the
implementation already keeps track of all mallocs and frees.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11089 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
406bac81a19666c213cd8b03457a105ea33a38ea 04-Mar-2010 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Rollup fixes for Helgrind:

* tracking of barriers: add support for resizable barriers

* resync TSan-compatible client requests with latest changes

* add direct access to the client requests used in hg_intercepts.c

* add a client request pair to disable and re-enable tracking
of arbitrary address ranges



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11062 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
651cfa4be2040647b829eb646fd743a0f12793e0 11-Jan-2010 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Apparently the dynamic linker on ARM-Linux has soname "ld-linux.so.3"
rather than "ld-linux.so.2". No, don't ask me why. Anyway, on
Helgrind, don't instrument code in ld-linux.so.3. This makes Helgrind
pretty much usable on ARM-Linux.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11025 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
db5907d7b94ce492f29a96c95e186fdcda23a149 26-Nov-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Track vex r1930 (Change the IR representation of load linked and store
conditional.) Completes the fix of #215771.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10957 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
f585e485d4e9881fbfaac828b4c9a9a2128556be 17-Aug-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Increase the maximum size of the conflict cache even more, to 30
million.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10831 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
588adeffafa8102adcfa7a1c035ae272b35cf86d 16-Aug-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> When generating XML output for suppressions, print the suppression
both wrapped up in XML tags (as before) but also in plain text in a
sequence of CDATA blocks. Normally only one, but in the worst case
the raw data will have ]]> in it, in which case it needs to be split
across two CDATA blocks.

This apparently simple change involved a lot of refactoring of the
suppression printing machinery:

* in the core-tool iface, change "print_extra_suppression_info" (which
prints any auxiliary info) to "get_extra_suppression_info", which
parks the text in a caller-supplied buffer. Adjust tools to match.

* VG_(apply_StackTrace): accept a void* argument, which is passed to
each invokation of the functional parameter (a poor man's closure
implementation).

* move PRINTF_CHECK into put_tool_basics.h, where it should have been
all along

* move private printf-into-an-XArray-of-character functions from
m_debuginfo into m_xarray, and make them public

* gen_suppression itself: use all the above changes. Basically we
always generate the plaintext version into an XArray. In text mode
that's just printed. In XML mode, we print the XMLery as before,
but the plaintext version is dumped into a CDATA block too.

* update the Protocol 4 specification to match all this.

This still isn't 100% right in the sense that the CDATA block data
needs to be split across multiple blocks if it should ever contain the
CDATA end mark "]]>". The Protocol 4 spec has this right even though
the implementation currently doesn't.

Fixes #191189.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10822 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
78bb7f63a8be74e12f41d997557f371061a2bb4e 14-Aug-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Double the maximum size of the conflict cache.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10817 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
ed2e72e6e326b86a6e01723836797f907a087e6c 14-Aug-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Skeletal support for TSan-compatible annotations.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10810 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
5a644da7bb7b675dee8401dc671811eb0a8be2ab 11-Aug-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Add pthread spinlock support.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10775 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
2d9e874b7a628ada216f09cc4f065798c65fffa4 07-Aug-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Tidy up of messaging:

* For all tools and the core, don't show statistics when -v is in
effect. Instead, try to restrict -v to mostly user-useful
stuff.

* A new flag --stats=no|yes [no] produces statistics output instead.

* Fix longstanding problem in that Memcheck's leak checker ran after
the core's error manager module shut down, thereby not showing use
counts of leak suppressions. This fixes #186790.

* As a consequence, the leak checker text output of Memcheck has
changed a bit -- leak check is done before the final error
summary is done (much more logical), and the output has been
tidied up a bit.

* Helgrind, Drd and Ptrcheck now also print "For counts of
detected and suppressed errors, rerun with: -v", which makes
them consistent with Memcheck in this regard. These are
filtered out by the regtest filter scripts.

For all tools except Memcheck, the regtests are unchanged. On
Memcheck regtests still fail due to rearrangements of the leak
checker output. This will be fixed by a followup commit.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10746 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
f6e8ca96b5ae8e6d736fb667f66862136fcfbbc6 07-Aug-2009 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Overhaul Helgrind's manual chapter.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10731 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
97db761d2a94fc7a349aee9359ef85828d9618b6 04-Aug-2009 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Various option-related tweaks:

- Match the ordering of the non-tool-specific options in the usage message
with the order in the user manual. As a result, we now always print
--alignment and --trace-malloc in the core's usage messages, which saves
malloc-replacing tools from doing it themselves (and brings it in line
with options that only apply to error-collecting tools).

- Improved the presentation of the Vex options with --help-debug.

- Removed documentation of -d in the manual because it's a debugging-only flag.

- Documented --read-var-info in the manual. This fixes bug 201169.

- Renamed --auto-run-dsymutil as --dsymutil and documented it in the usage
message.

- Fixed an XML error in manual-core-adv.xml.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10703 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
f386139a0c24629ecf3dbaa8825a02f499d177e1 02-Aug-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Change name of H1 history flag from --history-level=partial (which I can
never remember) to --history-level=approx.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10688 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
e3f1e5988a94af9230f67273ca9236c4d7e8b8da 31-Jul-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> (almost completely just function renaming):

* VG_(find_seginfo): incrementally rearrange the DebugInfo list, like
most of the other list-searching functions do.

* rename all VG_(*seginfo*) functions exported from m_debuginfo to
VG_(*DebugInfo*). "seginfo" was a historical name which was mostly
but not completely, done away with some time back.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10678 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
a0eee32e010208cf89f07a99cf1126d808f1408a 31-Jul-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Don't instrument any code in ld.so. Doing so merely generates a large
number of races which have to be expensively suppressed, so it's
better not to do so.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10676 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
02114547428cd1b36e8d9211d5bd51f47c75188e 28-Jul-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Improve checking for pthread_mutex_cond operations: implement a check
for consistent binding between the CV and the mutex, as specified by
POSIX. Add commented out code for some other checks that could be
done but aren't, as they'd give false positives.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10651 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
23f1200ba3aa3d8dbb484626ba1bdb7cfcf3b3a9 24-Jul-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Various improvements:

* rename many functions to do with shadow memory handling, to
more clearly differentiate reads and writes directly of the
shadow state from client reads and writes, each of which
generate both a read and a write of the client state. It was
getting confusing (== hard to verify) in there.

* use idempotency of memory state machine transition rules to
speed up long sequential sections, speedups in range 0% to 28%

* remove 4-way Pord (EQ, LT, GT, UN) and associated machinery,
and replace it with something that merely computes LEQ in the
partial ordering, since that's all that is necessary, and
this simplifies some fast-case paths.

* add optional approx history mechanism a la DRD (start/end stack
of conflicting segment), much faster if you don't need exact
conflicting-access details

* libhb_so_recv: tick the VTS in the receiving thread; don't just
join with the VC in the SO. It's probably correct without this
modification, but that correctness is fragile and depends on
complex properties of how SOs are used/created. Much better to
be completely safe. (Needs cache-isation).

* get rid of unnecessary shadow memory state "SVal_NOACCESS"
and simplify associated fast-case paths in msmc{read,write}



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10589 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
24118491f347852bc311069a273fce13608dd531 15-Jul-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge helgrind/ changes from branches/MESSAGING_TIDYUP r10464.
See trunk r10465 commit message for details.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10468 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
1c0ce7a9edf8772773f6216dbad4bb04317d23b6 01-Jul-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge in branches/DCAS.

This branch adds proper support for atomic instructions, proper in the
sense that the atomicity is preserved through the compilation
pipeline, and thus in the instrumented code.

These changes track the IR changes added by vex r1901. They primarily
update the instrumentation functions in all tools to handle the
changes, with the exception of exp-ptrcheck, which needs some further
work in order to be able to run threaded code.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10392 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
f76d27a697a7b0bf3b84490baf60623fc96a23af 28-May-2009 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge the DARWIN branch onto the trunk.

I tried using 'svn merge' to do the merge but it did a terrible job and
there were bazillions of conflicts. So instead I just took the diff between
the branch and trunk at r10155, applied the diff to the trunk, 'svn add'ed
the added files (no files needed to be 'svn remove'd) and committed.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10156 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
b83caf20ae583f130d1cbb742042f6a7a16fc5ff 25-May-2009 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> DARWIN sync: whitespace.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10148 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
983f302756a8025c84f08785b52384a92d682198 21-May-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix bogus assertion pertaining to validity checking of reader-writer
locks, as reported in #188248.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10073 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
4c245e595b9f6300d3120408ca873f7115d9cc7d 16-Mar-2009 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix all the non-VEX problems identified with the Clang Static Analyzer.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9416 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
9f207460d70d38c46c9e81996a3dcdf90961c6db 10-Mar-2009 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Updated copyright years.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9344 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
83df0b67a14425c484d8dda42b53f3ff0b598894 25-Feb-2009 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> atoll() is a terrible function -- you can't do any error checking with it.
Some of our option processing code uses it. This means that eg.
'--log-fd=9xxx' logs to fd 9, and '--log-fd=blahblahblah' logs to 0 (because
atoll() returns 0 if the string doesn't contain a number!)

It turns out that most of our option processing uses VG_(strtoll*) instead
of VG_(atoll). The reason that not all of it does is that the
option-processing macros are underpowered -- they currently work well if you
just want to assign the value to a variable, eg:

VG_BOOL_CLO(arg, "--heap", clo_heap)
else VG_BOOL_CLO(arg, "--stacks", clo_stacks)

else VG_NUM_CLO(arg, "--heap-admin", clo_heap_admin)
else VG_NUM_CLO(arg, "--depth", clo_depth)

(This works because they are actually an if-statement, but it looks odd.)

VG_NUM_CLO uses VG_(stroll10). But if you want to do any checking or
processing, you can't use those macros, leading to code like this:

else if (VG_CLO_STREQN(9, arg, "--log-fd=")) {
log_to = VgLogTo_Fd;
VG_(clo_log_name) = NULL;
tmp_log_fd = (Int)VG_(atoll)(&arg[9]);
}

So this commit:
- Improves the *_CLO_* macros so that they can be used in all circumstances.
They're now just expressions (albeit ones with side-effects, setting the
named variable appropriately). Thus they can be used as if-conditions,
and any post-checking or processing can occur in the then-statement. And
malformed numeric arguments (eg. --log-fd=foo) aren't accepted. This also
means you don't have to specify the lengths of any option strings anywhere
(eg. the 9 in the --log-fd example above). The use of a wrong number
caused at least one bug, in Massif.
- Updates all places where the macros were used.
- Updates Helgrind to use the *_CLO_* macros (it didn't use them).
- Updates Callgrind to use the *_CLO_* macros (it didn't use them), except
for the more esoteric option names (those with numbers in the option
name). This allowed getUInt() and getUWord() to be removed.
- Improves the cache option parsing in Cachegrind and Callgrind -- now uses
VG_(strtoll10)(), detects overflow, and is shorter.
- Uses INT instead of NUM in the macro names, to distinguish better vs. the
DBL macro.
- Removes VG_(atoll*) and the few remaining uses -- they're wretched
functions and VG_(strtoll*) should be used instead.
- Adds the VG_STREQN macro.
- Changes VG_BINT_CLO and VG_BHEX_CLO to abort if the given value is outside
the range -- the current silent truncation is likely to cause confusion as
much as anything.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9255 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
8b140dee891a850c09d27f316df913acc7d7bae7 17-Feb-2009 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> In the core, include malloc_usable_size() as one of the functions that must
be replaced if malloc() et al are replaced by a tool. This is because
different tools implement the function in different ways.

Add an appropriate malloc_usable_size() replacement to each of Memcheck,
Helgrind, DRD, Ptrcheck, Massif.

Update memcheck/tests/malloc_usable and add massif/tests/malloc_usable.

Merged from the DARWIN branch.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9193 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
a65db102a1d22b6ce7f93882c928c4b534b6e02e 26-Jan-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Initialise laog and laog__exposition even when the first lock-related
action is a lock deletion. Fixes a segfault reported by Ali
Jannesari.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9063 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
484fe804e0657410439b5c36a5d099faf54edc53 22-Dec-2008 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> During instrumentation, handle Imbe_SnoopedStore{Begin,End} a bit more
convincingly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8864 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
849b0ed71673805c5bdc3e44b1743a3d2c1b513d 21-Dec-2008 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Various changes:

* remove flags --trace-addr= and --trace-level=. These no longer
have any effect, so there's no point in having the associated flags.

* add flag --show-conflicts=no|yes [yes], which makes it possible to
disable the conflicting-access collection machinery. This makes
Helgrind run much faster. Perhaps useful in regression testing,
when it is desired only to find out if a race exists, but not to
collect enough information to easily diagnose it.

* add flag --conflict-cache-size= [1000000], which makes it possible
to control how much memory is used for storage of information about
historical (potentially-conflicting) accesses.

* Update comments on the conflicting-access machinery to more closely
reflect the code. Includes comments on the important aspects of
the value N_OLDREF_ACCS. Increase said constant from 3 to 5.

* Fix bug in event_map_bind: when searching for an OldRef.accs[]
entry that matches the current access, don't forget to also
compare the access sizes. The old code only compared the thread
identity and the read/writeness.

* hg_main.c: disable Dwarf3 variable/type info reading by default.
Mostly this provides little benefit and can cause Helgrind to use
a lot more time and memory at startup.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8845 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
921245493359c3ed60e0ec407cb71fc1154bd8e6 18-Dec-2008 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> HG_(instrument): don't assert on Imbe_SnoopedStore{Begin,End}.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8838 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
1c466b7770d6ef6f5c3306e349add84ebc45d668 19-Nov-2008 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Add informal correctness argument for the logic in
evh__HG_PTHREAD_BARRIER_WAIT_PRE, as it is somewhat subtle.

Also, free the SO after use, else there's a space leak.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8786 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
553655c47275225e1ee35f9d602263791ba590c2 14-Nov-2008 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Add a couple more tests for API errors in
evh__HG_PTHREAD_BARRIER_DESTROY_PRE.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8767 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
9f569b7efd8bb2929ee2b0ce13d5dee24da5e144 13-Nov-2008 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Add initial support for POSIX barriers (pthread_barrier_{init,wait,destroy}).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8766 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
1cbc12f5742e183afc7604042c218885b12e0539 10-Nov-2008 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Make sure laog__handle_one_lock_deletion actually gets called as a
result of the client doing pthread_mutex_destroy() or
pthread_rwlock_destroy().



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8759 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
d52392dd8f0536931cb0bbf2a27f1621704f32eb 08-Nov-2008 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> A bit of tidying up:

* get rid of 'struct _EC' (a.k.a 'struct EC_') and use ExeContext
everywhere

* remove stacktrace_to_EC and call
VG_(make_ExeContext_from_StackTrace) directly

* comment out some unused code



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8749 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
f98e1c03ce4bea1fb092cdea5571c41f29f6df9b 25-Oct-2008 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge Helgrind from branches/YARD into the trunk. Also includes some
minor changes to make stack unwinding on amd64-linux approximately
twice as fast as it was before.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8707 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
9c606bd8634cd6b67bb41fa645b5c639668cfa2d 18-Sep-2008 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge all remaining changes from branches/PTRCHECK. These are some
relatively minor extensions to m_debuginfo, a major overhaul of
m_debuginfo/readdwarf3.c to get its space usage under control, and
changes throughout the system to enable heap-use profiling.

The majority of the merged changes were committed into
branches/PTRCHECK as the following revs: 8591 8595 8598 8599 8601 and
8161.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8621 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
896f6f996a8bb1f5ac1e7e0272b039bf4c16c40a 19-Aug-2008 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Move the WordFM (AVL trees of UWord-pairs) implementation from
helgrind/ into the core. It's just too darn useful to not be in the
core. There is some overlap in functionality between OSet and WordFM,
but OSet is more space efficient in some circumstances, whereas WordFM
is easier to use and a bit more flexible in some cases.

Also in this new module (m_wordfm) is a type WordBag, build on top of
WordFM. This provides Multiset of UWords functionality.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8524 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
a0b6b2cf9abc7b0d87be1215a245eaccc0452af9 07-Jul-2008 bart <bart@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merged FORMATCHECK branch (r8368) to trunk.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8369 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
9df35c2b08e34444825452cad0ed5c45ac557b91 30-Jun-2008 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Track vex r1857 (addition of Imbe_SnoopedStoreBegin and
Imbe_SnoopedStoreEnd).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8316 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
7cf4e6b6aed533af53339f36099ed244dc4a5b7f 01-May-2008 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge branches/OTRACK_BY_INSTRUMENTATION into the trunk. This adds
support to Memcheck for tracking the origin of uninitialised values,
if you use the --track-origins=yes flag.

This currently causes some Memcheck regression tests to fail, because
they now print an extra line of advisory text in their output. This
will be fixed.

The core-tool interface is slightly changed. The version number for
the interface needs to be incremented.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7982 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
5dd8e6ab3b998e323eb293e561b62505a44f3144 22-Mar-2008 bart <bart@a5019735-40e9-0310-863c-91ae7b9d1cf9> Moved macro's that specify branch prediction hints to include/pub_tool_basics.h

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7745 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
b8b79addf04dd5d0b558916e26df0b1927cbd758 03-Mar-2008 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge in the DATASYMS branch.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7540 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
789c3c5e22a80f7e5df4e21864e6ca38732bffd8 25-Feb-2008 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Intercept pthread_rwlock_try{rd,wr}lock. Fixes #158212.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7454 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
250ec2eb29b4afec646bdc8ecbfcdbb7d73d0b23 15-Feb-2008 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Try to sort out signedness problems in hg_wordfm.[ch], and do a bunch
of other tidying too.

* All these word-based abstractions (WordFM, WordSet, WordBag) now
operate on unsigned words (UWord), whereas they previously operated
on signed words (Word). This became a problem, when using unboxed
comparisons, with the introduction of HG_(initIterAtFM), which
allows iteration over parts of mappings. Iterating over a mapping in
increasing order of signed Word keys is not what callers expect when
iterating through maps whose keys representing addresses (Addr) since
Addr is unsigned, and causes logical problems and assertion
failures.

* Change various size-of-things types from signed to unsigned, and
make them consistently word sized. For example the return type
of HG_(sizeFM) used to be an Int, which never made any sense
(the size can't be negative, and, on a 64-bit platform, the
map could have more than 2G elements, in which case an Int can't
represent the result). So make the return value a UWord instead.
This should generally help avoid obscure overflow problems on 64-bit
platforms.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7409 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
4d474d086188fd1f29fa97dbd84d8ea2e589a9b8 11-Feb-2008 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Update copyright dates ("200X-2007" --> "200X-2008").


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7398 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
ae5137e9532a4625e54fcbf103e146815717852b 18-Jan-2008 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Allow a WordFM iterator to be initialised so as to exclude all key
values below a given value. This allows efficiently iterating over
small subsets of a mapping. Use this in Helgrind to avoid a
performance bad case. Patch from Konstantin Serebryany.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7353 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
ae4485a3e4b6789db4bedc998bbe9105d286f536 12-Dec-2007 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix stupid error spotted by by Konstantin Serebryany.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7299 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
efd3b4d91417ba085710206dcfdbbf5bf8ccfc8d 02-Dec-2007 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Wibble.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7263 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
11e352f44852ea8fd5e3f65bf424528040ab7e0f 30-Nov-2007 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Correctly handle semaphores with nonzero initial values. Fixes bug
observed by Matthieu Castet. Also, add another sanity-check flag.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7253 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
1c7e83351c10d92624809e50f106bda74438cdfd 29-Nov-2007 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> So much for C's "type system" (ha ha). Correct version of r7250.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7251 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
3c2f748da02318b1a833717dc64c7d29e204af76 29-Nov-2007 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Don't assert when destroying a locked rwlock.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7250 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
b5f29645f9f9356cdfe048dca57f268263a15e23 16-Nov-2007 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Back out bogus strict-aliasing hacks and use -fno-strict-aliasing by
default.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7163 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
e75c97ecdd714260b12e725a644408cdab2259f9 16-Nov-2007 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Rename a couple more UInts which really should be SVals.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7160 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
fb86168f63a5cdf04d3d671bd1262993bac42ace 14-Nov-2007 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Give shadow values their own type (SVal) for the usual
good-software-engineering-practice reasons.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7158 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
79ef5e5196e6025f8dd756ab945eac43ed610679 11-Nov-2007 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Add some seemingly unnecessary initialisations to shut GCC 4.0.2 up.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7148 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
c17be797ee1df34bc98b7f1e0690d87732209906 10-Nov-2007 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Followup to r7105: stop gcc complaining about violations of ANSI C
aliasing rules by casting through (char*) as an intermediate type,
rather than through (void*). This seems at least moderately
justifiable since the ANSI C standard explicitly says that any object
may be accessed through a char pointer.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7141 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
b411202f9ff33a587558e2e836626bc7eb9db183 09-Nov-2007 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Import thrcheck from the THRCHECK branch, and rename it Helgrind (with
permission of the existing Helgrind authors).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7116 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
609939f80f42cbb531d5499880fc4400fac1fcdc 09-Nov-2007 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Rename this directory.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7113 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
8a7b41b41b46c0aa7bd4b6678b82285437e7f08c 23-Sep-2007 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix various format string errors, courtesy of Florian Krohm.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6902 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
3f94a7d39676262e70c768e5a20a225f1ca36b29 25-Aug-2007 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Changes to m_hashtable:

Allow hashtables to dynamically resize (patch from Christoph
Bartoschek). Results in the following interface changes:

* HT_construct: no need to supply an initial table size.
Instead, supply a text string used to "name" the table, so
that debugging messages ("resizing the table") can say which
one they are resizing.

* Remove VG_(HT_get_node). This exposes the chain structure to
callers (via the next_ptr parameter), which is a problem since
callers could get some info about the chain structure which then
changes when the table is resized. Fortunately is not used.

* Remove VG_(HT_first_match) and VG_(HT_apply_to_all_nodes) as
they are unused.

* Make the iteration mechanism more paranoid, so any adding or
deleting of nodes part way through an iteration causes VG_(HT_next)
to assert.

* Fix the comment on VG_(HT_to_array) so it no longer speaks
specifically about MC's leak detector.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6778 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
9ebd6e0c607fa30301b1325874eb8de871c21cc5 08-Jan-2007 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Update copyright dates.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6488 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
b5c757545ff2a66d9a3c155670a58e6ffa258407 28-Dec-2006 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Get rid of the core-tool events pre_mutex_lock, post_mutex_lock and
post_mutex_unlock. The core can't detect them anyway any more, so
there's no point in having them.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6456 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
0b9d74abd0a663b530d290b2b788ddeda46e5400 24-Dec-2006 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Non-functional commit: track IR renaming in vex r1689.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6416 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
f8126e9f46b58348ccd6d6055860289bfabf66b6 14-Nov-2006 dirk <dirk@a5019735-40e9-0310-863c-91ae7b9d1cf9> change void* to Addr in mutex helpers. patch by Bard Van Assche.
I've bumped the tool interface version because it seems binary
incompatible.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6350 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
40823565bcbc33e9b6eff5e99d9ab8409471ec53 17-Oct-2006 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge r6214 (some parts):

Futz with the estimated-translation sizes to make them more plausible [..]



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6296 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
4cfea4f9480393ed6799db463b2e0fb8865a1a2f 14-Oct-2006 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Create a new module, m_vki, and move all knowledge about the kernel
interface, except for the syscall numbers, into that. Mostly this
means moving include/vki-*.h to include/vki/vki-*.h.

include/pub_tool_basics.h previously dragged in the entire kernel
interface. I've done away with that, so that modules which need to
see the kernel interface now have to include pub_{core,tool}_vki.h
explicitly. This is why there are many modified .c files -- they have
all acquired an extra #include line.

This certainly breaks all platforms except x86. Will fix shortly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6225 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
e4b0bf07b0ee0a18eacc5aba91686ab5fc1d327b 06-Jun-2006 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Update copyright dates.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5954 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
b148920cf82b8c8bbe7203e3786e518d1714fea6 23-Apr-2006 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Update 64-bit cleanness info.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5863 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
5e0e9227a2cacfde585c649679ca25ba05102e0e 13-Apr-2006 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Clarify the Helgrind-doesn't-work message.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5846 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
eadcd86d1b0f59efed44c162ef4378ccfb528290 04-Apr-2006 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Cleanup/restructure m_debuginfo, as described in
coregrind/m_debuginfo/README.txt.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5823 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
461df9c36f6a07e4f0c14ae068e8e8e9bd383b26 17-Jan-2006 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> These files all speak about instrumentation functions.
Instrumentation functions now take a callback closure structure
(VgCallbackClosure*), so this commit changes the signatures
accordingly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5535 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
bcd75fcb80c13b9828a4c33b0d7acf1499e14135 19-Dec-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Remove all remaining profiling gunk.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5388 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
151a639d523a1d9b4cbd6629992e48ed8ee9408e 11-Nov-2005 tom <tom@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix compiler warnings.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5083 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
4ba057cce1d81a949f5a899b5abb99e90a731bcc 18-Oct-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Change the core-tool interface so that tools are fully aware of both
the guest extents for the presented translation and also its original
un-redirected guest address. These changes are needed in particular
to make cachegrind's code cache management work properly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4943 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
0cd42f0881519a581909b670a4aebe27e53155de 06-Oct-2005 tom <tom@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix realloc wrappers to handle the out of memory case properly - if
the call to VG_(cli_malloc) returns NULL then don't try and copy the
data or register a new block and just leave the old block in place
instead, but still return NULL to the caller.

Fixes bug 109487 and it's duplicates.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4875 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
69293332fc92c0f500d291a24f7550243a3849e3 27-Sep-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Remove now-unused "shadow_memory" need.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4797 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
45f4e7c91119c7d01a59f5e827c67841632c9314 27-Sep-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> This commit merges in changes from branches/ASPACEM (specifically,
changes from r4341 through r4787 inclusive). That branch is now dead.
Please do not commit anything else to it.

For the most part the merge was not troublesome. The main areas of
uncertainty are:

- build system: I had to import by hand Makefile.core-AM_CPPFLAGS.am
and include it in a couple of places. Building etc seems to still
work, but I haven't tried building the documentation.

- syscall wrappers: Following analysis by Greg & Nick, a whole lot of
stuff was moved from -generic to -linux after the branch was created.
I think that is satisfactorily glued back together now.

- Regtests: although this appears to work, no .out files appear, which
is strange, and makes it hard to diagnose regtest failures. In
particular memcheck/tests/x86/scalar.stderr.exp remains in a
conflicted state.

- amd64 is broken (slightly), and ppc32 will be unbuildable. I'll
attend to the former shortly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4789 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
8cdd185300a8b281043e680c37f6cfc658456032 30-Aug-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Add a note about a nice paper describing data races.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4591 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
5db32125be7c958cdc42764b3ea16a221ce64a8c 12-Aug-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Give informative failure messages if you try to use Helgrind or
Addrcheck. As a results, we are now building Addrcheck again, which
required commenting out lots of code.

BACKPORT TO 3_0_X, AND POSSIBLY TO 2_4_X (the Helgrind part, with
modifications)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4384 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
f69f945020cbcc35fe0c98c3b223d96c7322a95a 03-Jul-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Changed m_hashtable.c to allow the size of the hash table to be specified
when it is created. Fortunately this didn't affect code outside this
module except for the calls to VG_(HT_construct)().

As a result, we save some memory because not all tables have to be as big
as the ones needed for malloc/free tracking.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4100 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
d9e5fd7015a7709e55146bdfe38fd08e6e6924c2 25-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Rename functions to make the type involved clearer.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4021 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
af839f52d74df156d655201a889954133ab01be7 23-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Removed the VGA_/VGO_/VGP_ prefixes for arch/OS/platform-specific
things. These made sense when the arch/OS/platform-specific code was in
one module, but as that code got mixed in with generic code the boundary
between generic and non-generic blurred, and the distinction made less
sense. So let's get rid of them.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4002 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
fc51f8d9538eda285c2ea0974f29b075168f3433 21-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Malloc replacement worked very much like a 'need', but wasn't one.
I've changed it so it now is, which makes it consistent with the
other 'needs'. Because of this, I was also able to invert the dependence
between m_mallocfree and m_tooliface, which is related to setting
the redzone size for client heap blocks. As a result, m_tooliface
now doesn't depend on anything except pub_core_basics.h, hooray!



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3979 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
c7561b931e249acf3768ead77638545b0ccaa8f1 19-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Final commit for the initial modularisation pass:

- Broke part of m_scheduler off into a new module m_threadstate. It
contains ThreadState, VG_(threads)[] and some basic operations on the
thread table. All simple stuff, the complex stuff stays in m_scheduler.
This avoids lots of circular dependencies between m_scheduler and other
modules.

- Managed to finally remove core.h and tool.h, double hurrah!

- Introduced pub_tool_basics.h and pub_core_basics.h, one of which is
include by every single C file.

- Lots of little cleanups and changes related to the above.

- I even did a small amount of documentation updating.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3944 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
7cee6f99bd38612f2d1c0102d75ca55839601538 13-Jun-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Updates to the rest of the debuginfo module to track directory names.
The only interesting part is a change of signature of
VG_(get_filename_linenum) so that callers can optionally request
directory info too.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3909 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
f536bbbd4bf2024926574c5ed99b3e6251c6ff44 13-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Created m_machine, for various machine-related things.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3903 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
f39e9a36dca9642668a66c6b054f81c88650bcb9 12-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Finished the modularisation of vg_mylibc.c, which meant it could be removed.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3894 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
29ef1c8abe49b5a234781ca51eb571c67231fc34 11-Jun-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Stop gcc complaining about Helgrind on 64-bit platforms. Note, this
is not a proper fix :-)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3889 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
4802b38ecf205ab7a5470f2ddafffeb57358befc 11-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Move some decls out of tool.h into the new file pub_tool_aspacemgr.h.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3885 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
adb7a752db0e1d764dcd00bba4595fee08ca7f8c 11-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Avoid compiler warnings.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3880 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
132bfccd21960e462352175f8553a5bdce8a210c 04-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Modularised assertions and panics in m_libcassert.

As part of this, killed the VG_STRINGIFY macro, which was used to expand
out names like "VG_(foo)" and "vgPlain_foo" in assertion failure
messages. This is good since we actually want the "VG_(foo)" form used
in these messages.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3842 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
36a20fa5f779a0a6fb7b4a90dcaa6376481f1faa 03-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Modularise printing functions in m_libcprint.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3840 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
13bfd85dfab2cd301c92e308b274ebd17de830d2 02-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Rename *ROUND* as VG_*ROUND* to be consistent with everything else. Also
make them tool-visible, so that Memcheck and Helgrind don't have to defined
their own versions!



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3839 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
97405b2d134b52880d6dbec3eb2929e2002c2542 02-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Started modularising vg_mylibc. Put all the standalone stuff -- ie. not
relying on any other modules -- in m_libcbase.

Also converted the 'size' parameters to functions like VG_(memcpy) and
VG_(strncpy) from Int to SizeT, as they should be.

Also removed VG_(atoll16) and VG_(toupper), which weren't being used.

Also made VG_(atoll36) less flexible -- it now only does base-36 numbers
instead of any base in the range 2..36, since base-36 is the only one we
need. As part of that, I fixed a horrible bug in it which caused it to
return incorrect answers for any number containing the digits 'A'..'I'!
(Eg. for "A; it would return 17 instead of 10!)

Had to disable the assertions in VG_(string_match), since this module can't
see vg_assert, which wasn't ideal but also isn't a disaster.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3838 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
31513b4ab8477029517f07f0dcf1b441cb818548 01-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Modularised the profiling stuff as m_profile.c. It's much more
sensible now -- no vg_dummy_profile.c, no silly #including of
vg_profile.c from tools.

Unfortunately, it still doesn't work, due to bad interactions
with signal handling that I don't understand.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3833 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
ea27e4627518665dd6c81213c0ba1f7ff0218e1a 31-May-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Modularised all the debug info stuff as m_debuginfo/. It's a mess
and needs further cleaning up, but it's a start.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3821 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
2024234c590f408994b373abfb00bc2cd2a90c48 17-May-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Added module m_options for holding all the command-line option stuff.
Perhaps parts of process_cmd_line_option() should go in here, but I've
not done that for now.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3751 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
02bc4b8f54227320aa2b9ac4805173e0e2e3eeae 15-May-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Don't mix backticks and apostrophes when quoting words -- eg. use 'foo'
rather than `foo', as www.cl.cam.ac.uk/~mgk25/ucs/quotes.html explains
we should (in more detail than you'd imagine was possible). I did this
both in output messages and in some comments, for consistency.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3723 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
81c00df9ac724e898179dd90e52b2e15deb11fd8 14-May-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Modularised vg_hashtable.c as m_hashtable.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3710 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
36ef6ba9a744c6e614fffb567d9939d0c10426ef 14-May-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Renamed the field Segment.symtab to Segment.seginfo to avoid confusion
with SegInfo.symtab.

Also renamed VG_(symtab_{inc,dec}ref)() as VG_(seginfo_{inc,dec}ref)()
for the same reason.

Also renamed various SegInfo variables from "seg" to "si" to avoid
confusion with the many Segment variables called "seg".



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3709 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
43b9a8abb139b86a24457fa3c19b9cb60ca17c3a 10-May-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Modularised the core/tool interface ('details', 'needs' and VG_(tdict))
into a new module m_tooliface. Pretty straightforward. Touches a lot
of files because many files use this interface and so need to include
the headers for the new module.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3652 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
717cde5bda18d17792d1994c61b6a27408b4b4a7 10-May-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Modularised the malloc/free stuff into two modules: m_mallocfree for the
malloc/free implementation, and m_replacemalloc with the stuff for the tools
that replace malloc with their own version. Previously these two areas of
functionality were mixed up somewhat.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3648 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
fbdcba958df65e20f9bf6aff2f43af3eee58d707 09-May-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Helgrind:
- make nested function non-nested to avoid GCC 4.0 warnings
- replace archaic "eraser" names with "hg". And EraserErr type is now
RaceErr (although we still use "Eraser" in suppression files for backwards
compatibility).




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3646 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
51d827bcd88ce045a383ea1ca81768757df2d1fa 09-May-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Big clean-up: changed the core/tool interface to be mediated entirely
through the VG_(tdict) function dictionary, rather than using TL_(foo)
functions.

This facilitated the following changes:

- Removed the "TL_" prefix, which is no longer needed.

- Removed the auto-generated files vg_toolint.[ch], which were no longer
needed, which simplifies the build a great deal. Their (greatly
streamlined) contents went into core.h and vg_needs.h (and will soon
go into a new module defining the core/tool interface).

This also meant that tool.h.base reverted to tool.h (so no more
accidentally editing tool.h and not having the changes go into the
repo, hooray!) And gen_toolint.pl was removed. And toolfuncs.def was
removed.

- Removed VG_(missing_tool_func)(), no longer used.

- Bumped the core/tool interface major version number to 8. And I
killed the minor version number, which was never used. The layout
of the ToolInfo struct is such that this should not cause problems.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3644 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
2bc10126a94b421a490b2759dc50ab67ec4ee116 08-May-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> A crucial, crucial change: update my email address.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3632 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
c756a8e4929c87ea9e801eac2507988caf3206ac 31-Mar-2005 tom <tom@a5019735-40e9-0310-863c-91ae7b9d1cf9> Update helgrind to use the new mechanism to declare it's interface
routines to the core so that it will at least build.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3489 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
95e65f6c8b33727cacb07e3654fb7e2cee56efe0 30-Mar-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Reinstate Helgrind, to an extent: compile it, so that it doesn't bit-rot.
But don't regtest it, because they all just fail.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3479 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
9fb73db1c3fe4296264cf35cc2f3cd671ab2e61a 27-Mar-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Add VGA_ prefix to the arch-specific macros {MIN,MAX}_INSTR_SIZE and
REGPARMS.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3458 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
db9b77373c3e1248fc7c7b2615749bb3e8796447 26-Mar-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Use "VGA_" prefix more consistently.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3434 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
d01fef7de693582a6ce32bdbef7c9040ad6b356b 26-Mar-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> A modularisation + refactoring commit. vg_execontext.c has been split into
two halves: stacktrace.c, which deals with getting, traversing and printing
stack traces; and execontext.c, which deals with storing stack traces
permanently in a way that avoids duplicates, and comparing them.

One nice outcome: previously we were often creating ExeContexts, which live
forever, even when they were only needed temporarily. Ie. this was a memory
leak, which has been removed.

As part of this, new headers have been created, carved off core.h and
tool.h. Lots of function names have changed, too.

In Massif, I also changed a lot of "eip" names to "ip" to make them less
x86-specific.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3429 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
675161340e0e4203dd9068d1dd3fac1240005d77 22-Mar-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> make function names more uniform



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3406 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
5361242f022b38fadb4cdf02428cea8b8d901a90 12-Mar-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Update copyright notice for 2005 on all relevant files. Don't bother trying
to be selective about it.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3303 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
b5f6f51ebcac183818061bf53427a3e7808ef10d 11-Mar-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge in changes from the 2.4.0 line. This basically brings in the
overhaul of the thread support. Many things are now probably broken,
but at least with --tool=none, simple and not-so-simple threaded and
non-thread programs work.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3265 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
0e742df4479749af653a03a348e779539215dc2b 30-Nov-2004 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> 64-bit cleanness: fix nasty bug... in the memory allocators, redzones
were being kept as UInts. They were sometimes negated and then used as
indices to arrays, and on 64-bit platforms they get converted
incorrectly (using zero-extension instead of sign extension, I think)
before the indexing happens, giving a totally bogus index.

The fix was to convert all these types to SizeT. It would be nice to be
able to avoid this automatically somehow in the future.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3158 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
c616819253fcf211745060b2be26076174b1df19 29-Nov-2004 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Added beginnings of an AMD64 port, so lots of new files and directories.
It compiles, but aborts immediately if you try to run it.

I didn't include ldt.c; I'm not sure how the LDT is used on AMD64. It can be
added later if necessary.

While doing this, did some 64-bit cleanness fixes:
- Added necessary intermediate casts to ULong to avoid warnings when converting
ThreadId to void* and vice versa, in vg_scheduler.c.
- Fixed VALGRIND_NON_SIMD_CALL[0123] to use 'long' as the return type.
- Fixed VALGRIND_PRINTF{,BACKTRACE} to use unsigned longs instead of unsigned
ints, as needed.
- Converted some offsets in vg_symtab2.h from "Int" to "OffT".
- Made strlen, strncat, etc, use SizeT instead of 'unsigned int' for the length
parameter.
- Couple of other minor things.

I had to insert some "#ifdef __amd64__" and "#ifndef __amd64__" guards in
places. In particular, in vg_mylibc.c, some of our syscall wrappers aren't
appropriate for AMD64 because the syscall numbering is a bit different in
places. This difference will have to be abstracted out somehow.

Also rewrote the sys_fcntl and sys_fcntl64 wrappers, as required for AMD64.

Also moved the ipc wrapper into x86, since it's not applicable for
AMD64. However, it is applicable (I think) for ARM, so it would be nice
to work out a way to share syscall wrappers between some, but not all,
archs. Hmm. Also now using the real IPC constants rather than magic
numbers in the wrapper.

Other non-AMD64-related fixes:
- ARM: fixed syscall table by accounting for the fact that syscall
numbers don't start at 0, but rather at 0x900000.
- Converted a few places to use ThreadId instead of 'int' or 'Int' for
thread IDs.
- Added both AMD64 and ARM (which I'd forgotten) entries to valgrind.spec.in.
- Tweaked comments in various places.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3136 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
14d01ce38ebacdcf07217c8a3b4d517d01439c23 26-Nov-2004 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Reinstated Helgrind and Cachegrind; at least, they are included in
compilation now. They both don't work, as I made the minimal changes
necessary to get them compiling (eg. both of the TL_(instrument)()
functions were commented out and replaced with a stub).

This means that 'make dist' should more or less work again, which is
necessary for my playing with the XML documentation.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3107 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
94065fd4f0237006763e1f8d897ec7eae55f8762 22-Nov-2004 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Last few skin-->tool changes, in various places.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3063 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
fc26ff9ed636a3dd79ee3d90e5e521bc7749f105 22-Nov-2004 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Rename macros ("SKIN"-->"TOOL")



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3062 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
26f025100805e561354c8c98b5ebb0c4a517d9a9 22-Nov-2004 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Converted the SK_ prefix to TL_ everywhere.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3060 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
6799325d013e8e5668c2b8727203c77294ccd202 22-Nov-2004 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Renamed VG_(skin_panic) as VG_(tool_panic).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3057 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
b126f73dcfd8fef90b3a882200dd8bbcaa823121 22-Nov-2004 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Renamed functions with 'Skin' in them: SK_(pp_SkinError),
SK_(eq_SkinError), MAC_(pp_shared_SkinError)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3056 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
ca82cc01fb1580551144b69d3f17213a80d952e1 22-Nov-2004 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Renamed sk_assert() as tl_assert().



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3055 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
95ec870848b73e0f90758f94f2c3e62e5c3cccef 22-Nov-2004 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Convert the 'skin_errors' need to 'tool_errors'.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3053 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
d1b64b282b70986b2904df27d7a91dad465178b6 04-Nov-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> 64-bit cleanness: convert client requests to receive and return UWords.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2921 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
50397c2e67fd31f0b007fa8eb8671f0c3c30f33e 04-Nov-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> 64-bit cleanness: lots more replacing of UInt with UWord as necessary.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2920 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
3d6b6118a041da686ab7c9473294921a38d8d962 04-Nov-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> 64-bit cleanness: make the hash-table have UWord keys instead of UInt keys.
Allows addresses as keys.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2916 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
928a5f790be9ced888356457d085260fbcedc62e 03-Nov-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> 64-bit cleanness: Yet more UInt-->SizeT changes.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2910 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
451eae91506b6bb5171bd862e8ef5fbbcd703bb8 02-Nov-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> 64-bit cleanness:
- Use SizeT instead of UInt for new_mem_stack and all the related functions.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2907 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
7ac7f7b2ccfc708851a758e9c8dd43ce7d325a10 02-Nov-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> 64-bit cleanness: Converted malloc() et al to use SizeT rather than Int.
This required some tricks with casting to maintain Memcheck's silly (ie.
negative) arg checking. The allocator was also changed accordingly. It
should now be able to allocate more than 4GB blocks on 64-bit platforms.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2906 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
ca788ff1a7ebff3538df5fecfb5d45b5c61f5b14 20-Oct-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Arch-abstraction:
- Make Helgrind totally arch-agnostic.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2815 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
6a27d8344f3fd534e4aa194e544a91ea4c2ff0c0 07-Sep-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Arch-abstraction:
- Moved VG_MAX_REALREGS into x86/ part.
- Tweaked basic types so they're suitable for both 32-bit and 64-bit platforms.
Main change was to change 'Addr' to "unsigned long" which is the same size as
a pointer. Had to make a couple of minor changes to accommodate this.
Also, introduced 'UWord' and 'Word' types which will be necessary for making
code 64-bit clean.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2669 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
46063201cea329c862bed94ffffae9c82a706be5 02-Sep-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Arch-abstraction: renamed "vg_skin.h" as "tool.h". Kept a residual vg_skin.h
(which just #includes tool.h) for backward-compatibility.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2647 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
eec46308860444fc70041a71169a5d7830271fcf 23-Aug-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Small step in factoring out arch-specific code: replace
__attribute((regparm(n))) with REGPARM(n) everywhere. REGPARM() is defined in
vg_skin.h, but will eventually be defined separately for each arch.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2601 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
1420ab20eb854ccde4ad9465590cb53610af759c 19-Aug-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Remove 3 identical and self-admittedly spurious assertions.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2592 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
08fa9a789bd4747bb753fcbf53318c0de9426fc8 16-Jul-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Slightly change, with J's approval, startup copyright messages to better
reflect reality.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2489 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
e1efb92f719d2f7139255b48c4b348a265e1ba21 10-Jul-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Don't force tool redzones to be multiples of 8.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2463 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
57e36b3e766c9e33c59f994319b66a51b37319f7 10-Jul-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix for bug #78048.

Problem was that the malloc-replacing tools (memcheck, addrcheck, massif,
helgrind) would assert if a too-big malloc was attempted. Now they return 0 to
the client. I also cleaned up the code handling heap-block-metadata in Massif
and Addrcheck/Memcheck a little.

This exposed a nasty bug in VG_(client_alloc)() which wasn't checking if
find_map_space() was succeeding before attempting an mmap(). Before I added
the check, very big mallocs (eg 2GB) for Addrcheck were overwriting the client
space at address 0 and causing crashes.

Added a regtest to all the affected skins for this.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2462 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
4ad52d05745dddc77f7a12b55b8c59839f37ada7 27-Jun-2004 thughes <thughes@a5019735-40e9-0310-863c-91ae7b9d1cf9> Removed all uses of nested functions as they only work with gcc and
cause the stack to be marked as executable in order for them to work.

All assembler files have also had a declaration added so that the
object they generate will be marked as not needing an executable stack.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2446 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
27fec9071fd5365fa4a517fb77b844b6f8712268 16-Jun-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Introduced 4 macros to minimise boilerplate command line processing code.
Nicely cuts around 130 lines of code, spread over the core and several tools.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2422 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
f798eeea5e04b96f5d0df2b74e6757e7180a6dd1 13-Apr-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Changed error message from:

Address 0x%x is not stack'd, malloc'd or free'd

to

Address 0x%x is not stack'd, malloc'd or (recently) free'd

This makes things clearer in some circumstances, particularly when bogusly
accessing heap memory that has been freed, but Memcheck is no longer tracking.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2358 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
96b466ac1bc4b09b45c08b79cdadd3d42461bc2b 15-Mar-2004 thughes <thughes@a5019735-40e9-0310-863c-91ae7b9d1cf9> Move the handling of PSHUFW from the SSE code to the MMX code so that
it will work on older Athlons which only have MMXEXT support.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2319 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
111c60740dc4bff3cbde227dab21f7997b0a658b 09-Mar-2004 fitzhardinge <fitzhardinge@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix bug 69856; teach Helgrind about all the new SSE-related UOps.
Haven't actually tested races with all those new memory access
instructions though...


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2302 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
31212bcbafd6c3b8ff7cd6db8c3d649a6e36c9e1 29-Feb-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Patch from Bartosz Taudul: latest GCC requires regparm(n) attributes on both
function declarations and definitions.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2280 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
9800fd3fc9f4b4fdf9281ec166e4f6d42d9212a7 05-Jan-2004 jseward <jseward@a5019735-40e9-0310-863c-91ae7b9d1cf9> In the fast sanity check for these tools which use shadow memory,
remove the test that the first page of memory is inaccessible. This
is now getting in the way.

Fixes #69886.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2180 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
bb1c99123c95fb9a4a2617d6e1d09559ac68db80 04-Jan-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Updated copyright dates for 2004. Also added a couple of missing headers and
footers to some new files.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2177 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
98abfc7bb7798c4ac4580f7e0bc7171de94a0255 16-Dec-2003 fitzhardinge <fitzhardinge@a5019735-40e9-0310-863c-91ae7b9d1cf9> This jumbo-checkin is the Full Virtualization checkin. This eliminates
Valgrind's dependency on the dynamic linker for getting started, and
instead takes things into its own hands.

This checkin doesn't add much in the way of new functionality, but it
is the basis for all future work on Valgrind. It allows us much more
flexibility in implementation, and well as increasing the reliability
of Valgrind by protecting it more from its clients.

This patch requires some changes to tools to update them to the changes
in the tool API, but they are straightforward. See the posting "Heads
up: Full Virtualization" on valgrind-developers for a more complete
description of this change and its effects on you.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2118 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
64366b400435652994f3c30ce4218152123c63ac 01-Dec-2003 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix broken assertion, thanks to Tom Hughes.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2077 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
421281e98e4ffc5e5fc034398707b8523676555d 20-Nov-2003 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Updated all "report bugs to..." messages to point to valgrind.kde.org; also
updated the docs to refer to valgrind.kde.org instead of the old website.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2055 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
137bc55f216bc7d9528f159a78cdf9025e0b02ff 14-Nov-2003 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Started to rescind the name "skin", replacing it with "tool". Did this in all
the places that normal users will see:

- command line: --tool=foo (although --skin=foo still works)
- docs: removed all traces (included renaming coregrind_skins.html to
coregrind_tools.html)
- in the usage messages
- in error messages

Also did in in some places that I judged were unlikely to cause clashes with
existing workspaces:

- in the header comments of many files (eg. "This file is part of Memcheck, a
Valgrind tool for...")
- in the regtests script
- in the .supp files
- in AUTHORS
- in README_MISSING_SYSCALL_OR_IOCTL

Also update the AUTHORS file to mention Jeremy.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2027 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
3b390c77899acc0b08aa1a9345a6ddb5e2e1e89a 13-Nov-2003 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Changed error messages: subsidiary explanations within an error message are now
indented one space; previously it was mixed, but Memcheck/Addrcheck indented
"Address" lines 3, which made them hard to see in the stack trace.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2021 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
2f361ccc5dfd093e9007aa42ae475980880dd60b 15-Oct-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fixed terrible(!) typo.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1934 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
cb1d1c0042661ad70f21f56d1317779ba5dd1dd1 14-Oct-2003 jsgf <jsgf@a5019735-40e9-0310-863c-91ae7b9d1cf9> Adds VG_(describe_addr)() for generating symbolic descriptions of a
memory address, based on which variables are in scope at the time and
their types.

As part of this change, I restructured the symbol table parsing code,
by splitting the stabs and dwarf-specific parts into their own files.
I also added a new set of vg_symtypes.[ch] files which contains the
type system code and the core of the VG_(describe_addr)().

I've only implemented the stabs type parser. I have not yet implemented
the DWARF2 parser. It looks well-defined but complex.

The only skin which uses this is Helgrind at the moment.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1926 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
5686735326c9e88fa938f796f5df791e23fc60cc 12-Oct-2003 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Delete some "inline" directives on functions that gcc-3.3.1 declined
to inline. This is needed to get a warning-free compilation on 3.3.1.
It seems we had "inline" on some pretty huge functions in places.
Also it appears gcc-3.3.1 won't inline a function call in a tail call
position, reasonably enough. I assume in that case it prefers to
create a tailcall to the callee, rather than inlining it.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1907 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
34ac0276104bb17574e8a392f85c1c2142fe168c 30-Sep-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Teach Helgrind to cope with negative args to malloc(). Also slightly economise
calloc().


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1870 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
398044fa32a923e931bde6fd7cddbac4fcb14834 24-Jul-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Changed the behaviour of realloc() in Memcheck, Addrcheck and Helgrind.

Previously, when realloc() was asked to make a block bigger, the ExeContext
describing where that block was allocated was increased; however, if the block
became smaller or stayed the same size, the original ExeContext remained. This
is correct in one way (that's where the memory manager actually parcelled out
the block) but it's not very intuitive. This commit changes things so the
ExeContext of a block is always changed upon realloc(). I added a regression
test for it too.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1783 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
72718649e68c7eaf3d0b8cd3deebde198b2ea84d 24-Jul-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> A big commit size-wise, but small concept-wise: removed the ThreadState type
from skin's view, replacing all instances with ThreadId. Much cleaner. Had to
change the way VG_(get_ExeContext)() worked a little. Changed the core/skin
major interface because this breaks the old version. Also fixed a few minor
related things here and there.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1782 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
7e73e5f52016ca487bf004608bc833ea1aab0953 04-Jul-2003 daywalker <daywalker@a5019735-40e9-0310-863c-91ae7b9d1cf9> spelling fixes


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1715 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
4fbe6e9ff89567e4c8cc7fdf579ad5b8c25ce1d0 15-Jun-2003 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Rename the SSE and MMX uinstrs which read/write integer registers, in
a way consistent with the position of the register field in the
instruction. In Intel encoding parlance, the G register is in bits
5,4,3 and the E register is bits 2,1,0, and so we adopt this scheme
consistently. Considering how much confusion this has caused me in
this recent bout of SSE hacking, consistent renaming can only be a
good thing. It makes it a lot easier to figure out if parts of the
SSE handling machinery are correct, or not.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1698 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
05bcdcb440c26246c3c1d80e4832961d99068b78 18-May-2003 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> gcc-3.3 as supplied with SuSE 8.2 ("gcc version 3.3 20030226
(prerelease) (SuSE Linux)") seems to complain about signed-vs-unsigned
comparisons, when -Wall is on. This commit fixes (most of) those
complaints.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1638 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
dc38f33105b3c029d33ec9f0e7299e6d09562e4a 29-Apr-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Send bug reports to Jeremy F, not me (njn).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1573 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
7d9f94dda63c0e604774f491ed6b3decbf5c3ce5 22-Apr-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Added "Int exitcode" argument to SK_(fini)(), because it could be useful
for skins.

Changed lackey to print out the exit code.

Changed AUTOMAKE_OPTIONS back to 1.5 (whoops)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1538 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
7e614813ad754144dd41dca78f4466744097fa28 22-Apr-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> In my big malloc-out-of-core changes of last week, I broke Helgrind by
forgetting to change one of the skin functions. It ran fine until it tried to
generate an error message, whereupon it complained about a missing skin
function. (We should really have more than one regression test for
Helgrind...)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1535 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
0e1b514ab8e837f75a207a037ea53a6a721e9d28 15-Apr-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Updated copyright notices for 2003. Only 4 months late.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1526 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
b4aee054064e8daf9e4c8266760f08974cd8d9fd 15-Apr-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Namespace police


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1525 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
3e88418f808bf2840646504481d6a5be1df16541 15-Apr-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> -----------------------------------------------------------------------------
overview
-----------------------------------------------------------------------------
Previously Valgrind had its own versions of malloc() et al that replaced
glibc's. This is necessary for various reasons for Memcheck, but isn't needed,
and was actually detrimental, to some other skins. I never managed to treat
this satisfactorily w.r.t the core/skin split.

Now I have. If a skin needs to know about malloc() et al, it must provide its
own replacements. But because this is not uncommon, the core provides a module
vg_replace_malloc.c which a skin can link with, which provides skeleton
definitions, to reduce the amount of work a skin must do. The skeletons handle
the transfer of control from the simd CPU to the real CPU, and also the
--alignment, --sloppy-malloc and --trace-malloc options. These skeleton
definitions subsequently call functions SK_(malloc), SK_(free), etc, which the
skin must define; in these functions the skin can do the things it needs to do
about tracking heap blocks.

For skins that track extra info about malloc'd blocks -- previously done with
ShadowChunks -- there is a new file vg_hashtable.c that implements a
generic-ish hash table (using dodgy C-style inheritance using struct overlays)
which allows skins to continue doing this fairly easily.

Skins can also replace other functions too, eg. Memcheck has its own versions
of strcpy(), memcpy(), etc.

Overall, it's slightly more work now for skins that need to replace malloc(),
but other skins don't have to use Valgrind's malloc(), so they're getting a
"purer" program run, which is good, and most of the remaining rough edges from
the core/skin split have been removed.

-----------------------------------------------------------------------------
details
-----------------------------------------------------------------------------
Moved malloc() et al intercepts from vg_clientfuncs.c into vg_replace_malloc.c.
Skins can link to it if they want to replace malloc() and friends; it does
some stuff then passes control to SK_(malloc)() et al which the skin must
define. They can call VG_(cli_malloc)() and VG_(cli_free)() to do the actual
allocation/deallocation. Redzone size for the client (the CLIENT arena) is
specified by the static variable VG_(vg_malloc_redzone_szB).
vg_replace_malloc.c thus represents a kind of "mantle" level service.

To get automake to build vg_replace_malloc.o, had to resort to a similar trick
as used for the demangler -- ask for a "no install" library (which is never
used) to be built from it.

Note that all malloc, calloc, realloc, builtin_new, builtin_vec_new, memalign
are now aware of --alignment, when running on simd CPU or real CPU.

This means the new_mem_heap, die_mem_heap, copy_mem_heap and ban_mem_heap
events no longer exist, since the core doesn't control malloc() any more, and
skins can watch for these events themselves.

This required moving all the ShadowChunk stuff out of the core, which meant
the sizeof_shadow_block ``need'' could be removed, yay -- it was a horrible
hack. Now ShadowChunks are done with a generic HashTable type, in
vg_hashtable.c, which skins can "inherit from" (in a dodgy C-only fashion by
using structs with similar layouts). Also, the free_list stuff was all moved
as a part of this. Also, VgAllocKind was moved out of core into
Memcheck/Addrcheck and renamed MAC_AllocKind.

Moved these options out of core into vg_replace_malloc.c:
--trace-malloc
--sloppy-malloc
--alignment

The alternative_free ``need'' could go, too, since Memcheck is now in complete
control of free(), yay -- another horribility.

The bad_free and free_mismatch events could go too, since they're now not
detected by core, yay -- yet another horribility.

Moved malloc() et al wrappers for Memcheck out of vg_clientmalloc.c into
mac_malloc_wrappers.c. Helgrind has its own wrappers now too.

Introduced VG_USERREQ__CLIENT_CALL[123] client requests. When a skin function
is operating on the simd CPU, this will call a given function and run it on the
real CPU. The macros VG_NON_SIMD_CALL[123] in valgrind.h present a cleaner
interface to actually use. Also introduce analogues of these that pass 'tst'
from the scheduler as the first arg to the called function -- needed for
MC_(client_malloc)() et al.

Fiddled with USERREQ_{MALLOC,FREE} etc. in vg_scheduler.c; they call
SK_({malloc,free})() which by default call VG_(cli_malloc)() -- can't call
glibc's malloc() here. All the other default SK_(calloc)() etc. instantly
panic; there's a lock variable to ensure that the default SK_({malloc,free})()
are only called from the scheduler, which prevents a skin from forgetting to
override SK_({malloc,free})(). Got rid of the unused USERREQ_CALLOC,
USERREQ_BUILTIN_NEW, etc.

Moved special versions of strcpy/strlen, etc, memcpy() and memchr() into
mac_replace_strmem.c -- they are only necessary for memcheck, because the
hyper-optimised normal glibc versions confuse it, and for memcpy() etc. overlap
checking.

Also added dst/src overlap checks to strcpy(), memcpy(), strcat(). They are
reported not as proper errors, but just with single line warnings, as for silly
args to malloc() et al; this is mainly because they're on the simulated CPU
and proper error handling would be a pain; hopefully they're rare enough to
not be a problem. The strcpy check is done after the copy, because it would
require counting the length of the string beforehand. Also added strncpy() and
strncat(), which have overlap checks too. Note that addrcheck doesn't do
overlap checking.

Put USERREQ__LOGMESSAGE in vg_skin.h to do the overlap check error messages.

After removing malloc() et al and strcpy() et al out of vg_clientfuncs.c, moved
the remaining three things (sigsuspend, VG_(__libc_freeres_wrapper),
__errno_location) into vg_intercept.c, since it contains things that run on the
simulated CPU too. Removed vg_clientfuncs.c altogether.

Moved regression test "malloc3" out of corecheck into memcheck, since corecheck
no longer looks for silly (eg. negative) args to malloc().

Removed the m_eip, m_esp, m_ebp fields from the `Error' type. They were being
set up, and then read immediately only once, only if GDB attachment was done.
So now they're just being held in local variables. This saves 12 bytes per
Error.

Made replacement calloc() check for --sloppy-malloc; previously it didn't.

Added "silly" negative size arg check to realloc(), it didn't have one.

Changed VG_(read_selfprocmaps)() so it can parse the file directly, or from a
previously read buffer. Buffer can be filled with the new
VG_(read_selfprocmaps_contents)(). Using this at start-up to snapshot
/proc/self/maps before the skins do anything, and then parsing it once they
have done their setup stuff. Skins can now safely call VG_(malloc)() in
SK_({pre,post}_clo_init)() without the mmap'd superblock erroneously being
identified as client memory.

Changed the --help usage message slightly, now divided into four sections: core
normal, skin normal, core debugging, skin debugging. Changed the interface for
the command_line_options need slightly -- now two functions, VG_(print_usage)()
and VG_(print_debug_usage)(), and they do the printing themselves, instead of
just returning a string -- that's more flexible.

Removed DEBUG_CLIENTMALLOC code, it wasn't being used and was a pain.

Added a regression test testing leak suppressions (nanoleak_supp), and another
testing strcpy/memcpy/etc overlap warnings (overlap).

Also changed Addrcheck to link with the files shared with Memcheck, rather than
#including the .c files directly.

Commoned up a little more shared Addrcheck/Memcheck code, for the usage
message, and initialisation/finalisation.

Added a Bool param to VG_(unique_error)() dictating whether it should allow
GDB to be attached; for leak checks, because we don't want to attach GDB on
leak errors (causes seg faults). A bit hacky, but it will do.

Had to change lots of the expected outputs from regression files now that
malloc() et al are in vg_replace_malloc.c rather than vg_clientfuncs.c.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1524 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
43c799ed4de307bf00b2467b9b63e583894a030b 08-Apr-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> This commit moves some skin-specific stuff out of core, and generally
neatens other things up.

Also, it adds the --gen-suppressions option for automatically generating
suppressions for each error.

Note that it changes the core/skin interface:
SK_(dup_extra_and_update)() is replaced by SK_(update_extra)(), and
SK_(get_error_name)() and SK_(print_extra_suppression_info)() are added.


-----------------------------------------------------------------------------
details
-----------------------------------------------------------------------------
Removed ac_common.c -- it just #included another .c file; moved the
#include into ac_main.c.

Introduced "mac_" prefixes for files shared between Addrcheck and Memcheck,
to make it clearer which code is shared. Also using a "MAC_" prefix for
functions and variables and types that are shared. Addrcheck doesn't see
the "MC_" prefix at all.

Factored out almost-identical mc_describe_addr() and describe_addr()
(AddrCheck's version) into MAC_(describe_addr)().

Got rid of the "pp_ExeContext" closure passed to SK_(pp_SkinError)(), it
wasn't really necessary.

Introduced MAC_(pp_shared_SkinError)() for the error printing code shared by
Addrcheck and Memcheck. Fixed some bogus stuff in Addrcheck error messages
about "uninitialised bytes" (there because of an imperfect conversion from
Memcheck).

Moved the leak checker out of core (vg_memory.c), into mac_leakcheck.c.
- This meant the hacky way of recording Leak errors, which was different to
normal errors, could be changed to something better: introduced a
function VG_(unique_error)(), which unlike VG_(maybe_record_error)() just
prints the error (unless suppressed) but doesn't record it. Used for
leaks; a much better solution all round as it allowed me to remove a lot
of almost-identical code from leak handling (is_suppressible_leak(),
leaksupp_matches_callers()).

- As part of this, changed the horrible SK_(dup_extra_and_update) into the
slightly less horrible SK_(update_extra), which returns the size of the
`extra' part for the core to duplicate.

- Also renamed it from VG_(generic_detect_memory_leaks)() to
MAC_(do_detect_memory_leaks). In making the code nicer w.r.t suppressions
and error reporting, I tied it a bit more closely to Memcheck/Addrcheck,
and got rid of some of the args. It's not really "generic" any more, but
then it never really was. (This could be undone, but there doesn't seem
to be much point.)

STREQ and STREQN were #defined in several places, and in two different ways.
Made global macros VG_STREQ, VG_CLO_STREQ and VG_CLO_STREQN in vg_skin.h.

Added the --gen-suppressions code. This required adding the functions
SK_(get_error_name)() and SK_(print_extra_suppression_info)() for skins that
use the error handling need.

Added documentation for --gen-suppressions, and fixed some other minor document
problems.

Various other minor related changes too.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1517 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
9b007f64f7d277450793bc54e4ce29a163eb793b 07-Apr-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> -----------------------------------------------------------------------------
overview
-----------------------------------------------------------------------------
This commit introduces an optimisation that speeds up Memcheck by roughly
-3 -- 28%, and Addrcheck by 1 -- 36%, at least for the SPEC2000 benchmarks on
my 1400MHz Athlon.

Basic idea: that handling of A/V bit updates on %esp-adjustments was quite
sub-optimal -- for each "PUT ESP", a function was called that computed the
delta from the old and new ESPs, and then called a looping function to deal
with it.

Improvements:

1. most of the time, the delta can be seen from the code. So there's no need
to compute it.

2. when the delta is known, we can directly call a skin function to handle it.

3. we can specialise for certain common cases (eg. +/- 4, 8, 12, 16, 32),
including having unrolled loops for these.

This slightly bloats UCode because of setting up args for the call, and for
updating ESP in code (previously was done in the called C function). Eg. for
`date' the code expansion ratio goes from 14.2 --> 14.6. But it's much faster.

Note that skins don't have to use the specialised cases, they can just
define the ordinary case if they want; the specialised cases are only used
if present.

-----------------------------------------------------------------------------
details
-----------------------------------------------------------------------------
Removed addrcheck/ac_common.c, put its (minimal) contents in ac_main.c.

Updated the major interface version, because this change isn't binary
compatible with the old core/skin interface.

Removed the hooks {new,die}_mem_stack_aligned, replaced with the better
{new,die}_mem_stack_{4,8,12,16,32}. Still have the generic {die,new}_mem_stack
hooks. These are called directly from UCode, thanks to a new pass that occurs
between instrumentation and register allocation (but only if the skin uses
these stack-adjustment hooks). VG_(unknown_esp_update)() is called from UCode
for the generic case; it determines if it's a stack switch, and calls the
generic {new,die}_stack_mem hooks accordingly. This meant
synth_handle_esp_assignment() could be removed.

The new %esp-delta computation phase is in vg_translate.c.

In Memcheck and Addrcheck, added functions for updating the A and V bits of a
single aligned word and a single aligned doubleword. These are called from the
specialised functions new_mem_stack_4, etc. Could remove the one for the old
hooks new_mem_stack_aligned and die_mem_stack_aligned.

In mc_common.h, added a big macro containing the definitions of new_mem_stack_4
et al. It's ``instantiated'' separately by Memcheck and Addrcheck. The macro
is a bit klugey, but I did it that way because speed is vital for these
functions, so eg. a function pointer would have slowed things down.

Updated the built-in profiling events appropriately for the changes (removed
one old event, added a new one; finding their names is left as an exercise for
the reader).

Fixed memory event profiling in {Addr,Mem}check, which had rotted.

A few other minor things.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1510 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
d5815ec72dbb6ef5b56b14429356e50756a24a24 06-Apr-2003 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> A minimal set of changes to make it work on Red Hat 9, at least in the
interim. All hats off to Graydon Hoare for this, plus to whoever
devised the LD_ASSUME_KERNEL trapdoor.

This does not provide NPTL support. Instead it turns out we can ask
for the old LinuxThreads interface to be used (wonderful!)

Other than that we have to deal with kernels with SYSINFO pages at the
top of memory. No big deal, apparently.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1508 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
3d7c9c8c2e4882c787a9b63befe095785f3d5d07 26-Mar-2003 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Implement support for the MMX instruction set. The scheme used is
the same as that for FPU instructions. That is, regard the MMX state
(which is the same as the FPU state) opaquely, and every time we
need to do a MMX instruction, move the simulated MMX state into the
real CPU, do the instruction, and move it back. JeremyF's optimisation
to minimise FPU saves/restores applies automatically here.

So, this scheme is simple. It will cause memcheck to complain bitterly
if uninitialised data is copied through the MMX registers, in the same
way that memcheck complains if you move uninit data through the FPU
registers. Whether this turns out to be a problem remains to be seen.

Most instructions are done, and doing the rest is easy enough, I just
need people to send test cases so I can do them on demand.

(Core) UCode has been extended with 7 new uinstrs:

MMX1 MMX2 MMX3
-- 1/2/3 byte mmx insns, no references to
integer regs or memory, copy exactly to the output stream.

MMX_MemRd MMX_MemWr
-- 2 byte mmx insns which read/write memory and therefore need
to have an address register patched in at code generation
time. These are the analogues to FPU_R / FPU_W.

MMX_RegRd MMX_RegWr
-- These have no analogues in FPU land. They hold 2 byte insns
which move data to/from a normal integer register (%eax etc),
and so this has to be made explicit so that (1) a suitable
int reg can be patched in at codegen time, and (2) so that
memcheck can do suitable magic with the V bits going into/
out of the MMX regs.

Nulgrind (ok, this is a nop, but still ...) and AddrCheck's
instrumenters have been extended to cover these new UInstrs. All
others (cachesim, memcheck, lackey, helgrind, did I forget any)
abort when they see any of them. This may be overkill but at least
it ensures we don't forget to implement it in those skins.
[A bad thing would be that some skin silently passes along
MMX uinstrs because of a default: case, when it should actually
do something with them.]

If this works out well, I propose to backport this to 2_0_BRANCH.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1483 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
e11d6c8e8bb80f951b7f0a2c640c2283d19100e4 15-Dec-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Message cosmetics.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1375 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
e1a39f495cf52cbf9e51d15322301169067e8e62 15-Dec-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Change default state of the private-stacks optimisation to off, to be
on the conservative side.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1374 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
72baa7a62a326589e1548e47a59cd1370dd5c5fc 10-Dec-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Make it build on R H 6.2 (with egcs-2.91.66).

Jeremy, can you just cast your eye over this (sanity check) ? Thx -- J


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1359 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
78210aa4799a5b3d4ebb44361577ca02dcdeef45 01-Dec-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Take into account TCEntry and alignment overheads when calculating TC
sector sizes. Also, recalibrate all skins against mozilla-1.0.1.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1341 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
c0d8f68810eb79a5a6cb6049d6a4ab1de7dc4e18 30-Nov-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Complete integration of the new code management (sectored FIFO) story.

This commit adds stats gathering / printing (use -v -v), and selection
of sector size decided by asking skins, via
VG_(details).avg_translation_sizeB, the average size of their
translations.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1334 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
e70c27e0933484f5cacd5dc2376f988118bc6556 16-Nov-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from JeremyF:

30-hg-fix

HELGRIND: little fixes in the wake of Nick's big rearrangement


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1318 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
810086f9489e1cb373bcfc15ab94a3fa3ec403f3 14-Nov-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Lots of changes to future-proof the core/skin interface, making it less likely
that changes will cause binary incompatibilities. Mostly done by hiding naked
structs with function calls.

Structs hidden in this way were: UCodeBlock, SkinSupp and SkinError (which were
merged back with CoreSupp and CoreError into single types Supp and Error),
ShadowChunk, VgDetails, VgNeeds and VgTrackEvents. The last three are the most
important ones, as they are (I think) the most likely to change.

Suitable get()/set() methods were defined for each one. The way UCodeBlocks
are copied for instrumentation by skins is a little different now, using
setup_UCodeBlock. Had to add a few other functions here n there. Changed
how SK_(complete_shadow_chunk) works a bit.

Added a file coregrind/vg_needs.c which contains all the get/set functions.
It's pretty simple.

The changes are not totally ideal -- eg. ShadowChunks has get()/set() methods
for its `next' field which arguably shouldn't be exposed (betraying the fact
that it's a linked list), and the get()/set() methods are a bit cumbersome at
times, esp. for `Error' because the fields are accessed quite a few times, and
the treatment of Supps and Errors is a bit inconsistent (but they are used in
different ways), and sizeof_shadow_blocks is still a hack. But still better
than naked structs. And one advantage is that a bit of sanity checking can be
performed by the get()/set() methods, as is done for VG_({get,set}_sc_extra)()
to make sure no reading/writing occurs outside the allowed area.

I didn't do it for UInstr, because its fields are accessed directly in lots and
lots of spots, which would have been a great big pain and I was a little
worried about overhead of calling lots of extra functions, although in practice
translation times are small enough that it probably doesn't matter.

Updated the example skin and the docs, too, hurrah.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1314 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
542494beafc1047484c729e5fd82a98e12379ba1 13-Nov-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from JeremyF:

42-hg-show-all-locks

HELGRIND: show all the locks when a cycle is detected, because doing
it selectively is wrong for now.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1312 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
c808ef56a96f56d010f335b5e8a9e9310d758688 13-Nov-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from JeremyF:

40-hg-tidstate

HELGRIND: record more information when a memory location changes
state. Now also records the thread ID and the previous state at that
point (so now a "possible race" error message tells you the moment we
entered an error state from an OK state, and where we entered that OK
state and from what).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1311 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
7a5ebcf66cfbd2fefa261cfbaf5f03527c299a29 13-Nov-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from JeremyF:

39-lock-prefix

Add a new UInstr LOCK to represent a "lock" prefix in the instruction
stream. This has the same semantics as NOP, but allows a skin to tell
whether a group of UInstrs associated with an x86 instruction are
meant to be locked.

HELGRIND: uses the LOCK UInstr to automatically take and release a
special __BUS_HARDWARE_LOCK__ around locked instructions. This only
works properly if all instructions touching a given address are locked
(even reads).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1310 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
18cd4a57e58216fa1576667722729753ee84cfb7 13-Nov-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from JeremyF:

38-hg-lazy-lasttouch

HELGRIND: rather than recording the last access, record the last state
change. This is more interesting and useful, and uses up a lot less
memory when using (now inaccurately named) --show-last-access=all.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1309 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
f6374327b255849ac4d30b1ff35d38acc7fb60d0 13-Nov-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from JeremyF:

37-hg-private-stack

HELGRIND: by default, assume that thread stacks are thread-local. This
means that they are always initalized to be exclusively owned by their
thread (rather than virgin), and no access checks are generated for
stack-relative memory references (ie, relative off ESP or EBP). This
saves about 70% (statically) of checks on memory accesses.

This is enabled by default, but can be disabled with
--private-stacks=no


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1308 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
8fac99ada39460ad1dae16f0693c56b658a4738b 13-Nov-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from JeremyF:

36-hg-optim

HELGRIND: various microoptimizations and small tidyups.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1307 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
dca8411c34a51a491cdf40d4b33846c03c6591dc 13-Nov-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from JeremyF:

33-pre_mutex_lock

HELGRIND: two updates: add a pre_mutex_lock tracking function, so the
skin can do something before the thread blocks. This allows us to do
lock ordering tests before the thread blocks in the deadlock we'd like
to report...


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1306 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
c4a810d7cc0f139727acec59b250c804bb04801a 13-Nov-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from JeremyF:

32-hg-lifetime-segments

HELGRIND: implement the algorithm described in "Runtime Checking of
Multithreaded Applications with Visual Threads". Rather than working
with thread IDs, this algorithm breaks the lifetime of a thread up
into thread lifetime segments, and arranges them in an interference
graph.

If a memory location is in exclusive state and it is touched by
another thread, it compares the TLSs of the old owner and the new
thread. If the two TLSs can't possibly overlap in time (for example,
one TLS is the parent before a child thread is created, and the other
TLS is the child thread) the memory location's ownership is
transferred rather than moving it into a shared state. This allows a
parent thread to set up some memory and then create a new child,
handing ownership of that memory to the child, without generating
spurious errors.

At present the only synchonization events used to create new TLSs are
thread create and thread join, though in principle any synchronization
event would work.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1305 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
499e3de5775632e70e138e9ad57335d6d22cd342 13-Nov-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from JeremyF:

31-hg-shadow-execontext

HELGRIND: Add option to record ExeContext for every word access. This
is probably very slow and memory hungry, but it helps make the error
reports more useful. Defaults to off.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1304 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
406270b06ec77080a563a682f9168e0c83c83516 13-Nov-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from JeremyF:

30-hg-clo

HELGRIND: command line option processing infrastructure (nothing using
it yet)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1303 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
39a4d84e77f529936a97f45f7f38b8920c0d9291 13-Nov-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from JeremyF:

29-hg-rename-hg_mutex_t

HELGRIND: rename hg_mutex_t, because it was annoying me.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1302 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
7f3ad22648c4e375a9bb09dabe5ed7418542815c 13-Nov-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from JeremyF:

26-hg-client-reqs

HELGRIND: first client requests. Adds a request to return memory to
its virginal state (useful for allocators which recycle memory), and
one to put memory into an error state (useful for suppressing errors
from known races).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1301 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
dac0a441063f0801345c95f58de74998ffefc82e 13-Nov-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from JeremyF:

25-hg-free-mutex

HELGRIND: Track memory frees and allocates, looking for the freeing of
locked mutexes. Also makes some prime hash sizes actually prime.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1300 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
4bffb233e7f6df0224830f38ba3ad69c2c080a04 13-Nov-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from JeremyF:

21-hg-hashed-lockset

HELGRIND: New implementation of LockSets. This changes the
lockset_table into a hash, and changes the representation of each
LockSet from a list into an array. This improves performance (mainly
because of the hash, but the arrays are more cache friendly too), and
simplifies the code.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1295 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
ff2c923940e7803ab8c60d93120af91f10c2bf82 13-Nov-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from Jeremy F:

20-hg-lockgraph-report
HELGRIND: Better reporting of locking ordering problems.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1294 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
27f1a386dce7eb9e1d30b841771c71f0de27f34f 08-Nov-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Added a basic core/skin interface versioning system. Each skin must use the
macro VG_DETERMINE_INTERFACE_VERSION exactly once. If the X.Y core and skin
versions don't have a matching X (indicating binary incompatibility), Valgrind
will abort execution immediately at startup.

I even documented it in the skins guide!


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1279 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
65f13702e68b5d01e325428215c15c0ec35323b3 24-Oct-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Increase M_LOCKSET_TABLE to 5000, for Mozilla.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1268 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
c26cc2572f7f73cdac0ed5f41c905d9216baa5c7 23-Oct-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from Jeremy Fitzhardinge:

19-hg-lockgraph
HELGRIND: large patch which does a big bugfix and adds some new
instrumentation:

1. The bugfix is BIG. Previously the code which maintained the
thread's current lockset would often (maybe always) fail to add new
locks to the set, so it always looked like threads were holding one
lock. The problem was in weird_LockSet_equals(); I rewrote it in a way
which should be obviously correct. Fixing this exposed a bug in
removing locks from a thread's lockset, which was also caused by
another bug in weird_LockSet_equals(). This fix makes many spurious
data race warnings go away (notably, stdio becomes silent).

2. The new feature is tracking of the order of lock usage. If
threads are taking locks in an inconsistent order, that's a symptom of
possible deadlock. Helgrind will now warn when it sees this happening
(though the warnings themselves need to be improved).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1267 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
40f8ebeb10757c7f83f49bc17228f882083a8da3 23-Oct-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from Jeremy Fitzhardinge:

14-hg-mmap-magic-virgin
This does two things:

1. change the signatures of the new_mem_mmap and change_mem_mprotect
functions to remove the pointless 'nn' argument. This makes them match
the signature of new_mem_startup...

2. change helgrind to mark memory created by mmap as if it were the
same as other magically pre-inited memory. Implement this by pointing
helgrind's new_mem_mmap function at new_mem_startup.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1263 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
b52a1b00214c1f77faed9dd59efe7e90b9e61995 23-Oct-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from Jeremy Fitzhardinge:

13-kill-1ifroot
Kill VG_(get_current_tid_1_if_root)() and replace it with the slightly
more appetising (though still hackish)
VG_(get_current_or_recent_tid)(). This is intended for use when
there's no thread actually loaded into the baseblock, but we're doing
work on behalf of the the thread that was last running (such as during
a syscall).

This probably fixes a bug with helgrind misattributing memory created
with mmap to thread 1 rather than the thread which called mmap (though
the behaviour is still probably wrong: mmapped memory should be
magically_inited).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1262 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
a5b3aece4d66c351775519734e795edc5866fb15 22-Oct-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from Jeremy Fitzhardinge:

21-hg-dupwrite
HELGRIND: quite often memory is written with a value which is already
there, which would not cause a race (I think; there are certainly
valid idioms which rely on this behaviour). Anyway, suppressing checks
for such overwrites cuts down the number of apparently spurious
errors. Also fixes the bug in which FP loads were considered to be
stores.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1258 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
1806d7f69c5c4f506bf5b29b0dab06b0ec6d36c6 22-Oct-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from Jeremy Fitzhardinge:

20-hg-secmap
HELGRIND: fix bugs causing a torrent of "access to distingished map"
messages. There were two: one is some absurdly broken rounding/padding
code in set_address_range_state() (how did anything work!?). The other
was some odd looking code in the tracking of attaching shared memory
segments. Since they're semantically very similar to mmap, track them
as such.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1257 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
0f8116946ac4556e63c4e7937cb90d2458862e24 22-Oct-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from Jeremy Fitzhardinge:

19-hg-context
HELGRIND: Yet more work on making sure the right context is used when
reporting errors. The previous code used the snapshot of the thread
context in the VG_(threads) array rather than the current machine
state in the baseBlock. This patch makes sure that errors arising from
program reads and writes are reported properly.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1256 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
16748af65523639ee9e69cfc99efccf9c3bfaced 22-Oct-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from Jeremy Fitzhardinge:

18-hg-err-reporting
HELGRIND: show more information about the address we're reporting a
possible data race for; in particular, try to describe where the
address came from (static variable, or heap allocated and if so
where?) (Mostly stolen from memcheck). Also puts memory locations
involved with an error into an error state, so that duplicate errors
are suppressed. Also displays the last good set of locks for a memory
location.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1255 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
274c6010a5d718587a6229750aaad947d2c3fa77 22-Oct-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from Jeremy Fitzhardinge:

17-hg-generic-mutex
HELGRIND: remove references to pthread_mutex_t and replace it with a
more generic notion of a mutex. Adds a persistent store of per-mutex
information. Not presently useful, but will be.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1254 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
5481f8fa366039a4d2c77448351eacb675f4f978 20-Oct-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> merge patch from Jeremy Fitzhardinge:

15-hg-datasym
HELGRIND: In conjunction with patch 13-data-syms, print symbolic
information for addresses in error messages (if possible).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1248 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
7ab2aca9162b68071dbcc26792dd3f91d9f0e4fe 20-Oct-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> merge patches from Jeremy Fitzhardinge:

14-hg-tid
HELGRIND: This fixes a bug in Helgrind in which all memory access by
syscalls was being treated as if it were happening in thread 1. This
is because the eraser_mem_read/write functions were using
get_current_tid_1_if_root() to get the current tid. Unfortunately,
during syscalls there is no current thread, so it was getting
1_if_root. This patch fixes this by using what thread ID information
we're given, and only using get_current_tid() if we're recording a
memory access performed by code (rather than by a syscall).

... which relies on ...

06-memops
Implement VG_(memcpy/memset).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1247 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
4aa62bafc2c28dc14153ce8c765687cfb8aa7dde 05-Oct-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Naming wibbles -- start skin names with a capital letter (they deserve it)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1198 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
584eaacf6c0cc2820a54da7323d2b01c1796cd1c 04-Oct-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> wibbles


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1184 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
ac6c17667e489215a0795c24cc1b202254582a4f 04-Oct-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Moved the following macros, which were defined multiple times in multiple
files, into vg_skin.h:

uInstr0, uInstr1, uInstr2, uInstr3, nameIReg, nameISize, nameSReg,
newTemp, newShadow, uLiteral, uCCall

As macros they avoid namespace problems (they expand to VG_(whatever)) so
this should work fine.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1182 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
1f3a9091ec933ef5fc179b7f5a19b0d2b7291109 04-Oct-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> comment wibbles


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1175 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
d04b7c6801102481b53ba2dccb9f693eea01004b 03-Oct-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Changed startup message to give information about skin and core separately.
Added "version" and "copyright_author" fields for skins to supply.

Now startup message looks something like this:

==12698== cachegrind, an I1/D1/L2 cache profiler for x86-linux.
==12698== Copyright (C) 2002, and GNU GPL'd, by Nicholas Nethercote.
==12698== Built with valgrind-HEAD, a program execution monitor.
==12698== Copyright (C) 2000-2002, and GNU GPL'd, by Julian Seward.
==12698== Estimated CPU clock rate is 1422 MHz
==12698== For more details, rerun with: -v

The skin can specify a version number, but the skins that will be distributed
with Valgrind don't.

Also changed "x86 GNU/Linux" to the wicked "x86-linux" at Julian's request.

Updated default regression test filter to handle this new startup message.

----

Also moved the skin's name, description, etc., fields out of VG_(needs) into a
new struct VG_(details), since they are logically quite different to the needs.
Did a little code formatting, etc., for this. Updated skin docs
correspondingly, too.

Also renamed the need `run_libc_freeres' --> `libc_freeres' so it's a noun
phrase rather than a verb phrase.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1172 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
c953984b8ee34ac55830b9871138b409d9d9476c 02-Oct-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Updated file descriptions in the copyright notices to reflect the core/skin
split. Each skin now has its own two-line description.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1166 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
e427a6636de5b2d34c2223821ff5cbf79bad4fad 02-Oct-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Changes made so that skin error "report this bug to" messages are distinguished
from core error ones:

- Split up VG_(panic) into VG_(core_panic) and VG_(skin_panic)

- Likewise, split vg_assert into vg_assert and sk_assert

- Added a new need string: `bug_reports_to'

- Removed VG_(skin_error) which was a previous wussy attempt at this change.
This removed the need for the hacky redeclaration of VG_(skin_error) in
vg_profile.c, which is good.

At the moment, Julian and Nick's email addresses are hard-coded into each skin
individually, rather than using a #define in vg_skin.h, because that didn't
feel quite right to me... jseward@acm.org is still done with a #define for
core errors, though.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1164 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
4ba5a79d946b22c52856d62dca7c927cb306dfa3 30-Sep-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Converted all functions visible from vg_skin.h with names in CamelCaps to
use_under_scores instead, to be consistent.

Also added some missing 'extern's on function declarations in vg_skin.h.

Also added a quick note in vg_regtest.in on the simplest way to run regression
tests.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1135 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
cac76cb18577b9c51d331f56e8ea241f6effaf31 23-Sep-2002 njn25 <njn25@a5019735-40e9-0310-863c-91ae7b9d1cf9> Changed lots of files for the new core/ + skin/ directory structure:

- changed lots of Makefile.am files
- changed configure.in
- changed lots of #include lines for changed file names
- changed lots of file headers n footers for changed file names
- changed vg_regtest to handle new directory structure -- recursively
traverses subdirectories for .vgtest test files
- changed lots of paths in memcheck/ regression test expected outputs


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1090 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c
e49d8e7dfd3a9c96feb9935b5920973dfc0b170a 23-Sep-2002 njn25 <njn25@a5019735-40e9-0310-863c-91ae7b9d1cf9> Files updated, added and removed in order to turn the ERASER branch into HEAD


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1086 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/helgrind/hg_main.c