You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
1
(7) |
2
(9) |
3
(7) |
4
(5) |
5
(5) |
6
(16) |
|
7
(20) |
8
(9) |
9
(15) |
10
(11) |
11
(13) |
12
(12) |
13
(10) |
|
14
(13) |
15
(6) |
16
(10) |
17
(12) |
18
(17) |
19
(3) |
20
(10) |
|
21
(11) |
22
(7) |
23
(6) |
24
(7) |
25
(5) |
26
(5) |
27
(14) |
|
28
(6) |
29
(4) |
30
(5) |
|
|
|
|
|
From: Tom H. <th...@cy...> - 2008-09-23 02:28:50
|
Nightly build on gill ( x86_64, Fedora Core 2 ) started at 2008-09-23 03:00:04 BST Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 464 tests, 33 stderr failures, 4 stdout failures, 0 post failures == exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/hackedbz2 (stderr) helgrind/tests/hg01_all_ok (stderr) helgrind/tests/hg02_deadlock (stderr) helgrind/tests/hg03_inherit (stderr) helgrind/tests/hg04_race (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/tc01_simple_race (stderr) helgrind/tests/tc05_simple_race (stderr) helgrind/tests/tc06_two_races (stderr) helgrind/tests/tc09_bad_unlock (stderr) helgrind/tests/tc14_laog_dinphils (stderr) helgrind/tests/tc16_byterace (stderr) helgrind/tests/tc17_sembar (stderr) helgrind/tests/tc19_shadowmem (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) helgrind/tests/tc23_bogus_condwait (stderr) memcheck/tests/file_locking (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/origin5-bz2 (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/varinfo6 (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) none/tests/amd64/insn_ssse3 (stdout) none/tests/amd64/insn_ssse3 (stderr) none/tests/amd64/ssse3_misaligned (stderr) none/tests/blockfault (stderr) none/tests/cmdline2 (stdout) none/tests/fdleak_fcntl (stderr) none/tests/mremap2 (stdout) none/tests/x86/insn_ssse3 (stdout) none/tests/x86/insn_ssse3 (stderr) none/tests/x86/ssse3_misaligned (stderr) |
|
From: Danny R. <dr...@cs...> - 2008-09-23 01:23:34
|
Josef Weidendorfer wrote: > On Tuesday 16 September 2008, Rodrigo Dominguez wrote: >> Is someone working on modifying valgrind to run multithreaded programs >> concurrently (without using the serializing semaphore)? > > Same as Nick: Not that I know of. This is some interesting timing! In the last few months I've been hacking away at Valgrind based code, looking at building performance analysis tools. As part of this we have a modified Valgrind/VEX which allows threads to run in parallel. This is mainly Valgrind core, as: * Some of the tools are a little difficult to parallelise (as has been pointed out in the Valgrind documentation) * We are developing our own tools The main areas we looked at were code caching mechanisms and atomic instruction implementations. We got a reasonable speedup until around 8 CPUs. If people are interested in more details I can give more specifics or can be contacted off list. I can forward code or more implementation details. As it stands, the modifications work right now, but there is still a reasonable amount of experiment code present. If this sounds like an appealing addition to Valgrind proper then I can clean up the code into a more sane series of patches. - Danny Robson |
|
From: Josef W. <Jos...@gm...> - 2008-09-22 13:52:46
|
On Tuesday 16 September 2008, Rodrigo Dominguez wrote: > Is someone working on modifying valgrind to run multithreaded programs > concurrently (without using the serializing semaphore)? Same as Nick: Not that I know of. > This would allow > valgrind to behave more similarly to the way the native application behaves. > If not, would this be an interesting project for contribution? You can approximate simultaneous execution better by choosing shorter scheduling time slices for the thread-serialization, perhaps even dynamic. But every thread switch has some overhead... Probably off-topic: to just get faster Valgrind runs, it is much better to not touch the core, but to parallize a tools tasks. Even this may prove difficult if there are many data dependencies among the needed tools actions for different threads. I suppose that (hardware) transactional memory would be very beneficial here, too. Josef > > > Thank you, > > > Rodrigo Dominguez > > |
|
From: <sv...@va...> - 2008-09-22 09:17:28
|
Author: sewardj
Date: 2008-09-22 10:17:03 +0100 (Mon, 22 Sep 2008)
New Revision: 8634
Log:
Move error management stuff out of hg_main.c into hg_errors.[ch].
Because the type XError references a lot of other types, this was
quite complex and involved moving some other code around too.
Also:
* fix algorithmic stupidity to do with reverse lookups in the
map_threads table. No need to do reverse lookups (Thread* to
ThreadId lookups) by visiting all table entries. Instead just store
the associated ThreadId in each Thread structure. Hence the
functions map_threads_{maybe_}reverse_lookup_SLOW is no longer slow.
* reduce the amount of debug printing caused by VTS and EvM
garbage collectin, in libhb_core.c.
Modified:
branches/YARD/helgrind/hg_basics.c
branches/YARD/helgrind/hg_basics.h
branches/YARD/helgrind/hg_errors.c
branches/YARD/helgrind/hg_errors.h
branches/YARD/helgrind/hg_lock_n_thread.c
branches/YARD/helgrind/hg_lock_n_thread.h
branches/YARD/helgrind/hg_main.c
branches/YARD/helgrind/hg_wordset.c
branches/YARD/helgrind/libhb_core.c
[... diff too large to include ...]
|
|
From: Tom H. <th...@cy...> - 2008-09-22 03:26:17
|
Nightly build on alvis ( i686, Red Hat 7.3 ) started at 2008-09-22 03:15:05 BST Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 366 tests, 80 stderr failures, 2 stdout failures, 29 post failures == exp-ptrcheck/tests/bad_percentify (stderr) exp-ptrcheck/tests/base (stderr) exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/fp (stderr) exp-ptrcheck/tests/globalerr (stderr) exp-ptrcheck/tests/hackedbz2 (stderr) exp-ptrcheck/tests/hp_bounds (stderr) exp-ptrcheck/tests/hp_dangle (stderr) exp-ptrcheck/tests/justify (stderr) exp-ptrcheck/tests/partial_bad (stderr) exp-ptrcheck/tests/partial_good (stderr) exp-ptrcheck/tests/pth_create (stderr) exp-ptrcheck/tests/pth_specific (stderr) exp-ptrcheck/tests/realloc (stderr) exp-ptrcheck/tests/stackerr (stderr) exp-ptrcheck/tests/strcpy (stderr) exp-ptrcheck/tests/supp (stderr) exp-ptrcheck/tests/tricky (stderr) exp-ptrcheck/tests/unaligned (stderr) exp-ptrcheck/tests/zero (stderr) helgrind/tests/hg01_all_ok (stderr) helgrind/tests/hg02_deadlock (stderr) helgrind/tests/hg03_inherit (stderr) helgrind/tests/hg04_race (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/hg06_readshared (stderr) helgrind/tests/tc01_simple_race (stderr) helgrind/tests/tc02_simple_tls (stderr) helgrind/tests/tc03_re_excl (stderr) helgrind/tests/tc05_simple_race (stderr) helgrind/tests/tc06_two_races (stderr) helgrind/tests/tc07_hbl1 (stderr) helgrind/tests/tc08_hbl2 (stderr) helgrind/tests/tc09_bad_unlock (stderr) helgrind/tests/tc11_XCHG (stderr) helgrind/tests/tc12_rwl_trivial (stderr) helgrind/tests/tc14_laog_dinphils (stderr) helgrind/tests/tc16_byterace (stderr) helgrind/tests/tc17_sembar (stderr) helgrind/tests/tc18_semabuse (stderr) helgrind/tests/tc19_shadowmem (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) helgrind/tests/tc23_bogus_condwait (stderr) helgrind/tests/tc24_nonzero_sem (stderr) massif/tests/alloc-fns-A (post) massif/tests/alloc-fns-B (post) massif/tests/basic (post) massif/tests/basic2 (post) massif/tests/big-alloc (post) massif/tests/culling1 (stderr) massif/tests/culling2 (stderr) massif/tests/custom_alloc (post) massif/tests/deep-A (post) massif/tests/deep-B (stderr) massif/tests/deep-B (post) massif/tests/deep-C (stderr) massif/tests/deep-C (post) massif/tests/deep-D (post) massif/tests/ignoring (post) massif/tests/insig (post) massif/tests/long-names (post) massif/tests/long-time (post) massif/tests/new-cpp (post) massif/tests/null (post) massif/tests/one (post) massif/tests/overloaded-new (post) massif/tests/peak (post) massif/tests/peak2 (stderr) massif/tests/peak2 (post) massif/tests/realloc (stderr) massif/tests/realloc (post) massif/tests/thresholds_0_0 (post) massif/tests/thresholds_0_10 (post) massif/tests/thresholds_10_0 (post) massif/tests/thresholds_10_10 (post) massif/tests/thresholds_5_0 (post) massif/tests/thresholds_5_10 (post) massif/tests/zero1 (post) massif/tests/zero2 (post) memcheck/tests/file_locking (stderr) memcheck/tests/leak-0 (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-regroot (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/long_namespace_xml (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/origin1-yes (stderr) memcheck/tests/origin4-many (stderr) memcheck/tests/origin5-bz2 (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_changes (stderr) memcheck/tests/varinfo1 (stderr) memcheck/tests/varinfo2 (stderr) memcheck/tests/varinfo3 (stderr) memcheck/tests/varinfo4 (stderr) memcheck/tests/varinfo5 (stderr) memcheck/tests/varinfo6 (stderr) memcheck/tests/x86/bug152022 (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) memcheck/tests/x86/xor-undef-x86 (stderr) memcheck/tests/xml1 (stderr) none/tests/blockfault (stderr) none/tests/cmdline2 (stdout) none/tests/mremap2 (stdout) none/tests/shell (stderr) none/tests/shell_valid1 (stderr) none/tests/shell_valid2 (stderr) none/tests/shell_valid3 (stderr) |
|
From: Tom H. <th...@cy...> - 2008-09-22 03:10:42
|
Nightly build on lloyd ( x86_64, Fedora 7 ) started at 2008-09-22 03:05:05 BST Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 458 tests, 11 stderr failures, 3 stdout failures, 0 post failures == exp-ptrcheck/tests/base (stderr) exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/pth_create (stderr) exp-ptrcheck/tests/pth_specific (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc22_exit_w_lock (stderr) memcheck/tests/file_locking (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/vcpu_fnfns (stdout) memcheck/tests/x86/scalar (stderr) none/tests/blockfault (stderr) none/tests/cmdline2 (stdout) none/tests/mremap2 (stdout) |
|
From: Tom H. <th...@cy...> - 2008-09-22 03:09:39
|
Nightly build on aston ( x86_64, Fedora Core 5 ) started at 2008-09-22 03:20:06 BST Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 464 tests, 10 stderr failures, 3 stdout failures, 0 post failures == exp-ptrcheck/tests/base (stderr) exp-ptrcheck/tests/ccc (stderr) helgrind/tests/tc08_hbl2 (stdout) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) memcheck/tests/file_locking (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/x86/scalar (stderr) none/tests/blockfault (stderr) none/tests/cmdline2 (stdout) none/tests/mremap2 (stdout) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 464 tests, 10 stderr failures, 2 stdout failures, 0 post failures == exp-ptrcheck/tests/base (stderr) exp-ptrcheck/tests/ccc (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) memcheck/tests/file_locking (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/x86/scalar (stderr) none/tests/blockfault (stderr) none/tests/cmdline2 (stdout) none/tests/mremap2 (stdout) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Mon Sep 22 03:43:46 2008 --- new.short Mon Sep 22 04:09:29 2008 *************** *** 8,12 **** ! == 464 tests, 10 stderr failures, 2 stdout failures, 0 post failures == exp-ptrcheck/tests/base (stderr) exp-ptrcheck/tests/ccc (stderr) helgrind/tests/tc20_verifywrap (stderr) --- 8,13 ---- ! == 464 tests, 10 stderr failures, 3 stdout failures, 0 post failures == exp-ptrcheck/tests/base (stderr) exp-ptrcheck/tests/ccc (stderr) + helgrind/tests/tc08_hbl2 (stdout) helgrind/tests/tc20_verifywrap (stderr) |
|
From: Tom H. <th...@cy...> - 2008-09-22 02:49:08
|
Nightly build on trojan ( x86_64, Fedora Core 6 ) started at 2008-09-22 03:25:07 BST Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 462 tests, 13 stderr failures, 5 stdout failures, 0 post failures == exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/pth_create (stderr) exp-ptrcheck/tests/pth_specific (stderr) helgrind/tests/tc17_sembar (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) memcheck/tests/file_locking (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/vcpu_fnfns (stdout) memcheck/tests/x86/bug133694 (stdout) memcheck/tests/x86/bug133694 (stderr) memcheck/tests/x86/scalar (stderr) none/tests/blockfault (stderr) none/tests/cmdline1 (stdout) none/tests/cmdline2 (stdout) none/tests/mremap2 (stdout) |
|
From: Tom H. <th...@cy...> - 2008-09-22 02:32:14
|
Nightly build on gill ( x86_64, Fedora Core 2 ) started at 2008-09-22 03:00:09 BST Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 464 tests, 33 stderr failures, 4 stdout failures, 0 post failures == exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/hackedbz2 (stderr) helgrind/tests/hg01_all_ok (stderr) helgrind/tests/hg02_deadlock (stderr) helgrind/tests/hg03_inherit (stderr) helgrind/tests/hg04_race (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/tc01_simple_race (stderr) helgrind/tests/tc05_simple_race (stderr) helgrind/tests/tc06_two_races (stderr) helgrind/tests/tc09_bad_unlock (stderr) helgrind/tests/tc14_laog_dinphils (stderr) helgrind/tests/tc16_byterace (stderr) helgrind/tests/tc17_sembar (stderr) helgrind/tests/tc19_shadowmem (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) helgrind/tests/tc23_bogus_condwait (stderr) memcheck/tests/file_locking (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/origin5-bz2 (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/varinfo6 (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) none/tests/amd64/insn_ssse3 (stdout) none/tests/amd64/insn_ssse3 (stderr) none/tests/amd64/ssse3_misaligned (stderr) none/tests/blockfault (stderr) none/tests/cmdline2 (stdout) none/tests/fdleak_fcntl (stderr) none/tests/mremap2 (stdout) none/tests/x86/insn_ssse3 (stdout) none/tests/x86/insn_ssse3 (stderr) none/tests/x86/ssse3_misaligned (stderr) |
|
From: <sv...@va...> - 2008-09-21 20:51:48
|
Author: sewardj
Date: 2008-09-21 21:51:39 +0100 (Sun, 21 Sep 2008)
New Revision: 8633
Log:
Continue refactoring the code:
* move the definitions of Lock and Thread into hg_lock_n_thread.[ch]
* create hg_errors.[ch], to hold the error management stuff, although
so far they are empty.
Added:
branches/YARD/helgrind/hg_errors.c
branches/YARD/helgrind/hg_errors.h
branches/YARD/helgrind/hg_lock_n_thread.c
branches/YARD/helgrind/hg_lock_n_thread.h
Modified:
branches/YARD/helgrind/Makefile.am
branches/YARD/helgrind/hg_basics.c
branches/YARD/helgrind/hg_basics.h
branches/YARD/helgrind/hg_main.c
branches/YARD/helgrind/hg_wordset.c
branches/YARD/helgrind/libhb.h
branches/YARD/helgrind/libhb_core.c
Modified: branches/YARD/helgrind/Makefile.am
===================================================================
--- branches/YARD/helgrind/Makefile.am 2008-09-21 15:00:58 UTC (rev 8632)
+++ branches/YARD/helgrind/Makefile.am 2008-09-21 20:51:39 UTC (rev 8633)
@@ -71,7 +71,8 @@
$(LIBREPLACEMALLOC_LDFLAGS_PPC64_AIX5)
HELGRIND_SOURCES_COMMON = \
- hg_basics.c hg_wordset.c libhb_core.c hg_main.c
+ hg_basics.c hg_lock_n_thread.c hg_wordset.c libhb_core.c \
+ hg_errors.c hg_main.c
helgrind_x86_linux_SOURCES = $(HELGRIND_SOURCES_COMMON)
helgrind_x86_linux_CPPFLAGS = $(AM_CPPFLAGS_X86_LINUX)
@@ -119,6 +120,7 @@
hginclude_HEADERS = helgrind.h
-noinst_HEADERS = hg_basics.h hg_wordset.h
+noinst_HEADERS = \
+ hg_basics.h hg_lock_n_thread.h hg_errors.h hg_wordset.h
EXTRA_DIST = README_MSMProp2.txt README_YARD.txt
Modified: branches/YARD/helgrind/hg_basics.c
===================================================================
--- branches/YARD/helgrind/hg_basics.c 2008-09-21 15:00:58 UTC (rev 8632)
+++ branches/YARD/helgrind/hg_basics.c 2008-09-21 20:51:39 UTC (rev 8633)
@@ -37,6 +37,10 @@
#include "hg_basics.h" /* self */
+/*----------------------------------------------------------------*/
+/*--- Very basic stuff ---*/
+/*----------------------------------------------------------------*/
+
void* HG_(zalloc) ( HChar* cc, SizeT n )
{
void* p;
Modified: branches/YARD/helgrind/hg_basics.h
===================================================================
--- branches/YARD/helgrind/hg_basics.h 2008-09-21 15:00:58 UTC (rev 8632)
+++ branches/YARD/helgrind/hg_basics.h 2008-09-21 20:51:39 UTC (rev 8633)
@@ -33,12 +33,17 @@
#define __HG_BASICS_H
+/*----------------------------------------------------------------*/
+/*--- Very basic stuff ---*/
+/*----------------------------------------------------------------*/
+
#define HG_(str) VGAPPEND(vgHelgrind_,str)
void* HG_(zalloc) ( HChar* cc, SizeT n );
void HG_(free) ( void* p );
+
#endif /* ! __HG_BASICS_H */
/*--------------------------------------------------------------------*/
Added: branches/YARD/helgrind/hg_errors.c
===================================================================
--- branches/YARD/helgrind/hg_errors.c (rev 0)
+++ branches/YARD/helgrind/hg_errors.c 2008-09-21 20:51:39 UTC (rev 8633)
@@ -0,0 +1,43 @@
+
+/*--------------------------------------------------------------------*/
+/*--- Error management for Helgrind. ---*/
+/*--- hg_errors.c ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Helgrind, a Valgrind tool for detecting errors
+ in threaded programs.
+
+ Copyright (C) 2007-2008 OpenWorks Ltd
+ in...@op...
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#include "pub_tool_basics.h"
+#include "pub_tool_libcbase.h"
+#include "pub_tool_libcassert.h"
+#include "pub_tool_mallocfree.h"
+
+#include "hg_errors.h" /* self */
+
+
+
+/*--------------------------------------------------------------------*/
+/*--- end hg_errors.c ---*/
+/*--------------------------------------------------------------------*/
Added: branches/YARD/helgrind/hg_errors.h
===================================================================
--- branches/YARD/helgrind/hg_errors.h (rev 0)
+++ branches/YARD/helgrind/hg_errors.h 2008-09-21 20:51:39 UTC (rev 8633)
@@ -0,0 +1,41 @@
+
+/*--------------------------------------------------------------------*/
+/*--- Error management for Helgrind. ---*/
+/*--- hg_errors.h ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Helgrind, a Valgrind tool for detecting errors
+ in threaded programs.
+
+ Copyright (C) 2007-2008 OpenWorks Ltd
+ in...@op...
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#ifndef __HG_ERRORS_H
+#define __HG_ERRORS_H
+
+
+
+#endif /* ! __HG_ERRORS_H */
+
+/*--------------------------------------------------------------------*/
+/*--- end hg_errors.h ---*/
+/*--------------------------------------------------------------------*/
Added: branches/YARD/helgrind/hg_lock_n_thread.c
===================================================================
--- branches/YARD/helgrind/hg_lock_n_thread.c (rev 0)
+++ branches/YARD/helgrind/hg_lock_n_thread.c 2008-09-21 20:51:39 UTC (rev 8633)
@@ -0,0 +1,45 @@
+
+/*--------------------------------------------------------------------*/
+/*--- Definitions for Locks and Threads. ---*/
+/*--- hg_lock_n_thread.c ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Helgrind, a Valgrind tool for detecting errors
+ in threaded programs.
+
+ Copyright (C) 2007-2008 OpenWorks Ltd
+ in...@op...
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#include "pub_tool_basics.h"
+#include "pub_tool_libcbase.h"
+#include "pub_tool_libcassert.h"
+#include "pub_tool_execontext.h"
+#include "pub_tool_wordfm.h"
+
+#include "hg_basics.h"
+#include "hg_wordset.h"
+#include "hg_lock_n_thread.h" /* self */
+
+
+/*--------------------------------------------------------------------*/
+/*--- end hg_lock_n_thread.c ---*/
+/*--------------------------------------------------------------------*/
Added: branches/YARD/helgrind/hg_lock_n_thread.h
===================================================================
--- branches/YARD/helgrind/hg_lock_n_thread.h (rev 0)
+++ branches/YARD/helgrind/hg_lock_n_thread.h 2008-09-21 20:51:39 UTC (rev 8633)
@@ -0,0 +1,142 @@
+
+/*--------------------------------------------------------------------*/
+/*--- Definitions for Locks and Threads. ---*/
+/*--- hg_lock_n_thread.h ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Helgrind, a Valgrind tool for detecting errors
+ in threaded programs.
+
+ Copyright (C) 2007-2008 OpenWorks Ltd
+ in...@op...
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#ifndef __HG_LOCK_N_THREAD_H
+#define __HG_LOCK_N_THREAD_H
+
+
+/*----------------------------------------------------------------*/
+/*--- Primary data definitions ---*/
+/*----------------------------------------------------------------*/
+
+/* Magic numbers, for doing assertions that structures really are of
+ the right type. Useful as some of the code can get a bit
+ complex. */
+#define Thread_MAGIC 0x504fc5e5
+#define LockN_MAGIC 0x6545b557 /* normal nonpersistent locks */
+#define LockP_MAGIC 0x755b5456 /* persistent (copied) locks */
+
+
+/* These are handles for Word sets. CONSTRAINTS: must be (very) small
+ ints numbered from zero, since < 30-bit versions of them are used to
+ encode thread-sets and lock-sets in 32-bit shadow words. */
+typedef WordSet WordSetID;
+
+
+/* Synchronisation Objects, exported abstractly by libhb. */
+typedef struct _SO SO;
+
+/* Thr, libhb's private thread record, exported abstractly */
+typedef struct _Thr Thr;
+
+/* Stores information about a thread. Addresses of these also serve
+ as unique thread identifiers and so are never freed, so they should
+ be as small as possible. */
+typedef
+ struct _Thread {
+ /* ADMIN */
+ struct _Thread* admin;
+ UInt magic;
+ Thr* hbthr;
+ /* USEFUL */
+ WordSetID locksetA; /* WordSet of Lock* currently held by thread */
+ WordSetID locksetW; /* subset of locksetA held in w-mode */
+ /* EXPOSITION */
+ /* Place where parent was when this thread was created. */
+ ExeContext* created_at;
+ Bool announced;
+ /* Index for generating references in error messages. */
+ Int errmsg_index;
+ }
+ Thread;
+
+
+/* Stores information about a lock's current state. These are
+ allocated and later freed (when the containing memory becomes
+ NoAccess). This gives a problem for the XError type, which
+ contains Lock*s. Solution is to copy any Lock which is to be
+ incorporated into an XErrors, so as to make it independent from the
+ 'normal' collection of Locks, which can come and go. When the lock
+ is copied, its .magic is changed from LockN_Magic to
+ LockP_Magic. */
+
+/* Lock kinds. */
+typedef
+ enum {
+ LK_mbRec=1001, /* normal mutex, possibly recursive */
+ LK_nonRec, /* normal mutex, definitely non recursive */
+ LK_rdwr /* reader-writer lock */
+ }
+ LockKind;
+
+typedef
+ struct _Lock {
+ /* ADMIN */
+ struct _Lock* admin;
+ ULong unique; /* used for persistence-hashing */
+ UInt magic; /* LockN_MAGIC or LockP_MAGIC */
+ /* EXPOSITION */
+ /* Place where lock first came to the attention of Helgrind. */
+ ExeContext* appeared_at;
+ /* If the lock is held, place where the lock most recently made
+ an unlocked->locked transition. Must be sync'd with .heldBy:
+ either both NULL or both non-NULL. */
+ ExeContext* acquired_at;
+ /* USEFUL-STATIC */
+ SO* hbso; /* associated SO */
+ Addr guestaddr; /* Guest address of lock */
+ LockKind kind; /* what kind of lock this is */
+ /* USEFUL-DYNAMIC */
+ Bool heldW;
+ WordBag* heldBy; /* bag of threads that hold this lock */
+ /* .heldBy is NULL: lock is unheld, and .heldW is meaningless
+ but arbitrarily set to False
+ .heldBy is non-NULL:
+ .heldW is True: lock is w-held by threads in heldBy
+ .heldW is False: lock is r-held by threads in heldBy
+ Either way, heldBy may not validly be an empty Bag.
+
+ for LK_nonRec, r-holdings are not allowed, and w-holdings may
+ only have sizeTotal(heldBy) == 1
+
+ for LK_mbRec, r-holdings are not allowed, and w-holdings may
+ only have sizeUnique(heldBy) == 1
+
+ for LK_rdwr, w-holdings may only have sizeTotal(heldBy) == 1 */
+ }
+ Lock;
+
+
+#endif /* ! __HG_LOCK_N_THREAD_H */
+
+/*--------------------------------------------------------------------*/
+/*--- end hg_lock_n_thread.h ---*/
+/*--------------------------------------------------------------------*/
Modified: branches/YARD/helgrind/hg_main.c
===================================================================
--- branches/YARD/helgrind/hg_main.c 2008-09-21 15:00:58 UTC (rev 8632)
+++ branches/YARD/helgrind/hg_main.c 2008-09-21 20:51:39 UTC (rev 8633)
@@ -51,12 +51,14 @@
#include "pub_tool_wordfm.h"
#include "hg_basics.h"
-#include "helgrind.h"
-
#include "hg_wordset.h"
+#include "hg_lock_n_thread.h"
#include "libhb.h"
+#include "helgrind.h"
+
+
// FIXME: new_mem_w_tid ignores the supplied tid. (wtf?!)
// FIXME: when client destroys a lock or a CV, remove these
@@ -194,99 +196,9 @@
*/
/*----------------------------------------------------------------*/
-/*--- Primary data definitions ---*/
+/*--- Primary data structures ---*/
/*----------------------------------------------------------------*/
-/* Shadow values. */
-typedef UInt SVal;
-
-
-/* These are handles for Word sets. CONSTRAINTS: must be (very) small
- ints numbered from zero, since < 30-bit versions of them are used to
- encode thread-sets and lock-sets in 32-bit shadow words. */
-typedef WordSet WordSetID;
-
-
-/* Stores information about a thread. Addresses of these also serve
- as unique thread identifiers and so are never freed, so they should
- be as small as possible. */
-typedef
- struct _Thread {
- /* ADMIN */
- struct _Thread* admin;
- UInt magic;
- Thr* hbthr; /* in libhb; its .opaque points back here */
- /* USEFUL */
- WordSetID locksetA; /* WordSet of Lock* currently held by thread */
- WordSetID locksetW; /* subset of locksetA held in w-mode */
- /* EXPOSITION */
- /* Place where parent was when this thread was created. */
- ExeContext* created_at;
- Bool announced;
- /* Index for generating references in error messages. */
- Int errmsg_index;
- }
- Thread;
-
-
-/* Stores information about a lock's current state. These are
- allocated and later freed (when the containing memory becomes
- NoAccess). This gives a problem for the XError type, which
- contains Lock*s. Solution is to copy any Lock which is to be
- incorporated into an XErrors, so as to make it independent from the
- 'normal' collection of Locks, which can come and go. When the lock
- is copied, its .magic is changed from LockN_Magic to
- LockP_Magic. */
-
-/* Lock kinds. */
-typedef
- enum {
- LK_mbRec=1001, /* normal mutex, possibly recursive */
- LK_nonRec, /* normal mutex, definitely non recursive */
- LK_rdwr /* reader-writer lock */
- }
- LockKind;
-
-typedef
- struct _Lock {
- /* ADMIN */
- struct _Lock* admin;
- ULong unique; /* used for persistence-hashing */
- UInt magic; /* LockN_MAGIC or LockP_MAGIC */
- /* EXPOSITION */
- /* Place where lock first came to the attention of Helgrind. */
- ExeContext* appeared_at;
- /* If the lock is held, place where the lock most recently made
- an unlocked->locked transition. Must be sync'd with .heldBy:
- either both NULL or both non-NULL. */
- ExeContext* acquired_at;
- /* USEFUL-STATIC */
- SO* hbso; /* associated SO */
- Addr guestaddr; /* Guest address of lock */
- LockKind kind; /* what kind of lock this is */
- /* USEFUL-DYNAMIC */
- Bool heldW;
- WordBag* heldBy; /* bag of threads that hold this lock */
- /* .heldBy is NULL: lock is unheld, and .heldW is meaningless
- but arbitrarily set to False
- .heldBy is non-NULL:
- .heldW is True: lock is w-held by threads in heldBy
- .heldW is False: lock is r-held by threads in heldBy
- Either way, heldBy may not validly be an empty Bag.
-
- for LK_nonRec, r-holdings are not allowed, and w-holdings may
- only have sizeTotal(heldBy) == 1
-
- for LK_mbRec, r-holdings are not allowed, and w-holdings may
- only have sizeUnique(heldBy) == 1
-
- for LK_rdwr, w-holdings may only have sizeTotal(heldBy) == 1 */
- }
- Lock;
-
-
-/* --------- Primary data structures --------- */
-
/* Admin linked list of Threads */
static Thread* admin_threads = NULL;
@@ -320,11 +232,6 @@
static ThreadId map_threads_maybe_reverse_lookup_SLOW ( Thread* ); /*fwds*/
-#define Thread_MAGIC 0x504fc5e5
-#define LockN_MAGIC 0x6545b557 /* normal nonpersistent locks */
-#define LockP_MAGIC 0x755b5456 /* persistent (copied) locks */
-#define SecMap_MAGIC 0x571e58cb
-
static UWord stats__mk_Segment = 0;
/* --------- Constructors --------- */
@@ -1151,7 +1058,6 @@
/* fwds */
static void record_error_Race ( Thread* thr,
Addr data_addr, Bool isWrite, Int szB,
- SVal old_sv, SVal new_sv,
ExeContext* mb_lastlock,
ExeContext* mb_confacc,
Thread* mb_confaccthr );
@@ -1316,7 +1222,7 @@
tl_assert(hbthr);
if (libhb_read(&ri, hbthr, a, len)) {
Thread* confthr = ri.thrp ? libhb_get_Thr_opaque( ri.thrp ) : NULL;
- record_error_Race( thr, ri.a, ri.isW, ri.szB, 0,0,NULL,
+ record_error_Race( thr, ri.a, ri.isW, ri.szB, NULL,
(ExeContext*)ri.wherep, confthr );
}
}
@@ -1327,7 +1233,7 @@
tl_assert(hbthr);
if (libhb_write(&ri, hbthr, a, len)) {
Thread* confthr = ri.thrp ? libhb_get_Thr_opaque( ri.thrp ) : NULL;
- record_error_Race( thr, ri.a, ri.isW, ri.szB, 0,0,NULL,
+ record_error_Race( thr, ri.a, ri.isW, ri.szB, NULL,
(ExeContext*)ri.wherep, confthr );
}
}
@@ -1996,7 +1902,7 @@
Thr* hbthr = thr->hbthr;
if (libhb_read(&ri, hbthr, a, 1)) {
Thread* confthr = ri.thrp ? libhb_get_Thr_opaque( ri.thrp ) : NULL;
- record_error_Race( thr, ri.a, ri.isW, ri.szB, 0,0,NULL,
+ record_error_Race( thr, ri.a, ri.isW, ri.szB, NULL,
(ExeContext*)ri.wherep, confthr );
}
}
@@ -2008,7 +1914,7 @@
Thr* hbthr = thr->hbthr;
if (libhb_read(&ri, hbthr, a, 2)) {
Thread* confthr = ri.thrp ? libhb_get_Thr_opaque( ri.thrp ) : NULL;
- record_error_Race( thr, ri.a, ri.isW, ri.szB, 0,0,NULL,
+ record_error_Race( thr, ri.a, ri.isW, ri.szB, NULL,
(ExeContext*)ri.wherep, confthr );
}
}
@@ -2020,7 +1926,7 @@
Thr* hbthr = thr->hbthr;
if (libhb_read(&ri, hbthr, a, 4)) {
Thread* confthr = ri.thrp ? libhb_get_Thr_opaque( ri.thrp ) : NULL;
- record_error_Race( thr, ri.a, ri.isW, ri.szB, 0,0,NULL,
+ record_error_Race( thr, ri.a, ri.isW, ri.szB, NULL,
(ExeContext*)ri.wherep, confthr );
}
}
@@ -2032,7 +1938,7 @@
Thr* hbthr = thr->hbthr;
if (libhb_read(&ri, hbthr, a, 8)) {
Thread* confthr = ri.thrp ? libhb_get_Thr_opaque( ri.thrp ) : NULL;
- record_error_Race( thr, ri.a, ri.isW, ri.szB, 0,0,NULL,
+ record_error_Race( thr, ri.a, ri.isW, ri.szB, NULL,
(ExeContext*)ri.wherep, confthr );
}
}
@@ -2044,7 +1950,7 @@
Thr* hbthr = thr->hbthr;
if (libhb_read(&ri, hbthr, a, size)) {
Thread* confthr = ri.thrp ? libhb_get_Thr_opaque( ri.thrp ) : NULL;
- record_error_Race( thr, ri.a, ri.isW, ri.szB, 0,0,NULL,
+ record_error_Race( thr, ri.a, ri.isW, ri.szB, NULL,
(ExeContext*)ri.wherep, confthr );
}
}
@@ -2056,7 +1962,7 @@
Thr* hbthr = thr->hbthr;
if (libhb_write(&ri, hbthr, a, 1)) {
Thread* confthr = ri.thrp ? libhb_get_Thr_opaque( ri.thrp ) : NULL;
- record_error_Race( thr, ri.a, ri.isW, ri.szB, 0,0,NULL,
+ record_error_Race( thr, ri.a, ri.isW, ri.szB, NULL,
(ExeContext*)ri.wherep, confthr );
}
}
@@ -2068,7 +1974,7 @@
Thr* hbthr = thr->hbthr;
if (libhb_write(&ri, hbthr, a, 2)) {
Thread* confthr = ri.thrp ? libhb_get_Thr_opaque( ri.thrp ) : NULL;
- record_error_Race( thr, ri.a, ri.isW, ri.szB, 0,0,NULL,
+ record_error_Race( thr, ri.a, ri.isW, ri.szB, NULL,
(ExeContext*)ri.wherep, confthr );
}
}
@@ -2080,7 +1986,7 @@
Thr* hbthr = thr->hbthr;
if (libhb_write(&ri, hbthr, a, 4)) {
Thread* confthr = ri.thrp ? libhb_get_Thr_opaque( ri.thrp ) : NULL;
- record_error_Race( thr, ri.a, ri.isW, ri.szB, 0,0,NULL,
+ record_error_Race( thr, ri.a, ri.isW, ri.szB, NULL,
(ExeContext*)ri.wherep, confthr );
}
}
@@ -2092,7 +1998,7 @@
Thr* hbthr = thr->hbthr;
if (libhb_write(&ri, hbthr, a, 8)) {
Thread* confthr = ri.thrp ? libhb_get_Thr_opaque( ri.thrp ) : NULL;
- record_error_Race( thr, ri.a, ri.isW, ri.szB, 0,0,NULL,
+ record_error_Race( thr, ri.a, ri.isW, ri.szB, NULL,
(ExeContext*)ri.wherep, confthr );
}
}
@@ -2104,7 +2010,7 @@
Thr* hbthr = thr->hbthr;
if (libhb_write(&ri, hbthr, a, size)) {
Thread* confthr = ri.thrp ? libhb_get_Thr_opaque( ri.thrp ) : NULL;
- record_error_Race( thr, ri.a, ri.isW, ri.szB, 0,0,NULL,
+ record_error_Race( thr, ri.a, ri.isW, ri.szB, NULL,
(ExeContext*)ri.wherep, confthr );
}
}
@@ -4099,8 +4005,6 @@
Addr data_addr;
Int szB;
Bool isWrite;
- SVal new_state;
- SVal old_state;
ExeContext* mb_lastlock;
ExeContext* mb_confacc;
Thread* thr;
@@ -4199,7 +4103,6 @@
static void record_error_Race ( Thread* thr,
Addr data_addr, Bool isWrite, Int szB,
- SVal old_sv, SVal new_sv,
ExeContext* mb_lastlock,
ExeContext* mb_confacc,
Thread* mb_confaccthr ) {
@@ -4225,8 +4128,6 @@
xe.XE.Race.data_addr = data_addr;
xe.XE.Race.szB = szB;
xe.XE.Race.isWrite = isWrite;
- xe.XE.Race.new_state = new_sv;
- xe.XE.Race.old_state = old_sv;
xe.XE.Race.mb_lastlock = mb_lastlock;
xe.XE.Race.mb_confacc = mb_confacc;
xe.XE.Race.thr = thr;
Modified: branches/YARD/helgrind/hg_wordset.c
===================================================================
--- branches/YARD/helgrind/hg_wordset.c 2008-09-21 15:00:58 UTC (rev 8632)
+++ branches/YARD/helgrind/hg_wordset.c 2008-09-21 20:51:39 UTC (rev 8633)
@@ -41,7 +41,7 @@
#include "pub_tool_wordfm.h"
#include "hg_basics.h"
-#include "hg_wordset.h"
+#include "hg_wordset.h" /* self */
//------------------------------------------------------------------//
//--- Word Cache ---//
Modified: branches/YARD/helgrind/libhb.h
===================================================================
--- branches/YARD/helgrind/libhb.h 2008-09-21 15:00:58 UTC (rev 8632)
+++ branches/YARD/helgrind/libhb.h 2008-09-21 20:51:39 UTC (rev 8633)
@@ -32,10 +32,10 @@
#define __LIBHB_H
/* Abstract to user: thread identifiers */
-typedef struct _Thr Thr;
+/* typedef struct _Thr Thr; */ /* now in hg_lock_n_thread.h */
/* Abstract to user: synchronisation objects */
-typedef struct _SO SO;
+/* typedef struct _SO SO; */ /* now in hg_lock_n_thread.h */
/* Abstract to the lib: execution contexts */
/* struct _EC will be defined by user at some point. */
Modified: branches/YARD/helgrind/libhb_core.c
===================================================================
--- branches/YARD/helgrind/libhb_core.c 2008-09-21 15:00:58 UTC (rev 8632)
+++ branches/YARD/helgrind/libhb_core.c 2008-09-21 20:51:39 UTC (rev 8633)
@@ -41,8 +41,12 @@
#include "pub_tool_xarray.h"
#include "pub_tool_oset.h"
#include "pub_tool_aspacemgr.h"
+#include "pub_tool_execontext.h"
#include "hg_basics.h"
+#include "hg_wordset.h"
+#include "hg_lock_n_thread.h"
+
#include "libhb.h"
|
|
From: <sv...@va...> - 2008-09-21 15:01:07
|
Author: bart
Date: 2008-09-21 16:00:58 +0100 (Sun, 21 Sep 2008)
New Revision: 8632
Log:
Don't trust the result reported by pkg-config about QtCore, but try whether linking succeeds. This additional test is necessary when running configure with the flag --enable-only32bit.
Modified:
trunk/configure.in
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2008-09-21 11:24:00 UTC (rev 8631)
+++ trunk/configure.in 2008-09-21 15:00:58 UTC (rev 8632)
@@ -1436,7 +1436,25 @@
[QtCore],
[
PKG_CHECK_MODULES([QTCORE], [QtCore])
- ac_have_qtcore=yes
+ # Paranoia: don't trust the result reported by pkg-config, but when
+ # pkg-config reports that QtCore has been found, verify whether linking
+ # programs with QtCore succeeds.
+ AC_LANG(C++)
+ safe_CXXFLAGS="${CXXFLAGS}"
+ CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS}"
+ if test x$vg_cv_only32bit = xyes; then
+ CXXFLAGS="${CXXFLAGS} -m32"
+ fi
+ AC_TRY_LINK(
+ [#include <QMutex>],
+ [QMutex Mutex;],
+ [ac_have_qtcore=yes],
+ [
+ AC_MSG_WARN([Although pkg-config detected Qt4, linking Qt4 programs fails. Skipping Qt4.])
+ ac_have_qtcore=no
+ ]
+ )
+ CXXFLAGS="${safe_CXXFLAGS}"
],
[
ac_have_qtcore=no
@@ -1457,7 +1475,7 @@
AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)])
AC_LANG(C++)
safe_CXXFLAGS="${CXXFLAGS}"
- CXXFLAGS="${pkg_cv_QTCORE_CFLAGS}"
+ CXXFLAGS="${QTCORE_CFLAGS}"
AC_TRY_COMPILE([
#include <QtCore/QMutex>
],
|
|
From: <sv...@va...> - 2008-09-21 11:24:05
|
Author: bart Date: 2008-09-21 12:24:00 +0100 (Sun, 21 Sep 2008) New Revision: 8631 Log: Made test for compiler atomic builtins more strict, such that drd/tests/atomic_var.c doesn't trigger bug http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34115 in a.o. gcc 4.3.1 when Valgrind is configured with --enable-only32bit. Modified: trunk/configure.in Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2008-09-21 11:21:23 UTC (rev 8630) +++ trunk/configure.in 2008-09-21 11:24:00 UTC (rev 8631) @@ -1154,7 +1154,8 @@ AC_TRY_LINK(, [ int variable = 1; - return __sync_bool_compare_and_swap(&variable, 1, 2) ? 1 : 0 + return (__sync_bool_compare_and_swap(&variable, 1, 2) + && __sync_add_and_fetch(&variable, 1) ? 1 : 0 ], [ AC_MSG_RESULT([yes]) |
|
From: <sv...@va...> - 2008-09-21 11:21:30
|
Author: bart
Date: 2008-09-21 12:21:23 +0100 (Sun, 21 Sep 2008)
New Revision: 8630
Log:
Renamed __sync_add_and_fetch() into sync_add_and_fetch().
Modified:
trunk/drd/tests/atomic_var.c
Modified: trunk/drd/tests/atomic_var.c
===================================================================
--- trunk/drd/tests/atomic_var.c 2008-09-21 09:31:15 UTC (rev 8629)
+++ trunk/drd/tests/atomic_var.c 2008-09-21 11:21:23 UTC (rev 8630)
@@ -15,10 +15,16 @@
/** Only gcc 4.1.0 and later have atomic builtins. */
-#ifndef HAVE_BUILTIN_ATOMIC
+#if defined(HAVE_BUILTIN_ATOMIC)
static __inline__
-int __sync_add_and_fetch(int* p, int i)
+int sync_add_and_fetch(int* p, int i)
{
+ return __sync_add_and_fetch(p, i);
+}
+#else
+static __inline__
+int sync_add_and_fetch(int* p, int i)
+{
if (i == 0)
return *p;
return (*p += i);
@@ -35,13 +41,13 @@
static void* thread_func_1(void* arg)
{
s_y = 1;
- (void) __sync_add_and_fetch(&s_x, 1);
+ (void) sync_add_and_fetch(&s_x, 1);
return 0;
}
static void* thread_func_2(void* arg)
{
- while (__sync_add_and_fetch(&s_x, 0) == 0)
+ while (sync_add_and_fetch(&s_x, 0) == 0)
;
fprintf(stderr, "y = %d\n", s_y);
return 0;
|
|
From: <sv...@va...> - 2008-09-21 09:31:30
|
Author: sewardj
Date: 2008-09-21 10:31:15 +0100 (Sun, 21 Sep 2008)
New Revision: 8629
Log:
libhb_core.c: call HG_(malloc), HG_(free) and shmem__bigchunk_alloc
directly, instead of via function pointers supplied at startup. Tidy
up accordingly.
Modified:
branches/YARD/helgrind/hg_basics.c
branches/YARD/helgrind/hg_basics.h
branches/YARD/helgrind/hg_main.c
branches/YARD/helgrind/libhb.h
branches/YARD/helgrind/libhb_core.c
branches/YARD/include/pub_tool_libcbase.h
Modified: branches/YARD/helgrind/hg_basics.c
===================================================================
--- branches/YARD/helgrind/hg_basics.c 2008-09-21 00:58:00 UTC (rev 8628)
+++ branches/YARD/helgrind/hg_basics.c 2008-09-21 09:31:15 UTC (rev 8629)
@@ -29,7 +29,31 @@
The GNU General Public License is contained in the file COPYING.
*/
+#include "pub_tool_basics.h"
+#include "pub_tool_libcbase.h"
+#include "pub_tool_libcassert.h"
+#include "pub_tool_mallocfree.h"
+#include "hg_basics.h" /* self */
+
+
+void* HG_(zalloc) ( HChar* cc, SizeT n )
+{
+ void* p;
+ tl_assert(n > 0);
+ p = VG_(malloc)( cc, n );
+ tl_assert(p);
+ VG_(memset)(p, 0, n);
+ return p;
+}
+
+void HG_(free) ( void* p )
+{
+ tl_assert(p);
+ VG_(free)(p);
+}
+
+
/*--------------------------------------------------------------------*/
/*--- end hg_basics.c ---*/
/*--------------------------------------------------------------------*/
Modified: branches/YARD/helgrind/hg_basics.h
===================================================================
--- branches/YARD/helgrind/hg_basics.h 2008-09-21 00:58:00 UTC (rev 8628)
+++ branches/YARD/helgrind/hg_basics.h 2008-09-21 09:31:15 UTC (rev 8629)
@@ -32,8 +32,13 @@
#ifndef __HG_BASICS_H
#define __HG_BASICS_H
+
#define HG_(str) VGAPPEND(vgHelgrind_,str)
+void* HG_(zalloc) ( HChar* cc, SizeT n );
+void HG_(free) ( void* p );
+
+
#endif /* ! __HG_BASICS_H */
/*--------------------------------------------------------------------*/
Modified: branches/YARD/helgrind/hg_main.c
===================================================================
--- branches/YARD/helgrind/hg_main.c 2008-09-21 00:58:00 UTC (rev 8628)
+++ branches/YARD/helgrind/hg_main.c 2008-09-21 09:31:15 UTC (rev 8629)
@@ -35,7 +35,6 @@
*/
#include "pub_tool_basics.h"
-#include "pub_tool_aspacemgr.h"
#include "pub_tool_libcassert.h"
#include "pub_tool_libcbase.h"
#include "pub_tool_libcprint.h"
@@ -195,29 +194,6 @@
*/
/*----------------------------------------------------------------*/
-/*--- Some very basic stuff ---*/
-/*----------------------------------------------------------------*/
-
-static void* hg_zalloc ( HChar* cc, SizeT n ) {
- void* p;
- tl_assert(n > 0);
- p = VG_(malloc)( cc, n );
- tl_assert(p);
- VG_(memset)(p, 0, n);
- return p;
-}
-static void hg_free ( void* p ) {
- tl_assert(p);
- VG_(free)(p);
-}
-
-/* Round a up to the next multiple of N. N must be a power of 2 */
-#define ROUNDUP(a, N) ((a + N - 1) & ~(N-1))
-/* Round a down to the next multiple of N. N must be a power of 2 */
-#define ROUNDDN(a, N) ((a) & ~(N-1))
-
-
-/*----------------------------------------------------------------*/
/*--- Primary data definitions ---*/
/*----------------------------------------------------------------*/
@@ -357,7 +333,7 @@
static Thread* mk_Thread ( Thr* hbthr ) {
static Int indx = 1;
- Thread* thread = hg_zalloc( "hg.mk_Thread.1", sizeof(Thread) );
+ Thread* thread = HG_(zalloc)( "hg.mk_Thread.1", sizeof(Thread) );
thread->locksetA = HG_(emptyWS)( univ_lsets );
thread->locksetW = HG_(emptyWS)( univ_lsets );
thread->magic = Thread_MAGIC;
@@ -373,7 +349,7 @@
// Make a new lock which is unlocked (hence ownerless)
static Lock* mk_LockN ( LockKind kind, Addr guestaddr ) {
static ULong unique = 0;
- Lock* lock = hg_zalloc( "hg.mk_Lock.1", sizeof(Lock) );
+ Lock* lock = HG_(zalloc)( "hg.mk_Lock.1", sizeof(Lock) );
lock->admin = admin_locks;
lock->unique = unique++;
lock->magic = LockN_MAGIC;
@@ -467,7 +443,7 @@
if (lk->heldBy)
VG_(deleteBag)( lk->heldBy );
VG_(memset)(lk, 0xAA, sizeof(*lk));
- hg_free(lk);
+ HG_(free)(lk);
}
/* Update 'lk' to reflect that 'thr' now has a write-acquisition of
@@ -500,7 +476,7 @@
tl_assert(lk->heldBy == NULL); /* can't w-lock recursively */
tl_assert(!lk->heldW);
lk->heldW = True;
- lk->heldBy = VG_(newBag)( hg_zalloc, "hg.lNaw.1", hg_free );
+ lk->heldBy = VG_(newBag)( HG_(zalloc), "hg.lNaw.1", HG_(free) );
VG_(addToBag)( lk->heldBy, (Word)thr );
break;
case LK_mbRec:
@@ -554,7 +530,7 @@
VG_(addToBag)(lk->heldBy, (Word)thr);
} else {
lk->heldW = False;
- lk->heldBy = VG_(newBag)( hg_zalloc, "hg.lNar.1", hg_free );
+ lk->heldBy = VG_(newBag)( HG_(zalloc), "hg.lNar.1", HG_(free) );
VG_(addToBag)( lk->heldBy, (Word)thr );
}
tl_assert(!lk->heldW);
@@ -801,12 +777,12 @@
tl_assert(sizeof(Addr) == sizeof(Word));
tl_assert(map_threads == NULL);
- map_threads = hg_zalloc( "hg.ids.1", VG_N_THREADS * sizeof(Thread*) );
+ map_threads = HG_(zalloc)( "hg.ids.1", VG_N_THREADS * sizeof(Thread*) );
tl_assert(map_threads != NULL);
tl_assert(sizeof(Addr) == sizeof(Word));
tl_assert(map_locks == NULL);
- map_locks = VG_(newFM)( hg_zalloc, "hg.ids.2", hg_free,
+ map_locks = VG_(newFM)( HG_(zalloc), "hg.ids.2", HG_(free),
NULL/*unboxed Word cmp*/);
tl_assert(map_locks != NULL);
@@ -815,18 +791,18 @@
VG_(addToFM)( map_locks, (Word)&__bus_lock, (Word)__bus_lock_Lock );
tl_assert(univ_tsets == NULL);
- univ_tsets = HG_(newWordSetU)( hg_zalloc, "hg.ids.3", hg_free,
+ univ_tsets = HG_(newWordSetU)( HG_(zalloc), "hg.ids.3", HG_(free),
8/*cacheSize*/ );
tl_assert(univ_tsets != NULL);
tl_assert(univ_lsets == NULL);
- univ_lsets = HG_(newWordSetU)( hg_zalloc, "hg.ids.4", hg_free,
+ univ_lsets = HG_(newWordSetU)( HG_(zalloc), "hg.ids.4", HG_(free),
8/*cacheSize*/ );
tl_assert(univ_lsets != NULL);
tl_assert(univ_laog == NULL);
- univ_laog = HG_(newWordSetU)( hg_zalloc, "hg.ids.5 (univ_laog)",
- hg_free, 24/*cacheSize*/ );
+ univ_laog = HG_(newWordSetU)( HG_(zalloc), "hg.ids.5 (univ_laog)",
+ HG_(free), 24/*cacheSize*/ );
tl_assert(univ_laog != NULL);
/* Set up entries for the root thread */
@@ -969,39 +945,6 @@
/*----------------------------------------------------------------*/
-/*--- map_shmem :: WordFM Addr SecMap ---*/
-/*--- shadow memory (low level handlers) (shmem__* fns) ---*/
-/*----------------------------------------------------------------*/
-
-/*--------------- SecMap allocation --------------- */
-
-static HChar* shmem__bigchunk_next = NULL;
-static HChar* shmem__bigchunk_end1 = NULL;
-
-static void* shmem__bigchunk_alloc ( SizeT n )
-{
- const SizeT sHMEM__BIGCHUNK_SIZE = 4096 * 256 * 4;
- tl_assert(n > 0);
- n = ROUNDUP(n, 16);
- tl_assert(shmem__bigchunk_next <= shmem__bigchunk_end1);
- tl_assert(shmem__bigchunk_end1 - shmem__bigchunk_next
- <= (SSizeT)sHMEM__BIGCHUNK_SIZE);
- if (shmem__bigchunk_next + n > shmem__bigchunk_end1) {
- if (0)
- VG_(printf)("XXXXX bigchunk: abandoning %d bytes\n",
- (Int)(shmem__bigchunk_end1 - shmem__bigchunk_next));
- shmem__bigchunk_next = VG_(am_shadow_alloc)( sHMEM__BIGCHUNK_SIZE );
- shmem__bigchunk_end1 = shmem__bigchunk_next + sHMEM__BIGCHUNK_SIZE;
- }
- tl_assert(shmem__bigchunk_next);
- tl_assert( 0 == (((Addr)shmem__bigchunk_next) & (16-1)) );
- tl_assert(shmem__bigchunk_next + n <= shmem__bigchunk_end1);
- shmem__bigchunk_next += n;
- return shmem__bigchunk_next - n;
-}
-
-
-/*----------------------------------------------------------------*/
/*--- Sanity checking the data structures ---*/
/*----------------------------------------------------------------*/
@@ -1326,7 +1269,7 @@
HG_(cardinalityWS)( univ_lsets, lset_old), lk );
if (lk->appeared_at) {
if (ga_to_lastlock == NULL)
- ga_to_lastlock = VG_(newFM)( hg_zalloc, "hg.rlll.1", hg_free, NULL );
+ ga_to_lastlock = VG_(newFM)( HG_(zalloc), "hg.rlll.1", HG_(free), NULL );
VG_(addToFM)( ga_to_lastlock, ga_of_access, (Word)lk->appeared_at );
stats__ga_LL_adds++;
}
@@ -2343,7 +2286,7 @@
static void map_cond_to_SO_INIT ( void ) {
if (UNLIKELY(map_cond_to_SO == NULL)) {
- map_cond_to_SO = VG_(newFM)( hg_zalloc, "hg.mctSI.1", hg_free, NULL );
+ map_cond_to_SO = VG_(newFM)( HG_(zalloc), "hg.mctSI.1", HG_(free), NULL );
tl_assert(map_cond_to_SO != NULL);
}
}
@@ -2676,8 +2619,8 @@
static void map_sem_to_SO_stack_INIT ( void ) {
if (map_sem_to_SO_stack == NULL) {
- map_sem_to_SO_stack = VG_(newFM)( hg_zalloc, "hg.mstSs.1",
- hg_free, NULL );
+ map_sem_to_SO_stack = VG_(newFM)( HG_(zalloc), "hg.mstSs.1",
+ HG_(free), NULL );
tl_assert(map_sem_to_SO_stack != NULL);
}
}
@@ -2693,7 +2636,7 @@
tl_assert(xa);
VG_(addToXA)( xa, &so );
} else {
- xa = VG_(newXA)( hg_zalloc, "hg.pSfs.1", hg_free, sizeof(SO*) );
+ xa = VG_(newXA)( HG_(zalloc), "hg.pSfs.1", HG_(free), sizeof(SO*) );
VG_(addToXA)( xa, &so );
VG_(addToFM)( map_sem_to_SO_stack, (Word)sem, (Word)xa );
}
@@ -2983,7 +2926,7 @@
presentF = outs_new == links->outs;
links->outs = outs_new;
} else {
- links = hg_zalloc("hg.lae.1", sizeof(LAOGLinks));
+ links = HG_(zalloc)("hg.lae.1", sizeof(LAOGLinks));
links->inns = HG_(emptyWS)( univ_laog );
links->outs = HG_(singletonWS)( univ_laog, (Word)dst );
VG_(addToFM)( laog, (Word)src, (Word)links );
@@ -2999,7 +2942,7 @@
presentR = inns_new == links->inns;
links->inns = inns_new;
} else {
- links = hg_zalloc("hg.lae.2", sizeof(LAOGLinks));
+ links = HG_(zalloc)("hg.lae.2", sizeof(LAOGLinks));
links->inns = HG_(singletonWS)( univ_laog, (Word)src );
links->outs = HG_(emptyWS)( univ_laog );
VG_(addToFM)( laog, (Word)dst, (Word)links );
@@ -3024,7 +2967,7 @@
if (VG_(lookupFM)( laog_exposition, NULL, NULL, (Word)&expo )) {
/* we already have it; do nothing */
} else {
- LAOGLinkExposition* expo2 = hg_zalloc("hg.lae.3",
+ LAOGLinkExposition* expo2 = HG_(zalloc)("hg.lae.3",
sizeof(LAOGLinkExposition));
expo2->src_ga = src->guestaddr;
expo2->dst_ga = dst->guestaddr;
@@ -3154,8 +3097,8 @@
return NULL;
ret = NULL;
- stack = VG_(newXA)( hg_zalloc, "hg.lddft.1", hg_free, sizeof(Lock*) );
- visited = VG_(newFM)( hg_zalloc, "hg.lddft.2", hg_free, NULL/*unboxedcmp*/ );
+ stack = VG_(newXA)( HG_(zalloc), "hg.lddft.1", HG_(free), sizeof(Lock*) );
+ visited = VG_(newFM)( HG_(zalloc), "hg.lddft.2", HG_(free), NULL/*unboxedcmp*/ );
(void) VG_(addToXA)( stack, &src );
@@ -3208,10 +3151,10 @@
return;
if (!laog)
- laog = VG_(newFM)( hg_zalloc, "hg.lptal.1",
- hg_free, NULL/*unboxedcmp*/ );
+ laog = VG_(newFM)( HG_(zalloc), "hg.lptal.1",
+ HG_(free), NULL/*unboxedcmp*/ );
if (!laog_exposition)
- laog_exposition = VG_(newFM)( hg_zalloc, "hg.lptal.2", hg_free,
+ laog_exposition = VG_(newFM)( HG_(zalloc), "hg.lptal.2", HG_(free),
cmp_LAOGLinkExposition );
/* First, the check. Complain if there is any path in laog from lk
@@ -3317,9 +3260,9 @@
UWord* ws_words;
if (!laog)
- laog = VG_(newFM)( hg_zalloc, "hg.lhld.1", hg_free, NULL/*unboxedcmp*/ );
+ laog = VG_(newFM)( HG_(zalloc), "hg.lhld.1", HG_(free), NULL/*unboxedcmp*/ );
if (!laog_exposition)
- laog_exposition = VG_(newFM)( hg_zalloc, "hg.lhld.2", hg_free,
+ laog_exposition = VG_(newFM)( HG_(zalloc), "hg.lhld.2", HG_(free),
cmp_LAOGLinkExposition );
HG_(getPayloadWS)( &ws_words, &ws_size, univ_lsets, locksToDelete );
@@ -3351,12 +3294,12 @@
static MallocMeta* new_MallocMeta ( void ) {
- MallocMeta* md = hg_zalloc( "hg.new_MallocMeta.1", sizeof(MallocMeta) );
+ MallocMeta* md = HG_(zalloc)( "hg.new_MallocMeta.1", sizeof(MallocMeta) );
tl_assert(md);
return md;
}
static void delete_MallocMeta ( MallocMeta* md ) {
- hg_free(md);
+ HG_(free)(md);
}
@@ -3813,8 +3756,8 @@
static void map_pthread_t_to_Thread_INIT ( void ) {
if (UNLIKELY(map_pthread_t_to_Thread == NULL)) {
- map_pthread_t_to_Thread = VG_(newFM)( hg_zalloc, "hg.mpttT.1",
- hg_free, NULL );
+ map_pthread_t_to_Thread = VG_(newFM)( HG_(zalloc), "hg.mpttT.1",
+ HG_(free), NULL );
tl_assert(map_pthread_t_to_Thread != NULL);
}
}
@@ -4059,8 +4002,8 @@
if (!str)
str = "(null)";
if (!string_table) {
- string_table = VG_(newFM)( hg_zalloc, "hg.sts.1",
- hg_free, string_table_cmp );
+ string_table = VG_(newFM)( HG_(zalloc), "hg.sts.1",
+ HG_(free), string_table_cmp );
tl_assert(string_table);
}
if (VG_(lookupFM)( string_table,
@@ -4095,11 +4038,11 @@
stats__ga_LockN_to_P_queries++;
tl_assert( is_sane_LockN(lkn) );
if (!yaWFM) {
- yaWFM = VG_(newFM)( hg_zalloc, "hg.mLPfLN.1", hg_free, lock_unique_cmp );
+ yaWFM = VG_(newFM)( HG_(zalloc), "hg.mLPfLN.1", HG_(free), lock_unique_cmp );
tl_assert(yaWFM);
}
if (!VG_(lookupFM)( yaWFM, NULL, (Word*)&lkp, (Word)lkn)) {
- lkp = hg_zalloc( "hg.mLPfLN.2", sizeof(Lock) );
+ lkp = HG_(zalloc)( "hg.mLPfLN.2", sizeof(Lock) );
*lkp = *lkn;
lkp->admin = NULL;
lkp->magic = LockP_MAGIC;
@@ -4454,7 +4397,7 @@
errmsg_index fields. This is for printing out thread sets in
repeatable orders, which is important for for repeatable regression
testing. The returned XArray* is dynamically allocated (of course)
- and so must be hg_freed by the caller. */
+ and so must be HG_(free)d by the caller. */
static Int cmp_Thread_by_errmsg_index ( void* thr1V, void* thr2V ) {
Thread* thr1 = *(Thread**)thr1V;
Thread* thr2 = *(Thread**)thr2V;
@@ -4467,7 +4410,7 @@
XArray* xa;
UWord* ts_words;
UWord ts_size, i;
- xa = VG_(newXA)( hg_zalloc, "hg.cTbei.1", hg_free, sizeof(Thread*) );
+ xa = VG_(newXA)( HG_(zalloc), "hg.cTbei.1", HG_(free), sizeof(Thread*) );
tl_assert(xa);
HG_(getPayloadWS)( &ts_words, &ts_size, univ_tsets, tset );
tl_assert(ts_words);
@@ -5083,8 +5026,7 @@
VG_(track_stop_client_code)( evh__stop_client_code );
/////////////////////////////////////////////
- hbthr_root = libhb_init( hg_zalloc, hg_free, shmem__bigchunk_alloc,
- for_libhb__get_stacktrace,
+ hbthr_root = libhb_init( for_libhb__get_stacktrace,
for_libhb__stacktrace_to_EC,
for_libhb__get_EC );
/////////////////////////////////////////////
Modified: branches/YARD/helgrind/libhb.h
===================================================================
--- branches/YARD/helgrind/libhb.h 2008-09-21 00:58:00 UTC (rev 8628)
+++ branches/YARD/helgrind/libhb.h 2008-09-21 09:31:15 UTC (rev 8629)
@@ -48,13 +48,10 @@
Thr* thrp; struct EC_* wherep; }
RaceInfo;
-/* Initialise library; returns Thr* for root thread. 'alloc' and
- 'shadow_alloc' should never return NULL, instead they should simply
- not return if they encounter an out-of-memory condition. */
+/* Initialise library; returns Thr* for root thread. 'shadow_alloc'
+ should never return NULL, instead it should simply not return if
+ they encounter an out-of-memory condition. */
Thr* libhb_init (
- void* (*zalloc)( HChar*, SizeT ),
- void (*dealloc)( void* ),
- void* (*shadow_alloc)( SizeT ),
void (*get_stacktrace)( Thr*, Addr*, UWord ),
struct EC_* (*stacktrace_to_EC)( Addr*, UWord ),
struct EC_* (*get_EC)( Thr* )
Modified: branches/YARD/helgrind/libhb_core.c
===================================================================
--- branches/YARD/helgrind/libhb_core.c 2008-09-21 00:58:00 UTC (rev 8628)
+++ branches/YARD/helgrind/libhb_core.c 2008-09-21 09:31:15 UTC (rev 8629)
@@ -40,6 +40,7 @@
#include "pub_tool_wordfm.h"
#include "pub_tool_xarray.h"
#include "pub_tool_oset.h"
+#include "pub_tool_aspacemgr.h"
#include "hg_basics.h"
#include "libhb.h"
@@ -48,9 +49,6 @@
/* fwds for
Globals needed by other parts of the library. These are set
once at startup and then never changed. */
-static void* (*main_zalloc)( HChar*, SizeT ) = NULL;
-static void (*main_dealloc)( void* ) = NULL;
-static void* (*main_shadow_alloc)( SizeT ) = NULL;
static void (*main_get_stacktrace)( Thr*, Addr*, UWord ) = NULL;
static struct EC_* (*main_stacktrace_to_EC)( Addr*, UWord ) = NULL;
static struct EC_* (*main_get_EC)( Thr* ) = NULL;
@@ -335,12 +333,42 @@
}
+/*----------------------------------------------------------------*/
+/*--- map_shmem :: WordFM Addr SecMap ---*/
+/*--- shadow memory (low level handlers) (shmem__* fns) ---*/
+/*----------------------------------------------------------------*/
+
/*--------------- SecMap allocation --------------- */
+static HChar* shmem__bigchunk_next = NULL;
+static HChar* shmem__bigchunk_end1 = NULL;
+
+static void* shmem__bigchunk_alloc ( SizeT n )
+{
+ const SizeT sHMEM__BIGCHUNK_SIZE = 4096 * 256 * 4;
+ tl_assert(n > 0);
+ n = VG_ROUNDUP(n, 16);
+ tl_assert(shmem__bigchunk_next <= shmem__bigchunk_end1);
+ tl_assert(shmem__bigchunk_end1 - shmem__bigchunk_next
+ <= (SSizeT)sHMEM__BIGCHUNK_SIZE);
+ if (shmem__bigchunk_next + n > shmem__bigchunk_end1) {
+ if (0)
+ VG_(printf)("XXXXX bigchunk: abandoning %d bytes\n",
+ (Int)(shmem__bigchunk_end1 - shmem__bigchunk_next));
+ shmem__bigchunk_next = VG_(am_shadow_alloc)( sHMEM__BIGCHUNK_SIZE );
+ shmem__bigchunk_end1 = shmem__bigchunk_next + sHMEM__BIGCHUNK_SIZE;
+ }
+ tl_assert(shmem__bigchunk_next);
+ tl_assert( 0 == (((Addr)shmem__bigchunk_next) & (16-1)) );
+ tl_assert(shmem__bigchunk_next + n <= shmem__bigchunk_end1);
+ shmem__bigchunk_next += n;
+ return shmem__bigchunk_next - n;
+}
+
static SecMap* shmem__alloc_SecMap ( void )
{
Word i, j;
- SecMap* sm = main_shadow_alloc( sizeof(SecMap) );
+ SecMap* sm = shmem__bigchunk_alloc( sizeof(SecMap) );
if (0) VG_(printf)("alloc_SecMap %p\n",sm);
tl_assert(sm);
sm->magic = SecMap_MAGIC;
@@ -560,7 +588,7 @@
/* No free F line found. Expand existing array and try again. */
new_size = sm->linesF_size==0 ? 1 : 2 * sm->linesF_size;
- nyu = main_zalloc( "libhb.aFfw.1 (LineF storage)",
+ nyu = HG_(zalloc)( "libhb.aFfw.1 (LineF storage)",
new_size * sizeof(LineF) );
tl_assert(nyu);
@@ -581,7 +609,7 @@
nyu[i] = sm->linesF[i];
}
VG_(memset)(sm->linesF, 0, sm->linesF_size * sizeof(LineF) );
- main_dealloc(sm->linesF);
+ HG_(free)(sm->linesF);
}
sm->linesF = nyu;
@@ -2023,8 +2051,8 @@
rcdec = p_rcdec;
tl_assert(map_shmem == NULL);
- map_shmem = VG_(newFM)( main_zalloc, "libhb.zsm_init.1 (map_shmem)",
- main_dealloc,
+ map_shmem = VG_(newFM)( HG_(zalloc), "libhb.zsm_init.1 (map_shmem)",
+ HG_(free),
NULL/*unboxed UWord cmp*/);
tl_assert(map_shmem != NULL);
shmem__invalidate_scache();
@@ -2148,11 +2176,11 @@
VTS* VTS__new ( void )
{
VTS* vts;
- vts = main_zalloc( "libhb.VTS__new.1", sizeof(VTS) );
+ vts = HG_(zalloc)( "libhb.VTS__new.1", sizeof(VTS) );
tl_assert(vts);
vts->id = VtsID_INVALID;
- vts->ts = VG_(newXA)( main_zalloc, "libhb.VTS__new.2",
- main_dealloc, sizeof(ScalarTS) );
+ vts->ts = VG_(newXA)( HG_(zalloc), "libhb.VTS__new.2",
+ HG_(free), sizeof(ScalarTS) );
tl_assert(vts->ts);
return vts;
}
@@ -2165,7 +2193,7 @@
tl_assert(vts);
tl_assert(vts->ts);
VG_(deleteXA)( vts->ts );
- main_dealloc(vts);
+ HG_(free)(vts);
}
@@ -2564,8 +2592,8 @@
static void vts_set_init ( void )
{
tl_assert(!vts_set);
- vts_set = VG_(newFM)( main_zalloc, "libhb.vts_set_init.1",
- main_dealloc,
+ vts_set = VG_(newFM)( HG_(zalloc), "libhb.vts_set_init.1",
+ HG_(free),
(Word(*)(UWord,UWord))VTS__cmp_structural );
tl_assert(vts_set);
}
@@ -2639,8 +2667,8 @@
static void vts_tab_init ( void )
{
vts_tab
- = VG_(newXA)( main_zalloc, "libhb.vts_tab_init.1",
- main_dealloc, sizeof(VtsTE) );
+ = VG_(newXA)( HG_(zalloc), "libhb.vts_tab_init.1",
+ HG_(free), sizeof(VtsTE) );
vts_tab_freelist
= VtsID_INVALID;
tl_assert(vts_tab);
@@ -3020,7 +3048,7 @@
};
static Thr* Thr__new ( void ) {
- Thr* thr = main_zalloc( "libhb.Thr__new.1", sizeof(Thr) );
+ Thr* thr = HG_(zalloc)( "libhb.Thr__new.1", sizeof(Thr) );
thr->viR = VtsID_INVALID;
thr->viW = VtsID_INVALID;
return thr;
@@ -3406,8 +3434,8 @@
contextTree = VG_(OSetGen_Create)(
0,
(Word(*)(const void *, const void*))RCEC__cmp_by_frames,
- main_zalloc, "libhb.event_map_init.1 (context tree)",
- main_dealloc
+ HG_(zalloc), "libhb.event_map_init.1 (context tree)",
+ HG_(free)
);
tl_assert(contextTree);
@@ -3415,8 +3443,8 @@
oldrefTree = VG_(OSetGen_Create)(
0,
(Word(*)(const void *, const void*))OldRef__cmp_by_EA,
- main_zalloc, "libhb.event_map_init.2 (oldref tree)",
- main_dealloc
+ HG_(zalloc), "libhb.event_map_init.2 (oldref tree)",
+ HG_(free)
);
tl_assert(oldrefTree);
@@ -3481,8 +3509,8 @@
/* Compute the distribution of generation values in the ref tree */
/* genMap :: generation-number -> count-of-nodes-with-that-number */
- genMap = VG_(newFM)( main_zalloc, "libhb.emmG.1",
- main_dealloc, NULL );
+ genMap = VG_(newFM)( HG_(zalloc), "libhb.emmG.1",
+ HG_(free), NULL );
VG_(OSetGen_ResetIter)( oldrefTree );
while ( (oldref = VG_(OSetGen_Next)( oldrefTree )) ) {
@@ -3532,8 +3560,8 @@
delete. We can't simultaneously traverse the tree and delete
stuff from it, so first we need to copy them off somewhere
else. (sigh) */
- refs2del = VG_(newXA)( main_zalloc, "libhb.emmG.1",
- main_dealloc, sizeof(OldRef*) );
+ refs2del = VG_(newXA)( HG_(zalloc), "libhb.emmG.1",
+ HG_(free), sizeof(OldRef*) );
VG_(OSetGen_ResetIter)( oldrefTree );
while ( (oldref = VG_(OSetGen_Next)( oldrefTree )) ) {
@@ -3788,7 +3816,7 @@
};
static SO* SO__Alloc ( void ) {
- SO* so = main_zalloc( "libhb.SO__Alloc.1", sizeof(SO) );
+ SO* so = HG_(zalloc)( "libhb.SO__Alloc.1", sizeof(SO) );
so->viR = VtsID_INVALID;
so->viW = VtsID_INVALID;
so->magic = SO_MAGIC;
@@ -3805,7 +3833,7 @@
VtsID__rcdec(so->viW);
}
so->magic = 0;
- main_dealloc( so );
+ HG_(free)( so );
}
@@ -3833,9 +3861,6 @@
Thr* libhb_init (
- void* (*zalloc)( HChar*, SizeT ),
- void (*dealloc)( void* ),
- void* (*shadow_alloc)( SizeT ),
void (*get_stacktrace)( Thr*, Addr*, UWord ),
struct EC_* (*stacktrace_to_EC)( Addr*, UWord ),
struct EC_* (*get_EC)( Thr* )
@@ -3843,15 +3868,9 @@
{
Thr* thr;
VtsID vi;
- tl_assert(zalloc);
- tl_assert(dealloc);
- tl_assert(shadow_alloc);
tl_assert(get_stacktrace);
tl_assert(stacktrace_to_EC);
tl_assert(get_EC);
- main_zalloc = zalloc;
- main_dealloc = dealloc;
- main_shadow_alloc = shadow_alloc;
main_get_stacktrace = get_stacktrace;
main_stacktrace_to_EC = stacktrace_to_EC;
main_get_EC = get_EC;
Modified: branches/YARD/include/pub_tool_libcbase.h
===================================================================
--- branches/YARD/include/pub_tool_libcbase.h 2008-09-21 00:58:00 UTC (rev 8628)
+++ branches/YARD/include/pub_tool_libcbase.h 2008-09-21 09:31:15 UTC (rev 8629)
@@ -72,8 +72,9 @@
------------------------------------------------------------------ */
/* Use this for normal null-termination-style string comparison */
-#define VG_STREQ(s1,s2) ( (s1 != NULL && s2 != NULL \
- && VG_(strcmp)((s1),(s2))==0) ? True : False )
+#define VG_STREQ(_s1,_s2) \
+ ( ((_s1) != NULL && (_s2) != NULL \
+ && VG_(strcmp)((_s1),(_s2))==0) ? True : False )
extern Int VG_(strlen) ( const Char* str );
extern Char* VG_(strcat) ( Char* dest, const Char* src );
@@ -122,10 +123,10 @@
// 'a' -- the alignment -- must be a power of 2.
// The latter two require the vki-*.h header to be imported also.
-#define VG_ROUNDDN(p, a) ((Addr)(p) & ~((Addr)(a)-1))
-#define VG_ROUNDUP(p, a) VG_ROUNDDN((p)+(a)-1, (a))
-#define VG_PGROUNDDN(p) VG_ROUNDDN(p, VKI_PAGE_SIZE)
-#define VG_PGROUNDUP(p) VG_ROUNDUP(p, VKI_PAGE_SIZE)
+#define VG_ROUNDDN(_p, _a) ((Addr)(_p) & ~((Addr)(_a)-1))
+#define VG_ROUNDUP(_p, _a) VG_ROUNDDN((_p)+(_a)-1, (_a))
+#define VG_PGROUNDDN(_p) VG_ROUNDDN((_p), VKI_PAGE_SIZE)
+#define VG_PGROUNDUP(_p) VG_ROUNDUP((_p), VKI_PAGE_SIZE)
/* ---------------------------------------------------------------------
Misc useful functions
|
|
From: Tom H. <th...@cy...> - 2008-09-21 03:31:11
|
Nightly build on alvis ( i686, Red Hat 7.3 ) started at 2008-09-21 03:15:02 BST Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 366 tests, 80 stderr failures, 2 stdout failures, 29 post failures == exp-ptrcheck/tests/bad_percentify (stderr) exp-ptrcheck/tests/base (stderr) exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/fp (stderr) exp-ptrcheck/tests/globalerr (stderr) exp-ptrcheck/tests/hackedbz2 (stderr) exp-ptrcheck/tests/hp_bounds (stderr) exp-ptrcheck/tests/hp_dangle (stderr) exp-ptrcheck/tests/justify (stderr) exp-ptrcheck/tests/partial_bad (stderr) exp-ptrcheck/tests/partial_good (stderr) exp-ptrcheck/tests/pth_create (stderr) exp-ptrcheck/tests/pth_specific (stderr) exp-ptrcheck/tests/realloc (stderr) exp-ptrcheck/tests/stackerr (stderr) exp-ptrcheck/tests/strcpy (stderr) exp-ptrcheck/tests/supp (stderr) exp-ptrcheck/tests/tricky (stderr) exp-ptrcheck/tests/unaligned (stderr) exp-ptrcheck/tests/zero (stderr) helgrind/tests/hg01_all_ok (stderr) helgrind/tests/hg02_deadlock (stderr) helgrind/tests/hg03_inherit (stderr) helgrind/tests/hg04_race (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/hg06_readshared (stderr) helgrind/tests/tc01_simple_race (stderr) helgrind/tests/tc02_simple_tls (stderr) helgrind/tests/tc03_re_excl (stderr) helgrind/tests/tc05_simple_race (stderr) helgrind/tests/tc06_two_races (stderr) helgrind/tests/tc07_hbl1 (stderr) helgrind/tests/tc08_hbl2 (stderr) helgrind/tests/tc09_bad_unlock (stderr) helgrind/tests/tc11_XCHG (stderr) helgrind/tests/tc12_rwl_trivial (stderr) helgrind/tests/tc14_laog_dinphils (stderr) helgrind/tests/tc16_byterace (stderr) helgrind/tests/tc17_sembar (stderr) helgrind/tests/tc18_semabuse (stderr) helgrind/tests/tc19_shadowmem (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) helgrind/tests/tc23_bogus_condwait (stderr) helgrind/tests/tc24_nonzero_sem (stderr) massif/tests/alloc-fns-A (post) massif/tests/alloc-fns-B (post) massif/tests/basic (post) massif/tests/basic2 (post) massif/tests/big-alloc (post) massif/tests/culling1 (stderr) massif/tests/culling2 (stderr) massif/tests/custom_alloc (post) massif/tests/deep-A (post) massif/tests/deep-B (stderr) massif/tests/deep-B (post) massif/tests/deep-C (stderr) massif/tests/deep-C (post) massif/tests/deep-D (post) massif/tests/ignoring (post) massif/tests/insig (post) massif/tests/long-names (post) massif/tests/long-time (post) massif/tests/new-cpp (post) massif/tests/null (post) massif/tests/one (post) massif/tests/overloaded-new (post) massif/tests/peak (post) massif/tests/peak2 (stderr) massif/tests/peak2 (post) massif/tests/realloc (stderr) massif/tests/realloc (post) massif/tests/thresholds_0_0 (post) massif/tests/thresholds_0_10 (post) massif/tests/thresholds_10_0 (post) massif/tests/thresholds_10_10 (post) massif/tests/thresholds_5_0 (post) massif/tests/thresholds_5_10 (post) massif/tests/zero1 (post) massif/tests/zero2 (post) memcheck/tests/file_locking (stderr) memcheck/tests/leak-0 (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-regroot (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/long_namespace_xml (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/origin1-yes (stderr) memcheck/tests/origin4-many (stderr) memcheck/tests/origin5-bz2 (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_changes (stderr) memcheck/tests/varinfo1 (stderr) memcheck/tests/varinfo2 (stderr) memcheck/tests/varinfo3 (stderr) memcheck/tests/varinfo4 (stderr) memcheck/tests/varinfo5 (stderr) memcheck/tests/varinfo6 (stderr) memcheck/tests/x86/bug152022 (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) memcheck/tests/x86/xor-undef-x86 (stderr) memcheck/tests/xml1 (stderr) none/tests/blockfault (stderr) none/tests/cmdline2 (stdout) none/tests/mremap2 (stdout) none/tests/shell (stderr) none/tests/shell_valid1 (stderr) none/tests/shell_valid2 (stderr) none/tests/shell_valid3 (stderr) |
|
From: Tom H. <th...@cy...> - 2008-09-21 03:09:04
|
Nightly build on lloyd ( x86_64, Fedora 7 ) started at 2008-09-21 03:05:07 BST Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 458 tests, 11 stderr failures, 3 stdout failures, 0 post failures == exp-ptrcheck/tests/base (stderr) exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/pth_create (stderr) exp-ptrcheck/tests/pth_specific (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc22_exit_w_lock (stderr) memcheck/tests/file_locking (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/vcpu_fnfns (stdout) memcheck/tests/x86/scalar (stderr) none/tests/blockfault (stderr) none/tests/cmdline2 (stdout) none/tests/mremap2 (stdout) |
|
From: Tom H. <th...@cy...> - 2008-09-21 03:05:48
|
Nightly build on aston ( x86_64, Fedora Core 5 ) started at 2008-09-21 03:20:05 BST Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 464 tests, 10 stderr failures, 2 stdout failures, 0 post failures == exp-ptrcheck/tests/base (stderr) exp-ptrcheck/tests/ccc (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) memcheck/tests/file_locking (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/x86/scalar (stderr) none/tests/blockfault (stderr) none/tests/cmdline2 (stdout) none/tests/mremap2 (stdout) |
|
From: Tom H. <th...@cy...> - 2008-09-21 02:48:53
|
Nightly build on trojan ( x86_64, Fedora Core 6 ) started at 2008-09-21 03:25:06 BST Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 462 tests, 13 stderr failures, 5 stdout failures, 0 post failures == exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/pth_create (stderr) exp-ptrcheck/tests/pth_specific (stderr) helgrind/tests/tc17_sembar (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) memcheck/tests/file_locking (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/vcpu_fnfns (stdout) memcheck/tests/x86/bug133694 (stdout) memcheck/tests/x86/bug133694 (stderr) memcheck/tests/x86/scalar (stderr) none/tests/blockfault (stderr) none/tests/cmdline1 (stdout) none/tests/cmdline2 (stdout) none/tests/mremap2 (stdout) |
|
From: Tom H. <th...@cy...> - 2008-09-21 02:27:39
|
Nightly build on gill ( x86_64, Fedora Core 2 ) started at 2008-09-21 03:00:03 BST Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 464 tests, 33 stderr failures, 4 stdout failures, 0 post failures == exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/hackedbz2 (stderr) helgrind/tests/hg01_all_ok (stderr) helgrind/tests/hg02_deadlock (stderr) helgrind/tests/hg03_inherit (stderr) helgrind/tests/hg04_race (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/tc01_simple_race (stderr) helgrind/tests/tc05_simple_race (stderr) helgrind/tests/tc06_two_races (stderr) helgrind/tests/tc09_bad_unlock (stderr) helgrind/tests/tc14_laog_dinphils (stderr) helgrind/tests/tc16_byterace (stderr) helgrind/tests/tc17_sembar (stderr) helgrind/tests/tc19_shadowmem (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) helgrind/tests/tc23_bogus_condwait (stderr) memcheck/tests/file_locking (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/origin5-bz2 (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/varinfo6 (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) none/tests/amd64/insn_ssse3 (stdout) none/tests/amd64/insn_ssse3 (stderr) none/tests/amd64/ssse3_misaligned (stderr) none/tests/blockfault (stderr) none/tests/cmdline2 (stdout) none/tests/fdleak_fcntl (stderr) none/tests/mremap2 (stdout) none/tests/x86/insn_ssse3 (stdout) none/tests/x86/insn_ssse3 (stderr) none/tests/x86/ssse3_misaligned (stderr) |
|
From: <sv...@va...> - 2008-09-21 00:58:10
|
Author: sewardj
Date: 2008-09-21 01:58:00 +0100 (Sun, 21 Sep 2008)
New Revision: 8628
Log:
Start to integrate libhb more closely into Helgrind, and also
make a start on restructuring Helgrind as a whole so as to make
it more maintainable and flexible.
* remove the ability to build libhb standalone (unfortunately)
* create hg_basics.[ch], to hold very basic definitions common
to Helgrind as a whole
* remove duplicate copies of m_xarray.[ch] and m_wordfm.[ch]
from libhb_core.c
Added:
branches/YARD/helgrind/hg_basics.c
branches/YARD/helgrind/hg_basics.h
Removed:
branches/YARD/helgrind/Makefile_sa
branches/YARD/helgrind/libhb_sa.c
branches/YARD/helgrind/libhb_vg.c
Modified:
branches/YARD/helgrind/Makefile.am
branches/YARD/helgrind/hg_main.c
branches/YARD/helgrind/hg_wordset.c
branches/YARD/helgrind/libhb_core.c
Modified: branches/YARD/helgrind/Makefile.am
===================================================================
--- branches/YARD/helgrind/Makefile.am 2008-09-20 16:01:41 UTC (rev 8627)
+++ branches/YARD/helgrind/Makefile.am 2008-09-21 00:58:00 UTC (rev 8628)
@@ -70,7 +70,8 @@
$(PRELOAD_LDFLAGS_PPC64_AIX5) \
$(LIBREPLACEMALLOC_LDFLAGS_PPC64_AIX5)
-HELGRIND_SOURCES_COMMON = hg_wordset.c hg_main.c libhb_vg.c
+HELGRIND_SOURCES_COMMON = \
+ hg_basics.c hg_wordset.c libhb_core.c hg_main.c
helgrind_x86_linux_SOURCES = $(HELGRIND_SOURCES_COMMON)
helgrind_x86_linux_CPPFLAGS = $(AM_CPPFLAGS_X86_LINUX)
@@ -118,6 +119,6 @@
hginclude_HEADERS = helgrind.h
-noinst_HEADERS = hg_wordset.h
+noinst_HEADERS = hg_basics.h hg_wordset.h
-EXTRA_DIST = Makefile_sa README_MSMProp2.txt README_YARD.txt
+EXTRA_DIST = README_MSMProp2.txt README_YARD.txt
Deleted: branches/YARD/helgrind/Makefile_sa
===================================================================
--- branches/YARD/helgrind/Makefile_sa 2008-09-20 16:01:41 UTC (rev 8627)
+++ branches/YARD/helgrind/Makefile_sa 2008-09-21 00:58:00 UTC (rev 8628)
@@ -1,18 +0,0 @@
-
-CC = gcc
-CFLAGS = -g -O -Wall -Wmissing-prototypes -Wshadow \
- -Wpointer-arith -Wbad-function-cast -Wcast-qual \
- -Wcast-align -Wmissing-declarations \
- $(EXTRA_CFLAGS) -g -O -fno-strict-aliasing
-
-all: libhb.h libhb_core.c libhb_sa.c
- $(CC) $(CFLAGS) -o libhb_sa libhb_sa.c
-
-clean:
- rm -f libhb_sa
-
-tarfile:
- XYZZY=`date +\%F-\%T` ; \
- FOOBAR=`echo $$XYZZY | sed s/:/-/g` ; \
- tar cvf libhb3-$$FOOBAR.tar libhb_sa.c libhb_vg.c \
- libhb_core.c libhb.h Makefile_sa
Added: branches/YARD/helgrind/hg_basics.c
===================================================================
--- branches/YARD/helgrind/hg_basics.c (rev 0)
+++ branches/YARD/helgrind/hg_basics.c 2008-09-21 00:58:00 UTC (rev 8628)
@@ -0,0 +1,35 @@
+
+/*--------------------------------------------------------------------*/
+/*--- Basic definitions for all of Helgrind. ---*/
+/*--- hg_basics.c ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Helgrind, a Valgrind tool for detecting errors
+ in threaded programs.
+
+ Copyright (C) 2007-2008 OpenWorks Ltd
+ in...@op...
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+
+/*--------------------------------------------------------------------*/
+/*--- end hg_basics.c ---*/
+/*--------------------------------------------------------------------*/
Added: branches/YARD/helgrind/hg_basics.h
===================================================================
--- branches/YARD/helgrind/hg_basics.h (rev 0)
+++ branches/YARD/helgrind/hg_basics.h 2008-09-21 00:58:00 UTC (rev 8628)
@@ -0,0 +1,41 @@
+
+/*--------------------------------------------------------------------*/
+/*--- Basic definitions for all of Helgrind. ---*/
+/*--- hg_basics.h ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Helgrind, a Valgrind tool for detecting errors
+ in threaded programs.
+
+ Copyright (C) 2007-2008 OpenWorks Ltd
+ in...@op...
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#ifndef __HG_BASICS_H
+#define __HG_BASICS_H
+
+#define HG_(str) VGAPPEND(vgHelgrind_,str)
+
+#endif /* ! __HG_BASICS_H */
+
+/*--------------------------------------------------------------------*/
+/*--- end hg_basics.h ---*/
+/*--------------------------------------------------------------------*/
Modified: branches/YARD/helgrind/hg_main.c
===================================================================
--- branches/YARD/helgrind/hg_main.c 2008-09-20 16:01:41 UTC (rev 8627)
+++ branches/YARD/helgrind/hg_main.c 2008-09-21 00:58:00 UTC (rev 8628)
@@ -51,9 +51,9 @@
#include "pub_tool_debuginfo.h" /* VG_(get_data_description) */
#include "pub_tool_wordfm.h"
+#include "hg_basics.h"
#include "helgrind.h"
-#define HG_(str) VGAPPEND(vgHelgrind_,str)
#include "hg_wordset.h"
#include "libhb.h"
Modified: branches/YARD/helgrind/hg_wordset.c
===================================================================
--- branches/YARD/helgrind/hg_wordset.c 2008-09-20 16:01:41 UTC (rev 8627)
+++ branches/YARD/helgrind/hg_wordset.c 2008-09-21 00:58:00 UTC (rev 8628)
@@ -40,7 +40,7 @@
#include "pub_tool_libcprint.h"
#include "pub_tool_wordfm.h"
-#define HG_(str) VGAPPEND(vgHelgrind_,str)
+#include "hg_basics.h"
#include "hg_wordset.h"
//------------------------------------------------------------------//
Modified: branches/YARD/helgrind/libhb_core.c
===================================================================
--- branches/YARD/helgrind/libhb_core.c 2008-09-20 16:01:41 UTC (rev 8627)
+++ branches/YARD/helgrind/libhb_core.c 2008-09-21 00:58:00 UTC (rev 8628)
@@ -31,22 +31,20 @@
02111-1307, USA.
The GNU General Public License is contained in the file COPYING.
-
- //////////////////////////
-
- Note .. apart from those sections of the file which are copyright
- others of course .. only WordFM I believe. Such sections will be
- moved out to separate files in due course.
*/
+#include "pub_tool_basics.h"
+#include "pub_tool_libcassert.h"
+#include "pub_tool_libcbase.h"
+#include "pub_tool_libcprint.h"
+#include "pub_tool_wordfm.h"
+#include "pub_tool_xarray.h"
+#include "pub_tool_oset.h"
+
+#include "hg_basics.h"
#include "libhb.h"
-#undef VG_
-#undef HG_
-#define VG_(_xx) libhbPlainVG_##_xx
-#define HG_(_xx) libhbPlainHG_##_xx
-
/* fwds for
Globals needed by other parts of the library. These are set
once at startup and then never changed. */
@@ -69,2013 +67,6 @@
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// //
-// SECTION BEGIN xarray //
-// //
-/////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-
-/*--------------------------------------------------------------------*/
-/*--- An expandable array implementation. pub_tool_xarray.h ---*/
-/*--------------------------------------------------------------------*/
-
-/*
- This file is part of Valgrind, a dynamic binary instrumentation
- framework.
-
- Copyright (C) 2007-2008 OpenWorks LLP
- in...@op...
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-#ifndef __PUB_TOOL_XARRAY_H
-#define __PUB_TOOL_XARRAY_H
-
-//--------------------------------------------------------------------
-// PURPOSE: Provides a simple but useful structure, which is an array
-// in which elements can be added at the end. The array is expanded
-// as needed by multiplying its size by a constant factor (usually 2).
-// This gives amortised O(1) insertion cost, and, following sorting,
-// the usual O(log N) binary search cost. Arbitrary element sizes
-// are allowed; the comparison function for sort/lookup can be changed
-// at any time, and duplicates (modulo the comparison function) are
-// allowed.
-//--------------------------------------------------------------------
-
-
-/* It's an abstract type. Bwaha. */
-typedef void XArray;
-
-/* Create new XArray, using given allocation and free function, and
- for elements of the specified size. Alloc fn must not fail (that
- is, if it returns it must have succeeded.) */
-extern XArray* VG_(newXA) ( void*(*alloc_fn)(HChar*,SizeT),
- HChar* cc,
- void(*free_fn)(void*),
- Word elemSzB );
-
-/* Free all memory associated with an XArray. */
-extern void VG_(deleteXA) ( XArray* );
-
-/* Set the comparison function for this XArray. This clears an
- internal 'array is sorted' flag, which means you must call sortXA
- before making further queries with lookupXA. */
-extern void VG_(setCmpFnXA) ( XArray*, Int (*compar)(void*,void*) );
-
-/* Add an element to an XArray. Element is copied into the XArray.
- Index at which it was added is returned. Note this will be
- invalidated if the array is later sortXA'd. */
-extern Int VG_(addToXA) ( XArray*, void* elem );
-
-/* Add a sequence of bytes to an XArray of bytes. Asserts if nbytes
- is negative or the array's element size is not 1. Returns the
- index at which the first byte was added. */
-extern Int VG_(addBytesToXA) ( XArray* xao, void* bytesV, Int nbytes );
-
-/* Sort an XArray using its comparison function, if set; else bomb.
- Probably not a stable sort w.r.t. equal elements module cmpFn. */
-extern void VG_(sortXA) ( XArray* );
-
-/* Lookup (by binary search) 'key' in the array. Set *first to be the
- index of the first, and *last to be the index of the last matching
- value found. If any values are found, return True, else return
- False, and don't change *first or *last. Bomb if the array is not
- sorted. */
-extern Bool VG_(lookupXA) ( XArray*, void* key,
- /*OUT*/Word* first, /*OUT*/Word* last );
-
-/* How elements are there in this XArray now? */
-extern Word VG_(sizeXA) ( XArray* );
-
-/* Index into the XArray. Checks bounds and bombs if the index is
- invalid. What this returns is the address of the specified element
- in the array, not (of course) the element itself. Note that the
- element may get moved by subsequent addToXAs/sortXAs, so you should
- copy it out immediately and not regard its address as unchanging.
- Note also that indexXA will of course not return NULL if it
- succeeds. */
-extern void* VG_(indexXA) ( XArray*, Word );
-
-/* Drop the last n elements of an XArray. Bombs if there are less
- than n elements in the array. */
-extern void VG_(dropTailXA) ( XArray*, Word );
-
-/* Make a new, completely independent copy of the given XArray, using
- the existing allocation function to allocate the new space.
- Returns NULL if the allocation function didn't manage to allocate
- space (but did return NULL rather than merely abort.) */
-extern XArray* VG_(cloneXA)( XArray* xa );
-
-#endif // __PUB_TOOL_XARRAY_H
-
-/*--------------------------------------------------------------------*/
-/*--- end pub_tool_xarray.h ---*/
-/*--------------------------------------------------------------------*/
-
-/*--------------------------------------------------------------------*/
-/*--- An expandable array implementation. m_xarray.h ---*/
-/*--------------------------------------------------------------------*/
-
-/*
- This file is part of Valgrind, a dynamic binary instrumentation
- framework.
-
- Copyright (C) 2007-2008 OpenWorks LLP
- in...@op...
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-/* See pub_tool_xarray.h for details of what this is all about. */
-
-struct _XArray {
- void* (*alloc) ( HChar*, SizeT ); /* alloc fn (nofail) */
- HChar* cc;
- void (*free) ( void* ); /* free fn */
- Int (*cmpFn) ( void*, void* ); /* cmp fn (may be NULL) */
- Word elemSzB; /* element size in bytes */
- void* arr; /* pointer to elements */
- Word usedsizeE; /* # used elements in arr */
- Word totsizeE; /* max size of arr, in elements */
- Bool sorted; /* is it sorted? */
-};
-
-
-XArray* VG_(newXA) ( void*(*alloc_fn)(HChar*,SizeT),
- HChar* cc,
- void(*free_fn)(void*),
- Word elemSzB )
-{
- struct _XArray* xa;
- /* Implementation relies on Word being signed and (possibly)
- on SizeT being unsigned. */
- vg_assert( sizeof(Word) == sizeof(void*) );
- vg_assert( ((Word)(-1)) < ((Word)(0)) );
- vg_assert( ((SizeT)(-1)) > ((SizeT)(0)) );
- /* check user-supplied info .. */
- vg_assert(alloc_fn);
- vg_assert(free_fn);
- vg_assert(elemSzB > 0);
- xa = alloc_fn( cc, sizeof(struct _XArray) );
- vg_assert(xa);
- xa->alloc = alloc_fn;
- xa->cc = cc;
- xa->free = free_fn;
- xa->cmpFn = NULL;
- xa->elemSzB = elemSzB;
- xa->usedsizeE = 0;
- xa->totsizeE = 0;
- xa->sorted = False;
- xa->arr = NULL;
- return xa;
-}
-
-XArray* VG_(cloneXA)( XArray* xao )
-{
- struct _XArray* xa = (struct _XArray*)xao;
- struct _XArray* nyu;
- vg_assert(xa);
- vg_assert(xa->alloc);
- vg_assert(xa->free);
- vg_assert(xa->elemSzB >= 1);
- nyu = xa->alloc( xa->cc, sizeof(struct _XArray) );
- if (!nyu)
- return NULL;
- /* Copy everything verbatim ... */
- *nyu = *xa;
- /* ... except we have to clone the contents-array */
- if (nyu->arr) {
- nyu->arr = nyu->alloc( nyu->cc, nyu->totsizeE * nyu->elemSzB );
- if (!nyu->arr) {
- nyu->free(nyu);
- return NULL;
- }
- VG_(memcpy)( nyu->arr, xa->arr, nyu->totsizeE * nyu->elemSzB );
- }
- /* We're done! */
- return nyu;
-}
-
-void VG_(deleteXA) ( XArray* xao )
-{
- struct _XArray* xa = (struct _XArray*)xao;
- vg_assert(xa);
- vg_assert(xa->free);
- if (xa->arr)
- xa->free(xa->arr);
- xa->free(xa);
-}
-
-void VG_(setCmpFnXA) ( XArray* xao, Int (*compar)(void*,void*) )
-{
- struct _XArray* xa = (struct _XArray*)xao;
- vg_assert(xa);
- vg_assert(compar);
- xa->cmpFn = compar;
- xa->sorted = False;
-}
-
-inline void* VG_(indexXA) ( XArray* xao, Word n )
-{
- struct _XArray* xa = (struct _XArray*)xao;
- vg_assert(xa);
- vg_assert(n >= 0);
- vg_assert(n < xa->usedsizeE);
- return ((char*)xa->arr) + n * xa->elemSzB;
-}
-
-static inline void ensureSpaceXA ( struct _XArray* xa )
-{
- if (xa->usedsizeE == xa->totsizeE) {
- void* tmp;
- Word newsz;
- if (xa->totsizeE == 0)
- vg_assert(!xa->arr);
- if (xa->totsizeE > 0)
- vg_assert(xa->arr);
- if (xa->totsizeE == 0) {
- /* No point in having tiny (eg) 2-byte allocations for the
- element array, since all allocs are rounded up to 8 anyway.
- Hence increase the initial array size for tiny elements in
- an attempt to avoid reallocations of size 2, 4, 8 if the
- array does start to fill up. */
- if (xa->elemSzB == 1) newsz = 8;
- else if (xa->elemSzB == 2) newsz = 4;
- else newsz = 2;
- } else {
- newsz = 2 * xa->totsizeE;
- }
- if (0)
- VG_(printf)("addToXA: increasing from %ld to %ld\n",
- xa->totsizeE, newsz);
- tmp = xa->alloc(xa->cc, newsz * xa->elemSzB);
- vg_assert(tmp);
- if (xa->usedsizeE > 0)
- VG_(memcpy)(tmp, xa->arr, xa->usedsizeE * xa->elemSzB);
- if (xa->arr)
- xa->free(xa->arr);
- xa->arr = tmp;
- xa->totsizeE = newsz;
- }
-}
-
-Int VG_(addToXA) ( XArray* xao, void* elem )
-{
- struct _XArray* xa = (struct _XArray*)xao;
- vg_assert(xa);
- vg_assert(elem);
- vg_assert(xa->totsizeE >= 0);
- vg_assert(xa->usedsizeE >= 0 && xa->usedsizeE <= xa->totsizeE);
- ensureSpaceXA( xa );
- vg_assert(xa->usedsizeE < xa->totsizeE);
- vg_assert(xa->arr);
- VG_(memcpy)( ((UChar*)xa->arr) + xa->usedsizeE * xa->elemSzB,
- elem, xa->elemSzB );
- xa->usedsizeE++;
- xa->sorted = False;
- return xa->usedsizeE-1;
-}
-
-Int VG_(addBytesToXA) ( XArray* xao, void* bytesV, Int nbytes )
-{
- Int r, i;
- struct _XArray* xa = (struct _XArray*)xao;
- vg_assert(xa);
- vg_assert(xa->elemSzB == 1);
- vg_assert(nbytes >= 0);
- vg_assert(xa->totsizeE >= 0);
- vg_assert(xa->usedsizeE >= 0 && xa->usedsizeE <= xa->totsizeE);
- r = xa->usedsizeE;
- for (i = 0; i < nbytes; i++) {
- ensureSpaceXA( xa );
- vg_assert(xa->usedsizeE < xa->totsizeE);
- vg_assert(xa->arr);
- * (((UChar*)xa->arr) + xa->usedsizeE) = ((UChar*)bytesV)[i];
- xa->usedsizeE++;
- }
- xa->sorted = False;
- return r;
-}
-
-void VG_(sortXA) ( XArray* xao )
-{
- struct _XArray* xa = (struct _XArray*)xao;
- vg_assert(xa);
- vg_assert(xa->cmpFn);
- VG_(ssort)( xa->arr, xa->usedsizeE, xa->elemSzB, xa->cmpFn );
- xa->sorted = True;
-}
-
-Bool VG_(lookupXA) ( XArray* xao, void* key, Word* first, Word* last )
-{
- Word lo, mid, hi, cres;
- void* midv;
- struct _XArray* xa = (struct _XArray*)xao;
- vg_assert(xa);
- vg_assert(xa->cmpFn);
- vg_assert(xa->sorted);
- vg_assert(first);
- vg_assert(last);
- lo = 0;
- hi = xa->usedsizeE-1;
- while (True) {
- /* current unsearched space is from lo to hi, inclusive. */
- if (lo > hi) return False; /* not found */
- mid = (lo + hi) / 2;
- midv = VG_(indexXA)( xa, mid );
- cres = xa->cmpFn( key, midv );
- if (cres < 0) { hi = mid-1; continue; }
- if (cres > 0) { lo = mid+1; continue; }
- /* Found it, at mid. See how far we can expand this. */
- vg_assert(xa->cmpFn( key, VG_(indexXA)(xa, lo) ) >= 0);
- vg_assert(xa->cmpFn( key, VG_(indexXA)(xa, hi) ) <= 0);
- *first = *last = mid;
- while (*first > 0
- && 0 == xa->cmpFn( key, VG_(indexXA)(xa, (*first)-1)))
- (*first)--;
- while (*last < xa->usedsizeE-1
- && 0 == xa->cmpFn( key, VG_(indexXA)(xa, (*last)+1)))
- (*last)++;
- return True;
- }
-}
-
-Word VG_(sizeXA) ( XArray* xao )
-{
- struct _XArray* xa = (struct _XArray*)xao;
- vg_assert(xa);
- return xa->usedsizeE;
-}
-
-void VG_(dropTailXA) ( XArray* xao, Word n )
-{
- struct _XArray* xa = (struct _XArray*)xao;
- vg_assert(xa);
- vg_assert(n >= 0);
- vg_assert(n <= xa->usedsizeE);
- xa->usedsizeE -= n;
-}
-
-/*--------------------------------------------------------------------*/
-/*--- end m_xarray.c ---*/
-/*--------------------------------------------------------------------*/
-
-/////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-// //
-// SECTION END xarray //
-// //
-/////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-
-
-
-/////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-// //
-// SECTION BEGIN wordfm //
-// //
-/////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-
-/*--------------------------------------------------------------------*/
-/*--- An AVL tree based finite map for word keys and word values. ---*/
-/*--- Inspired by Haskell's "FiniteMap" library. ---*/
-/*--- hg_wordfm.h ---*/
-/*--------------------------------------------------------------------*/
-
-/*
- This file is part of Helgrind, a Valgrind tool for detecting errors
- in threaded programs.
-
- Copyright (C) 2007-2008 Julian Seward
- js...@ac...
-
- This code is based on previous work by Nicholas Nethercote
- (coregrind/m_oset.c) which is
-
- Copyright (C) 2005-2008 Nicholas Nethercote
- nj...@va...
-
- which in turn was derived partially from:
-
- AVL C library
- Copyright (C) 2000,2002 Daniel Nagy
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of
- the License, or (at your option) any later version.
- [...]
-
- (taken from libavl-0.4/debian/copyright)
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-#ifndef __HG_WORDFM_H
-#define __HG_WORDFM_H
-
-//------------------------------------------------------------------//
-//--- WordFM ---//
-//--- Public interface ---//
-//------------------------------------------------------------------//
-
-/* As of r7409 (15 Feb 08), 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 (when kCmp == NULL), 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 represent addresses (Addr) since Addr is unsigned,
- and causes logical problems and assertion failures. */
-
-typedef struct _WordFM WordFM; /* opaque */
-
-/* Allocate and initialise a WordFM. If kCmp is non-NULL, elements in
- the set are ordered according to the ordering specified by kCmp,
- which becomes obvious if you use VG_(initIterFM),
- VG_(initIterAtFM), VG_(nextIterFM), VG_(doneIterFM) to iterate over
- sections of the map, or the whole thing. If kCmp is NULL then the
- ordering used is unsigned word ordering (UWord) on the key
- values. */
-WordFM* HG_(newFM) ( void* (*alloc_nofail)( HChar*, SizeT ),
- HChar* cc,
- void (*dealloc)(void*),
- Word (*kCmp)(UWord,UWord) );
-
-/* Free up the FM. If kFin is non-NULL, it is applied to keys before
- the FM is deleted; ditto with vFin and wFin for vals. */
-void HG_(deleteFM) ( WordFM* fm, void(*kFin)(UWord),
- void(*vFin)(UWord),
- void(*wFin)(UWord) );
-
-/* Add (k,v,w) to fm. If a binding for k already exists, it is
- updated to map to this new (v,w). In that case we should really
- return the previous (v,w) so that caller can finalise them. Oh
- well. Returns True if a binding for k already exists.*/
-Bool HG_(addToFM) ( WordFM* fm, UWord k, UWord v, UWord w );
-
-// Delete key from fm, returning associated key and vals if found
-Bool HG_(delFromFM) ( WordFM* fm,
- /*OUT*/UWord* oldK,
- /*OUT*/UWord* oldV, /*OUT*/UWord* oldW,
- UWord key );
-
-// Look up in fm, assigning found key & vals at spec'd addresses
-Bool HG_(lookupFM) ( WordFM* fm,
- /*OUT*/UWord* resK,
- /*OUT*/UWord* resV, /*OUT*/UWord* resW,
- UWord key );
-
-// How many elements are there in fm? Note; slow; O(# elems in the fm)
-UWord HG_(sizeFM) ( WordFM* fm );
-
-// Is the fm empty? Fast (constant-time)
-Bool HG_(isEmptyFM)( WordFM* fm );
-
-// If fm is non-empty, return arbitrarily chosen key/values
-// through *res{K,V,W}, and return True. If empty return False.
-Bool HG_(anyElementOfFM) ( WordFM* fm,
- /*OUT*/UWord* resK,
- /*OUT*/UWord* resV, /*OUT*/UWord* resW );
-
-// set up FM for iteration
-void HG_(initIterFM) ( WordFM* fm );
-
-// set up FM for iteration so that the first key subsequently produced
-// by HG_(nextIterFM) is the smallest key in the map >= start_at.
-// Naturally ">=" is defined by the comparison function supplied to
-// HG_(newFM), as documented above.
-void HG_(initIterAtFM) ( WordFM* fm, UWord start_at );
-
-// get next key/vals. Will assert if fm has been modified
-// or looked up in since initIterFM/initIterWithStartFM was called.
-Bool HG_(nextIterFM) ( WordFM* fm,
- /*OUT*/UWord* resK,
- /*OUT*/UWord* resV, /*OUT*/UWord* resW );
-
-// clear the I'm iterating flag
-void HG_(doneIterFM) ( WordFM* fm );
-
-// Deep copy a FM. If dopyK is NULL, keys are copied verbatim.
-// If non-null, dopyK is applied to each key to generate the
-// version in the new copy. In that case, if the argument to dopyK
-// is non-NULL but the result is NULL, it is assumed that dopyK
-// could not allocate memory, in which case the copy is abandoned
-// and NULL is returned. Ditto with dopyV and dopyW for values.
-WordFM* HG_(dopyFM) ( WordFM* fm,
- UWord(*dopyK)(UWord),
- UWord(*dopyV)(UWord), UWord(*dopyW)(UWord) );
-
-//------------------------------------------------------------------//
-//--- end WordFM ---//
-//--- Public interface ---//
-//------------------------------------------------------------------//
-
-//------------------------------------------------------------------//
-//--- WordBag (unboxed words only) ---//
-//--- Public interface ---//
-//------------------------------------------------------------------//
-
-//typedef struct _WordBag WordBag; /* opaque */
-
-// FIXME! find some way to turn this back into an abstract type.
-typedef
- struct {
- void* (*alloc_nofail)( HChar*, SizeT );
- HChar* cc;
- void (*dealloc)(void*);
- UWord firstWord;
- UWord firstCount;
- WordFM* rest;
- /* When zero, the next call to HG_(nextIterBag) gives
- (.firstWord, .firstCount). When nonzero, such calls traverse
- .rest. */
- UWord iterCount;
- }
- WordBag;
-
-
-/* Initialise a WordBag and make it empty. Only do this once for each
- bag, at the start of its lifetime. */
-void HG_(initBag) ( WordBag* bag,
- void* (*alloc_nofail)( HChar*, SizeT ),
- HChar* cc,
- void (*dealloc)(void*) );
-
-/* Remove all elements from a bag, thereby making it empty, and free
- all associated memory. This can be done as many times as required,
- but only after the initial HG_(initBag) call. */
-void HG_(emptyOutBag) ( WordBag* bag );
-
-/* Add a word. */
-void HG_(addToBag)( WordBag*, UWord );
-
-/* Find out how many times the given word exists in the bag. */
-UWord HG_(elemBag) ( WordBag*, UWord );
-
-/* Delete a word from the bag. */
-Bool HG_(delFromBag)( WordBag*, UWord );
-
-/* Is the bag empty? */
-Bool HG_(isEmptyBag)( WordBag* );
-
-/* Is the bag empty, skipping all sanity checks? */
-static inline Bool HG_(isEmptyBag_UNCHECKED)( WordBag* bag ) {
- return bag->firstCount == 0;
-}
-
-/* Does the bag have exactly one element? */
-Bool HG_(isSingletonTotalBag)( WordBag* );
-
-/* Return an arbitrary element from the bag. */
-UWord HG_(anyElementOfBag)( WordBag* );
-
-/* How many different / total elements are in the bag? */
-UWord HG_(sizeUniqueBag)( WordBag* ); /* warning: slow */
-UWord HG_(sizeTotalBag)( WordBag* ); /* warning: very slow */
-
-/* Iterating over the elements of a bag. */
-void HG_(initIterBag)( WordBag* );
-Bool HG_(nextIterBag)( WordBag*, /*OUT*/UWord* pVal, /*OUT*/UWord* pCount );
-void HG_(doneIterBag)( WordBag* );
-
-//------------------------------------------------------------------//
-//--- end WordBag (unboxed words only) ---//
-//--- Public interface ---//
-//------------------------------------------------------------------//
-
-#endif /* ! __HG_WORDFM_H */
-
-/*--------------------------------------------------------------------*/
-/*--- end hg_wordfm.h ---*/
-/*--------------------------------------------------------------------*/
-
-/*--------------------------------------------------------------------*/
-/*--- An AVL tree based finite map for word keys and word values. ---*/
-/*--- Inspired by Haskell's "FiniteMap" library. ---*/
-/*--- hg_wordfm.c ---*/
-/*--------------------------------------------------------------------*/
-
-/*
- This file is part of Helgrind, a Valgrind tool for detecting errors
- in threaded programs.
-
- Copyright (C) 2007-2008 Julian Seward
- js...@ac...
-
- This code is based on previous work by Nicholas Nethercote
- (coregrind/m_oset.c) which is
-
- Copyright (C) 2005-2008 Nicholas Nethercote
- nj...@va...
-
- which in turn was derived partially from:
-
- AVL C library
- Copyright (C) 2000,2002 Daniel Nagy
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of
- the License, or (at your option) any later version.
- [...]
-
- (taken from libavl-0.4/debian/copyright)
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-#if 0
-#include "pub_tool_basics.h"
-#include "pub_tool_libcassert.h"
-#include "pub_tool_libcbase.h"
-
-
-#ifdef HG_WORDFM_STANDALONE // standalone compilation
-// Standalone mode (for testing).
-// On x86_64 compile like this:
-// gcc -m64 hg_wordfm.c -I../include -I../VEX/pub
-// -DVGA_amd64=1 -DHG_WORDFM_STANDALONE -g -O -Wall
-# include <assert.h>
-# include <string.h>
-# include <stdio.h>
-# include <stdlib.h>
-
-# undef tl_assert
-# define tl_assert assert
-# define vgPlain_memset memset
-
-#endif /* def HG_WORDFM_STANDALONE */
-#endif /* 0 */
-
-
-//------------------------------------------------------------------//
-//--- WordFM ---//
-//--- Implementation ---//
-//------------------------------------------------------------------//
-
-/* One element of the AVL tree */
-typedef
- struct _AvlNode {
- UWord key;
- UWord val;
- UWord wal;
- struct _AvlNode* child[2]; /* [0] is left subtree, [1] is right */
- Char balance; /* do not make this unsigned */
- }
- AvlNode;
-
-typedef
- struct {
- UWord w;
- Bool b;
- }
- MaybeWord;
-
-#define WFM_STKMAX 32 // At most 2**32 entries can be iterated over
-
-struct _WordFM {
- AvlNode* root;
- void* (*alloc_nofail)( HChar*, SizeT );
- HChar* cc;
- void (*dealloc)(void*);
- Word (*kCmp)(UWord,UWord);
- AvlNode* nodeStack[WFM_STKMAX]; // Iterator node stack
- Int numStack[WFM_STKMAX]; // Iterator num stack
- Int stackTop; // Iterator stack pointer, one past end
-};
-
-/* forward */
-static Bool avl_removeroot_wrk(AvlNode** t, Word(*kCmp)(UWord,UWord));
-
-/* Swing to the left. Warning: no balance maintainance. */
-static void avl_swl ( AvlNode** root )
-{
- AvlNode* a = *root;
- AvlNode* b = a->child[1];
- *root = b;
- a->child[1] = b->child[0];
- b->child[0] = a;
-}
-
-/* Swing to the right. Warning: no balance maintainance. */
-static void avl_swr ( AvlNode** root )
-{
- AvlNode* a = *root;
- AvlNode* b = a->child[0];
- *root = b;
- a->child[0] = b->child[1];
- b->child[1] = a;
-}
-
-/* Balance maintainance after especially nasty swings. */
-static void avl_nasty ( AvlNode* root )
-{
- switch (root->balance) {
- case -1:
- root->child[0]->balance = 0;
- root->child[1]->balance = 1;
- break;
- case 1:
- root->child[0]->balance = -1;
- root->child[1]->balance = 0;
- break;
- case 0:
- root->child[0]->balance = 0;
- root->child[1]->balance = 0;
- break;
- default:
- tl_assert(0);
- }
- root->balance=0;
-}
-
-/* Find size of a non-NULL tree. */
-static UWord size_avl_nonNull ( AvlNode* nd )
-{
- return 1 + (nd->child[0] ? size_avl_nonNull(nd->child[0]) : 0)
- + (nd->child[1] ? size_avl_nonNull(nd->child[1]) : 0);
-}
-
-/* Unsignedly compare w1 and w2. If w1 < w2, produce a negative
- number; if w1 > w2 produce a positive number, and if w1 == w2
- produce zero. */
-static inline Word cmp_unsigned_Words ( UWord w1, UWord w2 ) {
- if (w1 < w2) return -1;
- if (w1 > w2) return 1;
- return 0;
-}
-
-/* Insert element a into the AVL tree t. Returns True if the depth of
- the tree has grown. If element with that key is already present,
- just copy a->val to existing node, first returning old ->val field
- of existing node in *oldV, so that the caller can finalize it
- however it wants.
-*/
-static
-Bool avl_insert_wrk ( AvlNode** rootp,
- /*OUT*/MaybeWord* oldV,
- AvlNode* a,
- Word (*kCmp)(UWord,UWord) )
-{
- Word cmpres;
-
- /* initialize */
- a->child[0] = 0;
- a->child[1] = 0;
- a->balance = 0;
- oldV->b = False;
-
- /* insert into an empty tree? */
- if (!(*rootp)) {
- (*rootp) = a;
- return True;
- }
-
- cmpres = kCmp ? /*boxed*/ kCmp( (*rootp)->key, a->key )
- : /*unboxed*/ cmp_unsigned_Words( (UWord)(*rootp)->key,
- (UWord)a->key );
-
- if (cmpres > 0) {
- /* insert into the left subtree */
- if ((*rootp)->child[0]) {
- AvlNode* left_subtree = (*rootp)->child[0];
- if (avl_insert_wrk(&left_subtree, oldV, a, kCmp)) {
- switch ((*rootp)->balance--) {
- case 1: return False;
- case 0: return True;
- case -1: break;
- default: tl_assert(0);
- }
- if ((*rootp)->child[0]->balance < 0) {
- avl_swr( rootp );
- (*rootp)->balance = 0;
- (*rootp)->child[1]->balance = 0;
- } else {
- avl_swl( &((*rootp)->child[0]) );
- avl_swr( rootp );
- avl_nasty( *rootp );
- }
- } else {
- (*rootp)->child[0] = left_subtree;
- }
- return False;
- } else {
- (*rootp)->child[0] = a;
- if ((*rootp)->balance--)
- return False;
- return True;
- }
- tl_assert(0);/*NOTREACHED*/
- }
- else
- if (cmpres < 0) {
- /* insert into the right subtree */
- if ((*rootp)->child[1]) {
- AvlNode* right_subtree = (*rootp)->child[1];
- if (avl_insert_wrk(&right_subtree, oldV, a, kCmp)) {
- switch((*rootp)->balance++){
- case -1: return False;
- case 0: return True;
- case 1: break;
- default: tl_assert(0);
- }
- if ((*rootp)->child[1]->balance > 0) {
- avl_swl( rootp );
- (*rootp)->balance = 0;
- (*rootp)->child[0]->balance = 0;
- } else {
- avl_swr( &((*rootp)->child[1]) );
- avl_swl( rootp );
- avl_nasty( *rootp );
- }
- } else {
- (*rootp)->child[1] = right_subtree;
- }
- return False;
- } else {
- (*rootp)->child[1] = a;
- if ((*rootp)->balance++)
- return False;
- return True;
- }
- tl_assert(0);/*NOTREACHED*/
- }
- else {
- /* cmpres == 0, a duplicate - replace the val, but don't
- incorporate the node in the tree */
- oldV->b = True;
- oldV->w = (*rootp)->val;
- (*rootp)->val = a->val;
- return False;
- }
-}
-
-/* Remove an element a from the AVL tree t. a must be part of
- the tree. Returns True if the depth of the tree has shrunk.
-*/
-static
-Bool avl_remove_wrk ( AvlNode** rootp,
- AvlNode* a,
- Word(*kCmp)(UWord,UWord) )
-{
- Bool ch;
- Word cmpres;
- cmpres = kCmp ? /*boxed*/ kCmp( (*rootp)->key, a->key )
- : /*unboxed*/ cmp_unsigned_Words( (UWord)(*rootp)->key,
- (UWord)a->key );
-
- if (cmpres > 0){
- /* remove from the left subtree */
- AvlNode* left_subtree = (*rootp)->child[0];
- tl_assert(left_subtree);
- ch = avl_remove_wrk(&left_subtree, a, kCmp);
- (*rootp)->child[0]=left_subtree;
- if (ch) {
- switch ((*rootp)->balance++) {
- case -1: return True;
- case 0: return False;
- case 1: break;
- default: tl_assert(0);
- }
- switch ((*rootp)->child[1]->balance) {
- case 0:
- avl_swl( rootp );
- (*rootp)->balance = -1;
- (*rootp)->child[0]->balance = 1;
- return False;
- case 1:
- avl_swl( rootp );
- (*rootp)->balance = 0;
- (*rootp)->child[0]->balance = 0;
- return True;
- case -1:
- break;
- default:
- tl_assert(0);
- }
- avl_swr( &((*rootp)->child[1]) );
- avl_swl( rootp );
- avl_nasty( *rootp );
- return True;
- }
- }
- else
- if (cmpres < 0) {
- /* remove from the right subtree */
- AvlNode* right_subtree = (*rootp)->child[1];
- tl_assert(right_subtree);
- ch = avl_remove_wrk(&right_subtree, a, kCmp);
- (*rootp)->child[1] = right_subtree;
- if (ch) {
- switch ((*rootp)->balance--) {
- case 1: return True;
- case 0: return False;
- case -1: break;
- default: tl_assert(0);
- }
- switch ((*rootp)->child[0]->balance) {
- case 0:
- avl_swr( rootp );
- (*rootp)->balance = 1;
- (*rootp)->child[1]->balance = -1;
- return False;
- case -1:
- avl_swr( rootp );
- (*rootp)->balance = 0;
- (*rootp)->child[1]->balance = 0;
- return True;
- case 1:
- break;
- default:
- tl_assert(0);
- }
- avl_swl( &((*rootp)->child[0]) );
- avl_swr( rootp );
- avl_nasty( *rootp );
- return True;
- }
- }
- else {
- tl_assert(cmpres == 0);
- tl_assert((*rootp)==a);
- return avl_removeroot_wrk(rootp, kCmp);
- }
- return 0;
-}
-
-/* Remove the root of the AVL tree *rootp.
- * Warning: dumps core if *rootp is empty
- */
-static
-Bool avl_removeroot_wrk ( AvlNode** rootp,
- Word(*kCmp)(UWord,UWord) )
-{
- Bool ch;
- AvlNode* a;
- if (!(*rootp)->child[0]) {
- if (!(*rootp)->child[1]) {
- (*rootp) = 0;
- return True;
- }
- (*rootp) = (*rootp)->child[1];
- return True;
- }
- if (!(*rootp)->child[1]) {
- (*rootp) = (*rootp)->child[0];
- return True;
- }
- if ((*rootp)->balance < 0) {
- /* remove from the left subtree */
- a = (*rootp)->child[0];
- while (a->child[1]) a = a->child[1];
- } else {
- /* remove from the right subtree */
- a = (*rootp)->child[1];
- while (a->child[0]) a = a->child[0];
- }
- ch = avl_remove_wrk(rootp, a, kCmp);
- a->child[0] = (*rootp)->child[0];
- a->child[1] = (*rootp)->child[1];
- a->balance = (*rootp)->balance;
- (*rootp) = a;
- if(a->balance == 0) return ch;
- return False;
-}
-
-static
-AvlNode* avl_find_node ( AvlNode* t, Word k, Word(*kCmp)(UWord,UWord) )
-{
- if (kCmp) {
- /* Boxed comparisons */
- Word cmpresS;
- while (True) {
- if (t == NULL) return NULL;
- cmpresS = kCmp(t->key, k);
- if (cmpresS > 0) t = t->child[0]; else
- if (cmpresS < 0) t = t->child[1]; else
- return t;
- }
- } else {
- /* Unboxed comparisons */
- Word cmpresS; /* signed */
- UWord cmpresU; /* unsigned */
- while (True) {
- if (t == NULL) return NULL; /* unlikely ==> predictable */
- cmpresS = cmp_unsigned_Words( (UWord)t->key, (UWord)k );
- if (cmpresS == 0) return t; /* unlikely ==> predictable */
- cmpresU = (UWord)cmpresS;
- cmpresU >>=/*unsigned*/ (8 * sizeof(cmpresU) - 1);
- t = t->child[cmpresU];
- }
- }
-}
-
-// Clear the iterator stack.
-static void stackClear(WordFM* fm)
-{
- Int i;
- tl_assert(fm);
- for (i = 0; i < WFM_STKMAX; i++) {
- fm->nodeStack[i] = NULL;
- fm->numStack[i] = 0;
- }
- fm->stackTop = 0;
-}
-
-// Push onto the iterator stack.
-static inline void stackPush(WordFM* fm, AvlNode* n, Int i)
-{
- tl_assert(fm->stackTop < WFM_STKMAX);
- tl_assert(1 <= i && i <= 3);
- fm->nodeStack[fm->stackTop] = n;
- fm-> numStack[fm->stackTop] = i;
- fm->stackTop++;
-}
-
-// Pop from the iterator stack.
-static inline Bool stackPop(WordFM* fm, AvlNode** n, Int* i)
-{
- tl_assert(fm->stackTop <= WFM_STKMAX);
-
- if (fm->stackTop > 0) {
- fm->stackTop--;
- *n = fm->nodeStack[fm->stackTop];
- *i = fm-> numStack[fm->stackTop];
- tl_assert(1 <= *i && *i <= 3);
- fm->nodeStack[fm->stackTop] = NULL;
- fm-> numStack[fm->stackTop] = 0;
- return True;
- } else {
- return False;
- }
-}
-
-static
-AvlNode* avl_dopy ( AvlNode* nd,
- UWord(*dopyK)(UWord),
- UWord(*dopyV)(UWord),
- UWord(*dopyW)(UWord),
- void*(alloc_nofail)(HChar*,SizeT),
- HChar* cc )
-{
- AvlNode* nyu;
- if (! nd)
- return NULL;
- nyu = alloc_nofail(cc, sizeof(AvlNode));
- tl_assert(nyu);
-
- nyu->child[0] = nd->child[0];
- nyu->child[1] = nd->child[1];
- nyu->balance = nd->balance;
-
- /* Copy key */
- if (dopyK) {
- nyu->key = dopyK( nd->key );
- if (nd->key != 0 && nyu->key == 0)
- return NULL; /* oom in key dcopy */
- } else {
- /* copying assumedly unboxed keys */
- nyu->key = nd->key;
- }
-
- /* Copy val */
- if (dopyV) {
- nyu->val = dopyV( nd->val );
- if (nd->val != 0 && nyu->val == 0)
- return NULL; /* oom in val dcopy */
- } else {
- /* copying assumedly unboxed vals */
- nyu->val = nd->val;
- }
-
- /* Copy second val */
- if (dopyW) {
- nyu->wal = dopyW( nd->wal );
- if (nd->wal != 0 && nyu->wal == 0)
- return NULL; /* oom in wal dcopy */
- } else {
- /* copying assumedly unboxed wals */
- nyu->wal = nd->wal;
- }
-
- /* Copy subtrees */
- if (nyu->child[0]) {
- nyu->child[0] = avl_dopy( nyu->child[0],
- dopyK, dopyV, dopyW, alloc_nofail, cc );
- if (! nyu->child[0])
- return NULL;
- }
- if (nyu->child[1]) {
- nyu->child[1] = avl_dopy( nyu->child[1],
- dopyK, dopyV, dopyW, alloc_nofail, cc );
- if (! nyu->child[1])
- return NULL;
- }
-
- return nyu;
-}
-
-/* Initialise a WordFM. */
-static void initFM ( WordFM* fm,
- void* (*alloc_nofail)( HChar*, SizeT ),
- HChar* cc,
- void (*dealloc)(void*),
- Word (*kCmp)(UWord,UWord) )
-{
- fm->root = NULL;
- fm->kCmp = kCmp;
- fm->alloc_nofail = alloc_nofail;
- fm->cc = cc;
- fm->dealloc = dealloc;
- fm->stackTop = 0;
-}
-
-/* --- Public interface functions --- */
-
-/* Allocate and initialise a WordFM. If kCmp is non-NULL, elements in
- the set are ordered according to the ordering specified by kCmp,
- which becomes obvious if you use VG_(initIterFM),
- VG_(initIterAtFM), VG_(nextIterFM), VG_(doneIterFM) to iterate over
- sections of the map, or the whole thing. If kCmp is NULL then the
- ordering used is unsigned word ordering (UWord) on the key
- values. */
-WordFM* HG_(newFM) ( void* (*alloc_nofail)( HChar*, SizeT ),
- HChar* cc,
- void (*dealloc)(void*),
- Word (*kCmp)(UWord,UWord) )
-{
- WordFM* fm = alloc_nofail(cc, sizeof(WordFM));
- tl_assert(fm);
- initFM(fm, alloc_nofail, cc, dealloc, kCmp);
- return fm;
-}
-
-static void avl_free ( AvlNode* nd,
- void(*kFin)(UWord),
- void(*vFin)(UWord),
- void(*wFin)(UWord),
- void(*dealloc)(void*) )
-{
- if (!nd)
- return;
- if (nd->child[0])
- avl_free(nd->child[0], kFin, vFin, wFin, dealloc);
- if (nd->child[1])
- avl_free(nd->child[1], kFin, vFin, wFin, dealloc);
- if (kFin)
- kFin( nd->key );
- if (vFin)
- vFin( nd->val );
- if (wFin)
- wFin( nd->wal );
- VG_(memset)(nd, 0, sizeof(AvlNode));
- dealloc(nd);
-}
-
-/* Free up the FM. If kFin is non-NULL, it is applied to keys before
- the FM is deleted; ditto with vFin and wFin for vals. */
-void HG_(deleteFM) ( WordFM* fm, void(*kFin)(UWord),
- void(*vFin)(UWord),
- void(*wFin)(UWord) )
-{
- void(*dealloc)(void*) = fm->dealloc;
- if (fm->root)
- avl_free( fm->root, kFin, vFin, wFin, dealloc );
- VG_(memset)(fm, 0, sizeof(WordFM) );
- dealloc(fm);
-}
-
-/* Add (k,v,w) to fm. */
-Bool HG_(addToFM) ( WordFM* fm, UWord k, UWord v, UWord w )
-{
- MaybeWord oldV;
- AvlNode* node;
- node = fm->alloc_nofail( fm->cc, sizeof(struct _AvlNode) );
- node->key = k;
- node->val = v;
- node->wal = w;
- oldV.b = False;
- oldV.w = 0;
- avl_insert_wrk( &fm->root, &oldV, node, fm->kCmp );
- //if (oldV.b && fm->vFin)
- // fm->vFin( oldV.w );
- if (oldV.b)
- fm->dealloc(node);
- return oldV.b;
-}
-
-// Delete key from fm, returning associated key and vals if found
-Bool HG_(delFromFM) ( WordFM* fm,
- /*OUT*/UWord* oldK,
- /*OUT*/UWord* oldV, /*OUT*/UWord* oldW,
- UWord key )
-{
- AvlNode* node = avl_find_node( fm->root, key, fm->kCmp );
- if (node) {
- avl_remove_wrk( &fm->root, node, fm->kCmp );
- if (oldK)
- *oldK = node->key;
- if (oldV)
- *oldV = node->val;
- if (oldW)
- *oldW = node->wal;
- fm->dealloc(node);
- return True;
- } else {
- return False;
- }
-}
-
-// Look up in fm, assigning found key & vals at spec'd addresses
-Bool HG_(lookupFM) ( WordFM* fm,
- /*OUT*/UWord* resK,
- /*OUT*/UWord* resV, /*OUT*/UWord* resW,
- UWord key )
-{
- AvlNode* node = avl_find_node( fm->root, key, fm->kCmp );
- if (node) {
- if (resK)
- *resK = node->key;
- if (resV)
- *resV = node->val;
- if (resW)
- *resW = node->wal;
- return True;
- } else {
- return False;
- }
-}
-
-UWord HG_(sizeFM) ( WordFM* fm )
-{
- // Hmm, this is a bad way to do this
- return fm->root ? size_avl_nonNull( fm->root ) : 0;
-}
-
-Bool HG_(isEmptyFM)( WordFM* fm )
-{
- return fm->root == NULL;
-}
-
-Bool HG_(anyElementOfFM) ( WordFM* fm,
- /*OUT*/UWord* resK,
- /*OUT*/UWord* resV, /*OUT*/UWord* resW )
-{
- if (!fm->root)
- return False;
- if (resK)
- *resK = fm->root->key;
- if (resV)
- *resV = fm->root->val;
- if (resW)
- *resW = fm->root->wal;
- return True;
-}
-
-// set up FM for iteration
-void HG_(initIterFM) ( WordFM* fm )
-{
- tl_assert(fm);
- stackClear(fm);
- if (fm->root)
- stackPush(fm, fm->root, 1);
-}
-
-// set up FM for iteration so that the first key subsequently produced
-// by HG_(nextIterFM) is the smallest key in the map >= start_at.
-// Naturally ">=" is defined by the comparison function supplied to
-// HG_(newFM), as documented above.
-void HG_(initIterAtFM) ( WordFM* fm, UWord start_at )
-{
- Int i;
- AvlNode *n, *t;
- Word cmpresS; /* signed */
- UWord cmpresU; /* unsigned */
-
- tl_assert(fm);
- stackClear(fm);
-
- if (!fm->root)
- return;
-
- n = NULL;
- // We need to do regular search and fill in the stack.
- t = fm->root;
-
- while (True) {
- if (t == NULL) return;
-
- cmpresS
- = fm->kCmp ? /*boxed*/ fm->kCmp( t->key, start_at )
- : /*unboxed*/ cmp_unsigned_Words( t->key, start_at );
-
- if (cmpresS == 0) {
- // We found the exact key -- we are done.
- // The iteration should start with this node.
- stackPush(fm, t, 2);
- // The stack now looks like {2, 2, ... ,2, 2}
- return;
- }
- cmpresU = (UWord)cmpresS;
- cmpresU >>=/*unsigned*/ (8 * sizeof(cmpresU) - 1);
- if (!cmpresU) {
- // Push this node only if we go to the left child.
- stackPush(fm, t, 2);
- }
- t = t->child[cmpresU];
- }
- if (stackPop(fm, &n, &i)) {
- // If we've pushed something to stack and did not find the exact key,
- // we must fix the top element of stack.
- tl_assert(i == 2);
- stackPush(fm, n, 3);
- // the stack looks like {2, 2, ..., 2, 3}
- }
-}
-
-// get next key/vals. Will assert if fm has been modified
-// or looked up in since initIterFM/initIterWithStartFM was called.
-Bool HG_(nextIterFM) ( WordFM* fm,
- /*OUT*/UWord* resK,
- /*OUT*/UWord* resV, /*OUT*/UWord* resW )
-{
- Int i = 0;
- AvlNode* n = NULL;
-
- tl_assert(fm);
-
- // This in-order traversal requires each node to be pushed and popped
- // three times. These could be avoided by updating nodes in-situ on the
- // top of the stack, but the push/pop cost is so small that it's worth
- // keeping this loop in this simpler form.
- while (stackPop(fm, &n, &i)) {
- switch (i) {
- case 1: case_1:
- stackPush(fm, n, 2);
- /* if (n->child[0]) stackPush(fm, n->child[0], 1); */
- if (n->child[0]) { n = n->child[0]; goto case_1; }
- break;
- case 2:
- stackPush(fm, n, 3);
- if (resK) *resK = n->key;
- if (resV) *resV = n->val;
- if (resW) *resW = n->wal;
- return True;
- case 3:
- /* if (n->child[1]) stackPush(fm, n->child[1], 1); */
- if (n->child[1]) { n = n->child[1]; goto case_1; }
- break;
- default:
- tl_assert(0);
- }
- }
-
- // Stack empty, iterator is exhausted, return NULL
- return False;
-}
-
-// clear the I'm iterating flag
-void HG_(doneIterFM) ( WordFM* fm )
-{
-}
-
-WordFM* HG_(dopyFM) ( WordFM* fm,
- UWord(*dopyK)(UWord),
- UWord(*dopyV)(UWord), UWord(*dopyW)(UWord) )
-{
- WordFM* nyu;
-
- /* can't clone the fm whilst iterating on it */
- tl_assert(fm->stackTop == 0);
-
- nyu = fm->alloc_nofail( fm->cc, sizeof(WordFM) );
- tl_assert(nyu);
-
- *nyu = *fm;
-
- fm->stackTop = 0;
- VG_(memset)(fm->nodeStack, 0, sizeof(fm->nodeStack));
- VG_(memset)(fm->numStack, 0, sizeof(fm->numStack));
-
- if (nyu->root) {
- nyu->root = avl_dopy( nyu->root,
- dopyK, dopyV, dopyW,
- fm->alloc_nofail, fm->cc );
- if (! nyu->root)
- return NULL;
- }
-
- return nyu;
-}
-
-//------------------------------------------------------------------//
-//--- end WordFM ---//
-//--- Implementation ---//
-//------------------------------------------------------------------//
-
-//------------------------------------------------------------------//
-//--- WordBag (unboxed words only) ---//
-//--- Implementation ---//
-//------------------------------------------------------------------//
-
-//struct _WordBag {
-// void* (*alloc_nofail)( SizeT );
-// void (*dealloc)(void*);
-// UWord firstWord;
-// UWord firstCount;
-// WordFM* rest;
-// /* When zero, the next call to HG_(nextIterBag) gives
-// (.firstWord, .firstCount). When nonzero, such calls traverse
-// .rest. */
-// UWord iterCount;
-//};
-
-/* Representational invariants. Either:
-
- * bag is empty
- firstWord == firstCount == 0
- rest == NULL
-
- * bag contains just one unique element
- firstCount > 0
- rest == NULL
-
- * bag contains more than one unique element
- firstCount > 0
- rest != NULL
-
- If rest != NULL, then
- (1) firstWord != any .key in rest, and
- (2) all .val in rest > 0
-*/
-
-static inline Bool is_plausible_WordBag ( WordBag* bag ) {
- if (bag->firstWord == 0 && bag->firstCount == 0 && bag->rest == NULL)
- return True;
- if (bag->firstCount > 0 && bag->rest == NULL)
- return True;
- if (bag->firstCount > 0 && bag->rest != NULL)
- /* really should check (1) and (2) now, but that's
- v. expensive */
- return True;
- return False;
-}
-
-void HG_(initBag) ( WordBag* bag,
- void* (*alloc_nofail)( HChar*, SizeT ),
- HChar* cc,
- void (*dealloc)(void*) )
-{
- bag->alloc_nofail = alloc_nofail;
- bag->cc = cc;
- bag->dealloc = dealloc;
- bag->firstWord = 0;
- bag->firstCount = 0;
- bag->rest = NULL;
- bag->iterCount = 0;
-}
-
-void HG_(emptyOutBag) ( WordBag* bag )
-{
- if (bag->rest)
- HG_(deleteFM)( bag->rest, NULL, NULL, NULL );
- /* Don't zero out the alloc and dealloc function pointers, since we
- want to be able to keep on using this bag later, without having
- to call HG_(initBag) again. */
- bag->firstWord = 0;
- bag->firstCount = 0;
- bag->rest = NULL;
- bag->iterCount = 0;
-}
-
-void HG_(addToBag)( WordBag* bag, UWord w )
-{
- tl_assert(is_plausible_WordBag(bag));
- /* case where the bag is completely empty */
- if (bag->firstCount == 0) {
- tl_assert(bag->firstWord == 0 && bag->rest == NULL);
- bag->firstWord = w;
- bag->firstCount = 1;
- return;
- }
- /* there must be at least one element in it */
- tl_assert(bag->firstCount > 0);
- if (bag->firstWord == w) {
- bag->firstCount++;
- return;
- }
- /* it's not the Distinguished Element. Try the rest */
- { UWord key, count;
- if (bag->rest == NULL) {
- bag->rest = HG_(newFM)( bag->alloc_nofail, bag->cc, bag->dealloc,
- NULL/*unboxed uword cmp*/ );
- }
- tl_assert(bag->rest);
- if (HG_(lookupFM)(bag->rest, &key, &count, NULL, w)) {
- tl_assert(key == w);
- tl_assert(count >= 1);
- HG_(addToFM)(bag->rest, w, count+1, (UWord)0/*unused*/ );
- } else {
- HG_(addToFM)(bag->rest, w, 1, (UWord)0/*unused*/ );
- }
- }
-}
-
-UWord HG_(elemBag) ( WordBag* bag, UWord w )
-{
- tl_assert(is_plausible_WordBag(bag));
- if (bag->firstC...
[truncated message content] |
|
From: Aleksander M. <ale...@es...> - 2008-09-20 19:10:45
|
> Is it possible to suppress all memory leaks of a given function with a > single entry in the suppression files? I mean instead of writing an > entry for each memory leak caused in the execution of that function. > BTW, I write to this mailing list because I wouldn't mind to develop it myself if not already done :-) Is it a desirable feature? I'm thinking in Glib's g_type_init() function for example, where lots of memory allocations are done and never deallocated (there is no glib_type_deinit() or such). Cheers, -Aleksander |
|
From: Aleksander M. <ale...@es...> - 2008-09-20 18:54:02
|
Hi all, Is it possible to suppress all memory leaks of a given function with a single entry in the suppression files? I mean instead of writing an entry for each memory leak caused in the execution of that function. Cheers, -Aleksander |
|
From: <sv...@va...> - 2008-09-20 16:01:55
|
Author: sewardj
Date: 2008-09-20 17:01:41 +0100 (Sat, 20 Sep 2008)
New Revision: 8627
Log:
record_error_Race: defer attempt to generate a source-level
description of the raced-on address, until we're sure we want to
collect this error. Also, reenable var-info reading by default.
Modified:
branches/YARD/helgrind/hg_main.c
Modified: branches/YARD/helgrind/hg_main.c
===================================================================
--- branches/YARD/helgrind/hg_main.c 2008-09-20 00:13:23 UTC (rev 8626)
+++ branches/YARD/helgrind/hg_main.c 2008-09-20 16:01:41 UTC (rev 8627)
@@ -4227,11 +4227,30 @@
/* Updates the copy with address info if necessary. */
static UInt hg_update_extra ( Error* err )
{
- XError* extra = (XError*)VG_(get_error_extra)(err);
- tl_assert(extra);
+ XError* xe = (XError*)VG_(get_error_extra)(err);
+ tl_assert(xe);
//if (extra != NULL && Undescribed == extra->addrinfo.akind) {
// describe_addr ( VG_(get_error_address)(err), &(extra->addrinfo) );
//}
+
+ if (xe->tag == XE_Race) {
+ /* See if we can come up with a source level description of the
+ raced-upon address. This is potentially expensive, which is
+ why it's only done at the update_extra point, not when the
+ error is initially created. */
+ tl_assert(sizeof(xe->XE.Race.descr1) == sizeof(xe->XE.Race.descr2));
+ if (VG_(get_data_description)(
+ &xe->XE.Race.descr1[0],
+ &xe->XE.Race.descr2[0],
+ sizeof(xe->XE.Race.descr1)-1,
+ xe->XE.Race.data_addr )) {
+ tl_assert( xe->XE.Race.descr1
+ [ sizeof(xe->XE.Race.descr1)-1 ] == 0);
+ tl_assert( xe->XE.Race.descr2
+ [ sizeof(xe->XE.Race.descr2)-1 ] == 0);
+ }
+ }
+
return sizeof(XError);
}
@@ -4272,20 +4291,7 @@
// FIXME: tid vs thr
tl_assert(isWrite == False || isWrite == True);
// tl_assert(szB == 8 || szB == 4 || szB == 2 || szB == 1);
-
- tl_assert(sizeof(xe.XE.Race.descr1) == sizeof(xe.XE.Race.descr2));
xe.XE.Race.descr1[0] = xe.XE.Race.descr2[0] = 0;
- if (VG_(get_data_description)(
- &xe.XE.Race.descr1[0],
- &xe.XE.Race.descr2[0],
- sizeof(xe.XE.Race.descr1)-1,
- data_addr )) {
- tl_assert( xe.XE.Race.descr1
- [ sizeof(xe.XE.Race.descr1)-1 ] == 0);
- tl_assert( xe.XE.Race.descr2
- [ sizeof(xe.XE.Race.descr2)-1 ] == 0);
- }
-
VG_(maybe_record_error)( map_threads_reverse_lookup_SLOW(thr),
XE_Race, data_addr, NULL, &xe );
}
@@ -5042,10 +5048,8 @@
hg_cli__realloc,
HG_CLI__MALLOC_REDZONE_SZB );
- // VG_(needs_var_info)();
+ VG_(needs_var_info)(); /* optional */
- //VG_(needs_xml_output) ();
-
VG_(track_new_mem_startup) ( evh__new_mem_w_perms );
VG_(track_new_mem_stack_signal)( evh__new_mem_w_tid );
VG_(track_new_mem_brk) ( evh__new_mem_w_tid );
|
|
From: Florian K. <br...@ac...> - 2008-09-20 15:30:31
|
Hello,
I was looking at how to define a pattern for "add immediate"
which should match a subtree independent of whether the constant
is located in the first or second operand. Looking at irmatch
I see that it does not know about commutative operators.
So I'd have to define two patterns.. Hmm. I was trying to avoid
that.
VEX does not seem to guarantee that a constant is placed in
a defined operand position when the operator is commutative.
So I do need to consider both cases or accept that less efficient
code is generated.
How is this handled in other backends?
I was thinking of extending IRExpr_Binop to be aware of
commutative operators. What do you think of that approcach?
Florian
|
|
From: Tom H. <th...@cy...> - 2008-09-20 03:34:42
|
Nightly build on gill ( x86_64, Fedora Core 2 ) started at 2008-09-20 03:00:03 BST Results unchanged from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 464 tests, 33 stderr failures, 4 stdout failures, 0 post failures == exp-ptrcheck/tests/ccc (stderr) exp-ptrcheck/tests/hackedbz2 (stderr) helgrind/tests/hg01_all_ok (stderr) helgrind/tests/hg02_deadlock (stderr) helgrind/tests/hg03_inherit (stderr) helgrind/tests/hg04_race (stderr) helgrind/tests/hg05_race2 (stderr) helgrind/tests/tc01_simple_race (stderr) helgrind/tests/tc05_simple_race (stderr) helgrind/tests/tc06_two_races (stderr) helgrind/tests/tc09_bad_unlock (stderr) helgrind/tests/tc14_laog_dinphils (stderr) helgrind/tests/tc16_byterace (stderr) helgrind/tests/tc17_sembar (stderr) helgrind/tests/tc19_shadowmem (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) helgrind/tests/tc23_bogus_condwait (stderr) memcheck/tests/file_locking (stderr) memcheck/tests/malloc_free_fill (stderr) memcheck/tests/origin5-bz2 (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/varinfo6 (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) none/tests/amd64/insn_ssse3 (stdout) none/tests/amd64/insn_ssse3 (stderr) none/tests/amd64/ssse3_misaligned (stderr) none/tests/blockfault (stderr) none/tests/cmdline2 (stdout) none/tests/fdleak_fcntl (stderr) none/tests/mremap2 (stdout) none/tests/x86/insn_ssse3 (stdout) none/tests/x86/insn_ssse3 (stderr) none/tests/x86/ssse3_misaligned (stderr) |