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
(10) |
2
(8) |
3
(17) |
4
(28) |
5
(22) |
6
(8) |
|
7
(8) |
8
(22) |
9
(12) |
10
(17) |
11
(14) |
12
(15) |
13
(6) |
|
14
(9) |
15
(9) |
16
(16) |
17
(13) |
18
(18) |
19
(7) |
20
(5) |
|
21
(6) |
22
(5) |
23
(11) |
24
(5) |
25
(11) |
26
(7) |
27
(15) |
|
28
(11) |
29
(12) |
30
(12) |
31
(15) |
|
|
|
|
From: Nicholas N. <nj...@cs...> - 2007-10-03 23:34:16
|
On Mon, 1 Oct 2007, Shahriyar Amini wrote: > I am in the process of porting a tool that was written in Valgrind 2.2.0 > to Valgrind 3.3.0. I have attained my copy of the source code from svn. > I was wondering if there is a quick and easy way to save the work under : > > UCodeBlock* SK_(instrument)(UCodeBlock* cb_in, Addr orig_addr) > to the corresponding: > IRSB* fb_instrument( VgCallbackClosure* closure, IRSB* bb, > VexGuestLayout layout, VexGuestExtents* vge, IRType gWordTy, IRType > hWordTy ) I'm not sure what you mean by "save the work under". But I suspect the short answer is "no". The IR change (away from UCode, to Vex IR) was a big change between 2.x and 3.x, and you'll have to rewrite the 'instrument' to account for it. VEX/pub/libvex_ir.h explains how Vex IR works, you might also want to look at 'lackey', the example tool. Nick |
|
From: Nicholas N. <nj...@cs...> - 2007-10-03 23:33:15
|
On Wed, 3 Oct 2007, Bart Van Assche wrote: > The trend with gcc is that new versions move closer to the ANSI standard. > Since the comma is not a valid flag character in ANSI C, we can expect that > a future gcc version will complain about it. Do you think it would be a good > idea to modify the Valgrind source code such that the formatting functions > adhere strictly to the ANSI C standard and to remove extensions like the > insertion of comma's as a thousands separator ? I'm in favor of this -- I > find it confusing that Valgrind's format specifications differ slightly from > those in the C language. Additionally, as far as I know there is currently > no documentation available for Valgrind's format specifications. Making things more ANSI would be good, but then the ',' prefix is also extremely useful -- it inserts commas into printed numbers, eg. prints "1,234,567" instead of "1234567". Any ideas for how to get the best of both worlds? Nick |
|
From: <sv...@va...> - 2007-10-03 21:09:16
|
Author: sewardj
Date: 2007-10-03 22:09:17 +0100 (Wed, 03 Oct 2007)
New Revision: 6934
Log:
Improve anonymisation of regtest outputs, and update expected outputs.
Modified:
branches/THRCHECK/thrcheck/tests/filter_stderr
branches/THRCHECK/thrcheck/tests/hg02_deadlock.stderr.exp
branches/THRCHECK/thrcheck/tests/hg03_inherit.stderr.exp
branches/THRCHECK/thrcheck/tests/hg04_race.stderr.exp
branches/THRCHECK/thrcheck/tests/hg05_race2.stderr.exp
branches/THRCHECK/thrcheck/tests/tc01_simple_race.stderr.exp
branches/THRCHECK/thrcheck/tests/tc04_free_lock.stderr.exp
branches/THRCHECK/thrcheck/tests/tc05_simple_race.stderr.exp
branches/THRCHECK/thrcheck/tests/tc06_two_races.stderr.exp
branches/THRCHECK/thrcheck/tests/tc08_hbl2.c
branches/THRCHECK/thrcheck/tests/tc09_bad_unlock.stderr.exp
branches/THRCHECK/thrcheck/tests/tc10_rec_lock.stderr.exp
branches/THRCHECK/thrcheck/tests/tc12_rwl_trivial.stderr.exp
branches/THRCHECK/thrcheck/tests/tc13_laog1.stderr.exp
branches/THRCHECK/thrcheck/tests/tc14_laog_dinphils.stderr.exp
branches/THRCHECK/thrcheck/tests/tc15_laog_lockdel.c
branches/THRCHECK/thrcheck/tests/tc15_laog_lockdel.stderr.exp
Modified: branches/THRCHECK/thrcheck/tests/filter_stderr
===================================================================
--- branches/THRCHECK/thrcheck/tests/filter_stderr 2007-10-03 20:34:03 UTC (rev 6933)
+++ branches/THRCHECK/thrcheck/tests/filter_stderr 2007-10-03 21:09:17 UTC (rev 6934)
@@ -10,7 +10,11 @@
# Remove "Thrcheck, ..." line and the following copyright line.
sed "/^Thrcheck, a thread error detector/ , /./ d" |
-# Anonymise line numbers in mc_replace_strmem.c
-sed "s/mc_replace_strmem.c:[0-9]*/mc_replace_strmem.c:.../" |
+# Anonymise line numbers in tc_intercepts.c
+sed "s/tc_intercepts.c:[0-9]*/tc_intercepts.c:.../" |
+# Change (eg) "/lib64/libpthread-2.5.so" into "/lib/libpthread..."
+sed "s/lib64/lib/g" |
+sed "s/libpthread.*so/libpthread\.\.\./g" |
+
$dir/../../tests/filter_test_paths
Modified: branches/THRCHECK/thrcheck/tests/hg02_deadlock.stderr.exp
===================================================================
--- branches/THRCHECK/thrcheck/tests/hg02_deadlock.stderr.exp 2007-10-03 20:34:03 UTC (rev 6933)
+++ branches/THRCHECK/thrcheck/tests/hg02_deadlock.stderr.exp 2007-10-03 21:09:17 UTC (rev 6934)
@@ -1,3 +1,16 @@
+Thread #3 was created
+ at 0x........: clone (in /...libc...)
+ by 0x........: ...
+ by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib/libpthread...)
+ by 0x........: pthread_create@* (tc_intercepts.c:...)
+ by 0x........: main (hg02_deadlock.c:36)
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
+Thread #3: Lock acquisition order is inconsistent with previously observed ordering
+ at 0x........: pthread_mutex_lock (tc_intercepts.c:...)
+ by 0x........: t2 (hg02_deadlock.c:20)
+ by 0x........: mythread_wrapper (tc_intercepts.c:...)
+ by 0x........: ...
+ by 0x........: ...
+
+ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Modified: branches/THRCHECK/thrcheck/tests/hg03_inherit.stderr.exp
===================================================================
--- branches/THRCHECK/thrcheck/tests/hg03_inherit.stderr.exp 2007-10-03 20:34:03 UTC (rev 6933)
+++ branches/THRCHECK/thrcheck/tests/hg03_inherit.stderr.exp 2007-10-03 21:09:17 UTC (rev 6934)
@@ -4,13 +4,13 @@
Thread #3 was created
at 0x........: clone (in /...libc...)
by 0x........: ...
- by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.5.so)
- by 0x........: pthread_create@* (tc_intercepts.c:184)
+ by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib/libpthread...)
+ by 0x........: pthread_create@* (tc_intercepts.c:...)
by 0x........: main (hg03_inherit.c:46)
Possible data race during write to 0x........
at 0x........: t2 (hg03_inherit.c:28)
- by 0x........: mythread_wrapper (tc_intercepts.c:164)
+ by 0x........: mythread_wrapper (tc_intercepts.c:...)
by 0x........: ...
by 0x........: ...
Old state: shared-readonly by threads #1, #3
Modified: branches/THRCHECK/thrcheck/tests/hg04_race.stderr.exp
===================================================================
--- branches/THRCHECK/thrcheck/tests/hg04_race.stderr.exp 2007-10-03 20:34:03 UTC (rev 6933)
+++ branches/THRCHECK/thrcheck/tests/hg04_race.stderr.exp 2007-10-03 21:09:17 UTC (rev 6934)
@@ -2,20 +2,20 @@
Thread #2 was created
at 0x........: clone (in /...libc...)
by 0x........: ...
- by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.5.so)
- by 0x........: pthread_create@* (tc_intercepts.c:184)
+ by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib/libpthread...)
+ by 0x........: pthread_create@* (tc_intercepts.c:...)
by 0x........: main (hg04_race.c:19)
Thread #3 was created
at 0x........: clone (in /...libc...)
by 0x........: ...
- by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.5.so)
- by 0x........: pthread_create@* (tc_intercepts.c:184)
+ by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib/libpthread...)
+ by 0x........: pthread_create@* (tc_intercepts.c:...)
by 0x........: main (hg04_race.c:21)
Possible data race during write to 0x........
at 0x........: th (hg04_race.c:10)
- by 0x........: mythread_wrapper (tc_intercepts.c:164)
+ by 0x........: mythread_wrapper (tc_intercepts.c:...)
by 0x........: ...
by 0x........: ...
Old state: shared-readonly by threads #2, #3
Modified: branches/THRCHECK/thrcheck/tests/hg05_race2.stderr.exp
===================================================================
--- branches/THRCHECK/thrcheck/tests/hg05_race2.stderr.exp 2007-10-03 20:34:03 UTC (rev 6933)
+++ branches/THRCHECK/thrcheck/tests/hg05_race2.stderr.exp 2007-10-03 21:09:17 UTC (rev 6934)
@@ -2,20 +2,20 @@
Thread #2 was created
at 0x........: clone (in /...libc...)
by 0x........: ...
- by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.5.so)
- by 0x........: pthread_create@* (tc_intercepts.c:184)
+ by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib/libpthread...)
+ by 0x........: pthread_create@* (tc_intercepts.c:...)
by 0x........: main (hg05_race2.c:27)
Thread #3 was created
at 0x........: clone (in /...libc...)
by 0x........: ...
- by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.5.so)
- by 0x........: pthread_create@* (tc_intercepts.c:184)
+ by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib/libpthread...)
+ by 0x........: pthread_create@* (tc_intercepts.c:...)
by 0x........: main (hg05_race2.c:29)
Possible data race during write to 0x........
at 0x........: th (hg05_race2.c:17)
- by 0x........: mythread_wrapper (tc_intercepts.c:164)
+ by 0x........: mythread_wrapper (tc_intercepts.c:...)
by 0x........: ...
by 0x........: ...
Old state: shared-readonly by threads #2, #3
Modified: branches/THRCHECK/thrcheck/tests/tc01_simple_race.stderr.exp
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc01_simple_race.stderr.exp 2007-10-03 20:34:03 UTC (rev 6933)
+++ branches/THRCHECK/thrcheck/tests/tc01_simple_race.stderr.exp 2007-10-03 21:09:17 UTC (rev 6934)
@@ -4,8 +4,8 @@
Thread #2 was created
at 0x........: clone (in /...libc...)
by 0x........: ...
- by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.5.so)
- by 0x........: pthread_create@* (tc_intercepts.c:184)
+ by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib/libpthread...)
+ by 0x........: pthread_create@* (tc_intercepts.c:...)
by 0x........: main (tc01_simple_race.c:22)
Possible data race during write to 0x........
Modified: branches/THRCHECK/thrcheck/tests/tc04_free_lock.stderr.exp
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc04_free_lock.stderr.exp 2007-10-03 20:34:03 UTC (rev 6933)
+++ branches/THRCHECK/thrcheck/tests/tc04_free_lock.stderr.exp 2007-10-03 21:09:17 UTC (rev 6934)
@@ -5,14 +5,14 @@
at 0x........: free (vg_replace_malloc.c:...)
by 0x........: main (tc04_free_lock.c:24)
Lock at 0x........ was first observed
- at 0x........: pthread_mutex_init (tc_intercepts.c:299)
+ at 0x........: pthread_mutex_init (tc_intercepts.c:...)
by 0x........: main (tc04_free_lock.c:20)
Thread #1 deallocated location 0x........ containing a locked lock
at 0x........: bar (tc04_free_lock.c:40)
by 0x........: main (tc04_free_lock.c:26)
Lock at 0x........ was first observed
- at 0x........: pthread_mutex_lock (tc_intercepts.c:361)
+ at 0x........: pthread_mutex_lock (tc_intercepts.c:...)
by 0x........: bar (tc04_free_lock.c:38)
by 0x........: main (tc04_free_lock.c:26)
@@ -20,7 +20,7 @@
at 0x........: foo (tc04_free_lock.c:49)
by 0x........: main (tc04_free_lock.c:27)
Lock at 0x........ was first observed
- at 0x........: pthread_mutex_init (tc_intercepts.c:299)
+ at 0x........: pthread_mutex_init (tc_intercepts.c:...)
by 0x........: foo (tc04_free_lock.c:46)
by 0x........: main (tc04_free_lock.c:27)
@@ -28,7 +28,7 @@
at 0x........: bar (tc04_free_lock.c:40)
by 0x........: main (tc04_free_lock.c:28)
Lock at 0x........ was first observed
- at 0x........: pthread_mutex_lock (tc_intercepts.c:361)
+ at 0x........: pthread_mutex_lock (tc_intercepts.c:...)
by 0x........: bar (tc04_free_lock.c:38)
by 0x........: main (tc04_free_lock.c:28)
Modified: branches/THRCHECK/thrcheck/tests/tc05_simple_race.stderr.exp
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc05_simple_race.stderr.exp 2007-10-03 20:34:03 UTC (rev 6933)
+++ branches/THRCHECK/thrcheck/tests/tc05_simple_race.stderr.exp 2007-10-03 21:09:17 UTC (rev 6934)
@@ -4,8 +4,8 @@
Thread #2 was created
at 0x........: clone (in /...libc...)
by 0x........: ...
- by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.5.so)
- by 0x........: pthread_create@* (tc_intercepts.c:184)
+ by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib/libpthread...)
+ by 0x........: pthread_create@* (tc_intercepts.c:...)
by 0x........: main (tc05_simple_race.c:27)
Possible data race during write to 0x........
Modified: branches/THRCHECK/thrcheck/tests/tc06_two_races.stderr.exp
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc06_two_races.stderr.exp 2007-10-03 20:34:03 UTC (rev 6933)
+++ branches/THRCHECK/thrcheck/tests/tc06_two_races.stderr.exp 2007-10-03 21:09:17 UTC (rev 6934)
@@ -4,8 +4,8 @@
Thread #2 was created
at 0x........: clone (in /...libc...)
by 0x........: ...
- by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.5.so)
- by 0x........: pthread_create@* (tc_intercepts.c:184)
+ by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib/libpthread...)
+ by 0x........: pthread_create@* (tc_intercepts.c:...)
by 0x........: main (tc06_two_races.c:26)
Possible data race during write to 0x........
Modified: branches/THRCHECK/thrcheck/tests/tc08_hbl2.c
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc08_hbl2.c 2007-10-03 20:34:03 UTC (rev 6933)
+++ branches/THRCHECK/thrcheck/tests/tc08_hbl2.c 2007-10-03 21:09:17 UTC (rev 6934)
@@ -1,4 +1,17 @@
+/* FIXME: this is basically a bad test as it is scheduling-
+ sensitive. Sometimes the output is:
+
+ child: new value 6
+ child: new value 10
+ done, x = 10
+
+ and sometimes
+
+ child: new value 10
+ done, x = 10
+*/
+
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
Modified: branches/THRCHECK/thrcheck/tests/tc09_bad_unlock.stderr.exp
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc09_bad_unlock.stderr.exp 2007-10-03 20:34:03 UTC (rev 6933)
+++ branches/THRCHECK/thrcheck/tests/tc09_bad_unlock.stderr.exp 2007-10-03 21:09:17 UTC (rev 6934)
@@ -2,40 +2,41 @@
Thread #1 is the program's root thread
Thread #1 unlocked a not-locked lock at 0x........
- at 0x........: pthread_mutex_unlock (tc_intercepts.c:423)
+ at 0x........: pthread_mutex_unlock (tc_intercepts.c:...)
by 0x........: nearly_main (tc09_bad_unlock.c:27)
by 0x........: main (tc09_bad_unlock.c:49)
Lock at 0x........ was first observed
- at 0x........: pthread_mutex_init (tc_intercepts.c:299)
+ at 0x........: pthread_mutex_init (tc_intercepts.c:...)
by 0x........: nearly_main (tc09_bad_unlock.c:23)
by 0x........: main (tc09_bad_unlock.c:49)
Thread #2 was created
at 0x........: clone (in /...libc...)
by 0x........: ...
- by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.5.so)
- by 0x........: pthread_create@* (tc_intercepts.c:184)
+ by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib/libpthread...)
+ by 0x........: pthread_create@* (tc_intercepts.c:...)
by 0x........: nearly_main (tc09_bad_unlock.c:35)
by 0x........: main (tc09_bad_unlock.c:49)
Thread #2 unlocked lock at 0x........ currently held by thread #1
- at 0x........: pthread_mutex_unlock (tc_intercepts.c:423)
+ at 0x........: pthread_mutex_unlock (tc_intercepts.c:...)
by 0x........: child_fn (tc09_bad_unlock.c:11)
- by 0x........: mythread_wrapper (tc_intercepts.c:164)
+ by 0x........: mythread_wrapper (tc_intercepts.c:...)
by 0x........: ...
by 0x........: ...
Lock at 0x........ was first observed
- at 0x........: pthread_mutex_init (tc_intercepts.c:299)
+ at 0x........: pthread_mutex_init (tc_intercepts.c:...)
by 0x........: nearly_main (tc09_bad_unlock.c:31)
by 0x........: main (tc09_bad_unlock.c:49)
Thread #1 unlocked an invalid lock at 0x........
- at 0x........: pthread_mutex_unlock (tc_intercepts.c:423)
+ at 0x........: pthread_mutex_unlock (tc_intercepts.c:...)
by 0x........: nearly_main (tc09_bad_unlock.c:41)
by 0x........: main (tc09_bad_unlock.c:49)
-Thread #1's call to pthread_mutex_unlock failed with error 22 (EINVAL: Invalid argument)
- at 0x........: pthread_mutex_unlock (tc_intercepts.c:432)
+Thread #1's call to pthread_mutex_unlock failed
+ with error code 22 (EINVAL: Invalid argument)
+ at 0x........: pthread_mutex_unlock (tc_intercepts.c:...)
by 0x........: nearly_main (tc09_bad_unlock.c:41)
by 0x........: main (tc09_bad_unlock.c:49)
@@ -43,45 +44,46 @@
at 0x........: nearly_main (tc09_bad_unlock.c:45)
by 0x........: main (tc09_bad_unlock.c:49)
Lock at 0x........ was first observed
- at 0x........: pthread_mutex_init (tc_intercepts.c:299)
+ at 0x........: pthread_mutex_init (tc_intercepts.c:...)
by 0x........: nearly_main (tc09_bad_unlock.c:31)
by 0x........: main (tc09_bad_unlock.c:49)
Thread #1 unlocked a not-locked lock at 0x........
- at 0x........: pthread_mutex_unlock (tc_intercepts.c:423)
+ at 0x........: pthread_mutex_unlock (tc_intercepts.c:...)
by 0x........: nearly_main (tc09_bad_unlock.c:27)
by 0x........: main (tc09_bad_unlock.c:50)
Lock at 0x........ was first observed
- at 0x........: pthread_mutex_init (tc_intercepts.c:299)
+ at 0x........: pthread_mutex_init (tc_intercepts.c:...)
by 0x........: nearly_main (tc09_bad_unlock.c:23)
by 0x........: main (tc09_bad_unlock.c:50)
Thread #3 was created
at 0x........: clone (in /...libc...)
by 0x........: ...
- by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.5.so)
- by 0x........: pthread_create@* (tc_intercepts.c:184)
+ by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib/libpthread...)
+ by 0x........: pthread_create@* (tc_intercepts.c:...)
by 0x........: nearly_main (tc09_bad_unlock.c:35)
by 0x........: main (tc09_bad_unlock.c:50)
Thread #3 unlocked lock at 0x........ currently held by thread #1
- at 0x........: pthread_mutex_unlock (tc_intercepts.c:423)
+ at 0x........: pthread_mutex_unlock (tc_intercepts.c:...)
by 0x........: child_fn (tc09_bad_unlock.c:11)
- by 0x........: mythread_wrapper (tc_intercepts.c:164)
+ by 0x........: mythread_wrapper (tc_intercepts.c:...)
by 0x........: ...
by 0x........: ...
Lock at 0x........ was first observed
- at 0x........: pthread_mutex_init (tc_intercepts.c:299)
+ at 0x........: pthread_mutex_init (tc_intercepts.c:...)
by 0x........: nearly_main (tc09_bad_unlock.c:31)
by 0x........: main (tc09_bad_unlock.c:50)
Thread #1 unlocked an invalid lock at 0x........
- at 0x........: pthread_mutex_unlock (tc_intercepts.c:423)
+ at 0x........: pthread_mutex_unlock (tc_intercepts.c:...)
by 0x........: nearly_main (tc09_bad_unlock.c:41)
by 0x........: main (tc09_bad_unlock.c:50)
-Thread #1's call to pthread_mutex_unlock failed with error 22 (EINVAL: Invalid argument)
- at 0x........: pthread_mutex_unlock (tc_intercepts.c:432)
+Thread #1's call to pthread_mutex_unlock failed
+ with error code 22 (EINVAL: Invalid argument)
+ at 0x........: pthread_mutex_unlock (tc_intercepts.c:...)
by 0x........: nearly_main (tc09_bad_unlock.c:41)
by 0x........: main (tc09_bad_unlock.c:50)
@@ -89,7 +91,7 @@
at 0x........: nearly_main (tc09_bad_unlock.c:45)
by 0x........: main (tc09_bad_unlock.c:50)
Lock at 0x........ was first observed
- at 0x........: pthread_mutex_init (tc_intercepts.c:299)
+ at 0x........: pthread_mutex_init (tc_intercepts.c:...)
by 0x........: nearly_main (tc09_bad_unlock.c:31)
by 0x........: main (tc09_bad_unlock.c:50)
Modified: branches/THRCHECK/thrcheck/tests/tc10_rec_lock.stderr.exp
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc10_rec_lock.stderr.exp 2007-10-03 20:34:03 UTC (rev 6933)
+++ branches/THRCHECK/thrcheck/tests/tc10_rec_lock.stderr.exp 2007-10-03 21:09:17 UTC (rev 6934)
@@ -9,16 +9,17 @@
Thread #1 is the program's root thread
Thread #1 unlocked a not-locked lock at 0x........
- at 0x........: pthread_mutex_unlock (tc_intercepts.c:423)
+ at 0x........: pthread_mutex_unlock (tc_intercepts.c:...)
by 0x........: nearly_main (tc10_rec_lock.c:53)
by 0x........: main (tc10_rec_lock.c:58)
Lock at 0x........ was first observed
- at 0x........: pthread_mutex_init (tc_intercepts.c:299)
+ at 0x........: pthread_mutex_init (tc_intercepts.c:...)
by 0x........: nearly_main (tc10_rec_lock.c:35)
by 0x........: main (tc10_rec_lock.c:58)
-Thread #1's call to pthread_mutex_unlock failed with error 1 (EPERM: Operation not permitted)
- at 0x........: pthread_mutex_unlock (tc_intercepts.c:432)
+Thread #1's call to pthread_mutex_unlock failed
+ with error code 1 (EPERM: Operation not permitted)
+ at 0x........: pthread_mutex_unlock (tc_intercepts.c:...)
by 0x........: nearly_main (tc10_rec_lock.c:53)
by 0x........: main (tc10_rec_lock.c:58)
Modified: branches/THRCHECK/thrcheck/tests/tc12_rwl_trivial.stderr.exp
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc12_rwl_trivial.stderr.exp 2007-10-03 20:34:03 UTC (rev 6933)
+++ branches/THRCHECK/thrcheck/tests/tc12_rwl_trivial.stderr.exp 2007-10-03 21:09:17 UTC (rev 6934)
@@ -0,0 +1,11 @@
+
+Thread #1 is the program's root thread
+
+Thread #1 unlocked a not-locked lock at 0x........
+ at 0x........: pthread_rwlock_unlock (tc_intercepts.c:...)
+ by 0x........: main (tc12_rwl_trivial.c:24)
+ Lock at 0x........ was first observed
+ at 0x........: pthread_rwlock_init (tc_intercepts.c:...)
+ by 0x........: main (tc12_rwl_trivial.c:13)
+
+ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Modified: branches/THRCHECK/thrcheck/tests/tc13_laog1.stderr.exp
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc13_laog1.stderr.exp 2007-10-03 20:34:03 UTC (rev 6933)
+++ branches/THRCHECK/thrcheck/tests/tc13_laog1.stderr.exp 2007-10-03 21:09:17 UTC (rev 6934)
@@ -0,0 +1,8 @@
+
+Thread #1 is the program's root thread
+
+Thread #1: Lock acquisition order is inconsistent with previously observed ordering
+ at 0x........: pthread_mutex_lock (tc_intercepts.c:...)
+ by 0x........: main (tc13_laog1.c:24)
+
+ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Modified: branches/THRCHECK/thrcheck/tests/tc14_laog_dinphils.stderr.exp
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc14_laog_dinphils.stderr.exp 2007-10-03 20:34:03 UTC (rev 6933)
+++ branches/THRCHECK/thrcheck/tests/tc14_laog_dinphils.stderr.exp 2007-10-03 21:09:17 UTC (rev 6934)
@@ -0,0 +1,16 @@
+
+Thread #6 was created
+ at 0x........: clone (in /...libc...)
+ by 0x........: ...
+ by 0x........: pthread_create@@GLIBC_2.2.5 (in /lib/libpthread...)
+ by 0x........: pthread_create@* (tc_intercepts.c:...)
+ by 0x........: main (tc14_laog_dinphils.c:34)
+
+Thread #6: Lock acquisition order is inconsistent with previously observed ordering
+ at 0x........: pthread_mutex_lock (tc_intercepts.c:...)
+ by 0x........: dine (tc14_laog_dinphils.c:19)
+ by 0x........: mythread_wrapper (tc_intercepts.c:...)
+ by 0x........: ...
+ by 0x........: ...
+
+ERROR SUMMARY: 1000 errors from 1 contexts (suppressed: 0 from 0)
Modified: branches/THRCHECK/thrcheck/tests/tc15_laog_lockdel.c
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc15_laog_lockdel.c 2007-10-03 20:34:03 UTC (rev 6933)
+++ branches/THRCHECK/thrcheck/tests/tc15_laog_lockdel.c 2007-10-03 21:09:17 UTC (rev 6934)
@@ -4,8 +4,9 @@
#include <stdlib.h>
#include <assert.h>
-/* The simplest possible test that triggers a lock order acquisition
- error. */
+/* Test that locks, having entered the lock acquisition tracking
+ machinery, are forgotten by it when the memory they reside in
+ becomes inaccessible. */
int main ( void )
{
Modified: branches/THRCHECK/thrcheck/tests/tc15_laog_lockdel.stderr.exp
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc15_laog_lockdel.stderr.exp 2007-10-03 20:34:03 UTC (rev 6933)
+++ branches/THRCHECK/thrcheck/tests/tc15_laog_lockdel.stderr.exp 2007-10-03 21:09:17 UTC (rev 6934)
@@ -0,0 +1,13 @@
+
+Establish order 1 -> 2
+Try order 2 -> 1. This gives an error.
+Thread #1 is the program's root thread
+
+Thread #1: Lock acquisition order is inconsistent with previously observed ordering
+ at 0x........: pthread_mutex_lock (tc_intercepts.c:...)
+ by 0x........: main (tc15_laog_lockdel.c:36)
+Free 2 and re-allocate it. This gives it a new identity,
+so a second locking sequence 2 -> 1 should now be OK.
+done
+
+ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
|
|
From: <sv...@va...> - 2007-10-03 20:34:03
|
Author: sewardj
Date: 2007-10-03 21:34:03 +0100 (Wed, 03 Oct 2007)
New Revision: 6933
Log:
More regression tests.
Added:
branches/THRCHECK/thrcheck/tests/tc11_XCHG.vgtest
branches/THRCHECK/thrcheck/tests/tc12_rwl_trivial.c
branches/THRCHECK/thrcheck/tests/tc12_rwl_trivial.stderr.exp
branches/THRCHECK/thrcheck/tests/tc12_rwl_trivial.stdout.exp
branches/THRCHECK/thrcheck/tests/tc12_rwl_trivial.vgtest
branches/THRCHECK/thrcheck/tests/tc13_laog1.c
branches/THRCHECK/thrcheck/tests/tc13_laog1.stderr.exp
branches/THRCHECK/thrcheck/tests/tc13_laog1.stdout.exp
branches/THRCHECK/thrcheck/tests/tc13_laog1.vgtest
branches/THRCHECK/thrcheck/tests/tc14_laog_dinphils.c
branches/THRCHECK/thrcheck/tests/tc14_laog_dinphils.stderr.exp
branches/THRCHECK/thrcheck/tests/tc14_laog_dinphils.stdout.exp
branches/THRCHECK/thrcheck/tests/tc14_laog_dinphils.vgtest
branches/THRCHECK/thrcheck/tests/tc15_laog_lockdel.c
branches/THRCHECK/thrcheck/tests/tc15_laog_lockdel.stderr.exp
branches/THRCHECK/thrcheck/tests/tc15_laog_lockdel.stdout.exp
branches/THRCHECK/thrcheck/tests/tc15_laog_lockdel.vgtest
Modified:
branches/THRCHECK/thrcheck/tests/Makefile.am
Modified: branches/THRCHECK/thrcheck/tests/Makefile.am
===================================================================
--- branches/THRCHECK/thrcheck/tests/Makefile.am 2007-10-03 20:18:28 UTC (rev 6932)
+++ branches/THRCHECK/thrcheck/tests/Makefile.am 2007-10-03 20:34:03 UTC (rev 6933)
@@ -32,7 +32,15 @@
tc10_rec_lock.vgtest tc10_rec_lock.stderr.exp \
tc10_rec_lock.stdout.exp \
tc11_XCHG.vgtest tc11_XCHG.stderr.exp \
- tc11_XCHG.stdout.exp
+ tc11_XCHG.stdout.exp \
+ tc12_rwl_trivial.vgtest tc12_rwl_trivial.stderr.exp \
+ tc12_rwl_trivial.stdout.exp \
+ tc13_laog1.vgtest tc13_laog1.stderr.exp \
+ tc13_laog1.stdout.exp \
+ tc14_laog_dinphils.vgtest tc14_laog_dinphils.stderr.exp \
+ tc14_laog_dinphils.stdout.exp \
+ tc15_laog_lockdel.vgtest tc15_laog_lockdel.stderr.exp \
+ tc15_laog_lockdel.stdout.exp
check_PROGRAMS = \
hg01_all_ok \
@@ -51,7 +59,11 @@
tc08_hbl2 \
tc09_bad_unlock \
tc10_rec_lock \
- tc11_XCHG
+ tc11_XCHG \
+ tc12_rwl_trivial \
+ tc13_laog1 \
+ tc14_laog_dinphils \
+ tc15_laog_lockdel
# is this necessary?
AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g $(AM_FLAG_M3264_PRI)
Added: branches/THRCHECK/thrcheck/tests/tc11_XCHG.vgtest
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc11_XCHG.vgtest (rev 0)
+++ branches/THRCHECK/thrcheck/tests/tc11_XCHG.vgtest 2007-10-03 20:34:03 UTC (rev 6933)
@@ -0,0 +1 @@
+prog: tc11_XCHG
Added: branches/THRCHECK/thrcheck/tests/tc12_rwl_trivial.c
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc12_rwl_trivial.c (rev 0)
+++ branches/THRCHECK/thrcheck/tests/tc12_rwl_trivial.c 2007-10-03 20:34:03 UTC (rev 6933)
@@ -0,0 +1,29 @@
+
+#include <stdio.h>
+#include <pthread.h>
+#include <assert.h>
+
+/* Do trivial stuff with a reader-writer lock. */
+
+int main ( void )
+{
+ int r;
+ pthread_rwlock_t rwl;
+
+ r = pthread_rwlock_init( &rwl, NULL ); assert(r == 0);
+
+ r = pthread_rwlock_wrlock( &rwl ); assert(r == 0);
+ r = pthread_rwlock_unlock( &rwl ); assert(r == 0);
+
+ r = pthread_rwlock_rdlock( &rwl ); assert(r == 0);
+ r = pthread_rwlock_rdlock( &rwl ); assert(r == 0);
+ r = pthread_rwlock_unlock( &rwl ); assert(r == 0);
+ r = pthread_rwlock_unlock( &rwl ); assert(r == 0);
+
+ /* this should fail - lock is unowned now */
+ r = pthread_rwlock_unlock( &rwl ); assert(r == 0);
+
+ r = pthread_rwlock_destroy( &rwl ); assert(r == 0);
+
+ return 0;
+}
Added: branches/THRCHECK/thrcheck/tests/tc12_rwl_trivial.stderr.exp
===================================================================
Added: branches/THRCHECK/thrcheck/tests/tc12_rwl_trivial.stdout.exp
===================================================================
Added: branches/THRCHECK/thrcheck/tests/tc12_rwl_trivial.vgtest
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc12_rwl_trivial.vgtest (rev 0)
+++ branches/THRCHECK/thrcheck/tests/tc12_rwl_trivial.vgtest 2007-10-03 20:34:03 UTC (rev 6933)
@@ -0,0 +1 @@
+prog: tc12_rwl_trivial
Added: branches/THRCHECK/thrcheck/tests/tc13_laog1.c
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc13_laog1.c (rev 0)
+++ branches/THRCHECK/thrcheck/tests/tc13_laog1.c 2007-10-03 20:34:03 UTC (rev 6933)
@@ -0,0 +1,33 @@
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+/* The simplest possible test that triggers a lock order acquisition
+ error. */
+
+int main ( void )
+{
+ int r;
+ pthread_mutex_t mx1, mx2;
+ r = pthread_mutex_init( &mx1, NULL ); assert(r==0);
+ r = pthread_mutex_init( &mx2, NULL ); assert(r==0);
+
+ r = pthread_mutex_lock( &mx1 ); assert(r==0);
+ r = pthread_mutex_lock( &mx2 ); assert(r==0);
+
+ r = pthread_mutex_unlock( &mx1 ); assert(r==0);
+ r = pthread_mutex_unlock( &mx2 ); assert(r==0);
+
+ r = pthread_mutex_lock( &mx2 ); assert(r==0); /* error */
+ r = pthread_mutex_lock( &mx1 ); assert(r==0);
+
+ r = pthread_mutex_unlock( &mx1 ); assert(r==0);
+ r = pthread_mutex_unlock( &mx2 ); assert(r==0);
+
+ r = pthread_mutex_destroy( &mx1 );
+ r = pthread_mutex_destroy( &mx2 );
+
+ return 0;
+}
Added: branches/THRCHECK/thrcheck/tests/tc13_laog1.stderr.exp
===================================================================
Added: branches/THRCHECK/thrcheck/tests/tc13_laog1.stdout.exp
===================================================================
Added: branches/THRCHECK/thrcheck/tests/tc13_laog1.vgtest
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc13_laog1.vgtest (rev 0)
+++ branches/THRCHECK/thrcheck/tests/tc13_laog1.vgtest 2007-10-03 20:34:03 UTC (rev 6933)
@@ -0,0 +1 @@
+prog: tc13_laog1
Added: branches/THRCHECK/thrcheck/tests/tc14_laog_dinphils.c
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc14_laog_dinphils.c (rev 0)
+++ branches/THRCHECK/thrcheck/tests/tc14_laog_dinphils.c 2007-10-03 20:34:03 UTC (rev 6933)
@@ -0,0 +1,42 @@
+
+#include <pthread.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+/* Naive dining philosophers with inconsistent lock acquisition
+ ordering. */
+
+static pthread_t phil[5];
+static pthread_mutex_t chop[5];
+
+void* dine ( void* arg )
+{
+ int i;
+ long left = (long)arg;
+ long right = (left + 1) % 5;
+ for (i = 0; i < 1000/*arbitrary*/; i++) {
+ pthread_mutex_lock(&chop[left]);
+ pthread_mutex_lock(&chop[right]);
+ /* eating */
+ pthread_mutex_unlock(&chop[left]);
+ pthread_mutex_unlock(&chop[right]);
+ }
+ return NULL;
+}
+
+int main ( void )
+{
+ long i;
+ for (i = 0; i < 5; i++)
+ pthread_mutex_init( &chop[i], NULL);
+
+ for (i = 0; i < 5; i++)
+ pthread_create(&phil[i], NULL, dine, (void*)i );
+
+ sleep(1);
+
+ for (i = 0; i < 5; i++)
+ pthread_join(phil[i], NULL);
+
+ return 0;
+}
Added: branches/THRCHECK/thrcheck/tests/tc14_laog_dinphils.stderr.exp
===================================================================
Added: branches/THRCHECK/thrcheck/tests/tc14_laog_dinphils.stdout.exp
===================================================================
Added: branches/THRCHECK/thrcheck/tests/tc14_laog_dinphils.vgtest
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc14_laog_dinphils.vgtest (rev 0)
+++ branches/THRCHECK/thrcheck/tests/tc14_laog_dinphils.vgtest 2007-10-03 20:34:03 UTC (rev 6933)
@@ -0,0 +1 @@
+prog: tc14_laog_dinphils
Added: branches/THRCHECK/thrcheck/tests/tc15_laog_lockdel.c
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc15_laog_lockdel.c (rev 0)
+++ branches/THRCHECK/thrcheck/tests/tc15_laog_lockdel.c 2007-10-03 20:34:03 UTC (rev 6933)
@@ -0,0 +1,67 @@
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+/* The simplest possible test that triggers a lock order acquisition
+ error. */
+
+int main ( void )
+{
+ int r;
+ pthread_mutex_t *mx1, *mx2;
+
+ mx1 = malloc(sizeof(pthread_mutex_t));
+ mx2 = malloc(sizeof(pthread_mutex_t));
+
+ assert(mx1);
+ assert(mx2);
+
+ r = pthread_mutex_init( mx1, NULL ); assert(r==0);
+ r = pthread_mutex_init( mx2, NULL ); assert(r==0);
+
+ /* Establish order 1 -> 2 */
+ fprintf(stderr, "Establish order 1 -> 2\n");
+ r = pthread_mutex_lock( mx1 ); assert(r==0);
+ r = pthread_mutex_lock( mx2 ); assert(r==0);
+
+ r = pthread_mutex_unlock( mx1 ); assert(r==0);
+ r = pthread_mutex_unlock( mx2 ); assert(r==0);
+
+ /* Try order 2 -> 1. This gives an error. */
+ fprintf(stderr, "Try order 2 -> 1. This gives an error.\n");
+ r = pthread_mutex_lock( mx2 ); assert(r==0); /* error */
+ r = pthread_mutex_lock( mx1 ); assert(r==0);
+
+ r = pthread_mutex_unlock( mx1 ); assert(r==0);
+ r = pthread_mutex_unlock( mx2 ); assert(r==0);
+
+ /* Free 2 and re-allocate it. This gives it a new identity,
+ so a second locking sequence 2 -> 1 should now be OK. */
+ fprintf(stderr,
+ "Free 2 and re-allocate it. This gives it a new identity,\n");
+ fprintf(stderr, "so a second locking sequence 2 -> 1 should now be OK.\n");
+ pthread_mutex_destroy( mx2 );
+ free(mx2);
+ mx2 = malloc(sizeof(pthread_mutex_t));
+ assert(mx2);
+ r = pthread_mutex_init( mx2, NULL ); assert(r==0);
+
+ r = pthread_mutex_lock( mx2 ); assert(r==0); /* error */
+ r = pthread_mutex_lock( mx1 ); assert(r==0);
+
+ r = pthread_mutex_unlock( mx1 ); assert(r==0);
+ r = pthread_mutex_unlock( mx2 ); assert(r==0);
+
+ /* done */
+
+ fprintf(stderr, "done\n");
+ r = pthread_mutex_destroy( mx1 );
+ r = pthread_mutex_destroy( mx2 );
+
+ free( mx1 );
+ free( mx2 );
+
+ return 0;
+}
Added: branches/THRCHECK/thrcheck/tests/tc15_laog_lockdel.stderr.exp
===================================================================
Added: branches/THRCHECK/thrcheck/tests/tc15_laog_lockdel.stdout.exp
===================================================================
Added: branches/THRCHECK/thrcheck/tests/tc15_laog_lockdel.vgtest
===================================================================
--- branches/THRCHECK/thrcheck/tests/tc15_laog_lockdel.vgtest (rev 0)
+++ branches/THRCHECK/thrcheck/tests/tc15_laog_lockdel.vgtest 2007-10-03 20:34:03 UTC (rev 6933)
@@ -0,0 +1 @@
+prog: tc15_laog_lockdel
|
|
From: <sv...@va...> - 2007-10-03 20:18:32
|
Author: sewardj
Date: 2007-10-03 21:18:28 +0100 (Wed, 03 Oct 2007)
New Revision: 6932
Log:
Rewrite the lock order acquisition tracking machinery so it's (more
likely to be) correct. Unfortunately the performance is now very
poor.
Modified:
branches/THRCHECK/thrcheck/tc_main.c
Modified: branches/THRCHECK/thrcheck/tc_main.c
===================================================================
--- branches/THRCHECK/thrcheck/tc_main.c 2007-10-03 01:08:20 UTC (rev 6931)
+++ branches/THRCHECK/thrcheck/tc_main.c 2007-10-03 20:18:28 UTC (rev 6932)
@@ -3945,6 +3945,119 @@
/* lock order acquisition graph */
static WordFM* laog = NULL; /* WordFM LockPair* void */
+static void laog__show ( void ) {
+ LockPair* edge;
+ VG_(printf)("laog {\n");
+ TC_(initIterFM)( laog );
+ edge = NULL;
+ while (TC_(nextIterFM)( laog, (Word*)&edge, NULL)) {
+ tl_assert(edge);
+ VG_(printf)(" %p -> %p\n", edge->fst, edge->snd);
+ edge = NULL;
+ }
+ TC_(doneIterFM)( laog );
+ VG_(printf)("}\n");
+}
+
+static void laog__add_edge ( Lock* src, Lock* dst ) {
+ LockPair key;
+ key.fst = src;
+ key.snd = dst;
+ if (TC_(lookupFM)( laog, NULL, NULL, (Word)&key )) {
+ /* already present; do nothing */
+ } else {
+ LockPair* nyu = tc_zalloc(sizeof(LockPair));
+ tl_assert(nyu);
+ *nyu = key;
+ TC_(addToFM)( laog, (Word)nyu, (Word)0 );
+ }
+}
+
+static void laog__del_edge ( Lock* src, Lock* dst ) {
+ Bool b;
+ LockPair key;
+ LockPair* old = NULL;
+ key.fst = src;
+ key.snd = dst;
+ b = TC_(delFromFM)( laog, (Word*)&old, NULL, (Word)&key );
+ tl_assert(b);
+ tl_assert(old);
+ tc_free(old);
+}
+
+static WordSetID /* in univ_lsets */ laog__step ( Lock* lk, Bool succs ) {
+ LockPair* edge;
+ WordSetID result;
+ result = TC_(emptyWS)( univ_lsets );
+ TC_(initIterFM)( laog );
+ edge = NULL;
+ while (TC_(nextIterFM)( laog, (Word*)&edge, NULL)) {
+ tl_assert(edge);
+ if (succs) {
+ if (edge->fst == lk)
+ result = TC_(addToWS)( univ_lsets, result, (Word)edge->snd );
+ } else {
+ if (edge->snd == lk)
+ result = TC_(addToWS)( univ_lsets, result, (Word)edge->fst );
+ }
+ edge = NULL;
+ }
+ TC_(doneIterFM)( laog );
+ return result;
+}
+
+static WordSetID /* in univ_lsets */ laog__succs ( Lock* lk ) {
+ return laog__step( lk, True /* get successors of 'lk' */ );
+}
+
+static WordSetID /* in univ_lsets */ laog__preds ( Lock* lk ) {
+ return laog__step( lk, False /* get predecessors of 'lk' */ );
+}
+
+static Bool laog__do_dfs_from_to ( Lock* src, Lock* dst )
+{
+ Bool ret;
+ Word i, ssz;
+ XArray* stack; /* of Lock* */
+ WordFM* visited; /* Lock* -> void, iow, Set(Lock*) */
+ Lock* here;
+ WordSetID succs;
+ Word succs_size;
+ Word* succs_words;
+
+ stack = VG_(newXA)( tc_zalloc, tc_free, sizeof(Lock*) );
+ visited = TC_(newFM)( tc_zalloc, tc_free, NULL/*unboxedcmp*/ );
+
+ (void) VG_(addToXA)( stack, &src );
+
+ while (True) {
+
+ ssz = VG_(sizeXA)( stack );
+
+ if (ssz == 0) { ret = False; break; }
+
+ here = *(Lock**) VG_(indexXA)( stack, ssz-1 );
+ VG_(dropTailXA)( stack, 1 );
+
+ if (here == dst) { ret = True; break; }
+
+ if (TC_(lookupFM)( visited, NULL, NULL, (Word)here ))
+ continue;
+
+ TC_(addToFM)( visited, (Word)here, 0 );
+
+ succs = laog__succs( here );
+ TC_(getPayloadWS)( &succs_words, &succs_size, univ_lsets, succs );
+ for (i = 0; i < succs_size; i++)
+ (void) VG_(addToXA)( stack, &succs_words[i] );
+ }
+
+ TC_(deleteFM)( visited, NULL, NULL );
+ VG_(deleteXA)( stack );
+ return ret;
+}
+
+
/* Thread 'thr' is acquiring 'lk'. Check for inconsistent ordering
between 'lk' and the locks already held by 'thr' and issue a
complaint if so. Also, update the ordering graph appropriately.
@@ -3954,7 +4067,6 @@
Lock* lk
)
{
- LockPair key;
Word* ls_words;
Word ls_size, i;
Bool complain;
@@ -3968,15 +4080,13 @@
laog = TC_(newFM)( tc_zalloc, tc_free,
(Word(*)(Word,Word)) cmp_LockPair );
- /* First, the check. Complain if
- any (lk, old) `elem` laog | old <- locks already held by thr
+ /* First, the check. Complain if there is any path in laog
+ from lk to old for each old <- locks already held by thr.
*/
complain = False;
TC_(getPayloadWS)( &ls_words, &ls_size, univ_lsets, thr->locksetA );
for (i = 0; i < ls_size; i++) {
- key.fst = lk;
- key.snd = (Lock*)ls_words[i];
- if (TC_(lookupFM)( laog, NULL, NULL, (Word)&key)) {
+ if (laog__do_dfs_from_to( lk, (Lock*)ls_words[i] )) {
complain = True;
break;
}
@@ -3989,75 +4099,48 @@
/* Second, add to laog the pairs
(old, lk) | old <- locks already held by thr
*/
- for (i = 0; i < ls_size; i++) {
- key.fst = (Lock*)ls_words[i];
- key.snd = lk;
- if (TC_(lookupFM)( laog, NULL, NULL, (Word)&key )) {
- /* already present; do nothing */
- } else {
- LockPair* nyu = tc_zalloc(sizeof(LockPair));
- tl_assert(nyu);
- *nyu = key;
- TC_(addToFM)( laog, (Word)nyu, (Word)0 );
- }
- }
+ for (i = 0; i < ls_size; i++)
+ laog__add_edge( (Lock*)ls_words[i], lk );
}
/* Delete from 'laog' any pair mentioning a lock in locksToDelete */
-static void laog__handle_lock_deletions (
- WordSetID /* in univ_lsets */ locksToDelete
- )
+
+static void laog__handle_one_lock_deletion ( Lock* lk )
{
- Word i;
- XArray* pairsToDelete;
+ WordSetID preds, succs;
+ Word preds_size, succs_size, i, j;
+ Word *preds_words, *succs_words;
- tl_assert( laog );
- tl_assert( ! TC_(isEmptyWS)( univ_lsets, locksToDelete ) );
+ preds = laog__preds( lk );
+ succs = laog__succs( lk );
- /* We can't iterate over laog whilst simultaneously deleting stuff
- from it (unfortunately). So first round up all the ones to
- delete into an XArray and then delete them afterwards. All
- storage associated with the XArray is deleted at the end by
- VG_(deleteXA). */
- pairsToDelete = VG_(newXA)( tc_zalloc, tc_free, sizeof(LockPair) );
- tl_assert(pairsToDelete);
+ TC_(getPayloadWS)( &preds_words, &preds_size, univ_lsets, preds );
+ for (i = 0; i < preds_size; i++)
+ laog__del_edge( (Lock*)preds_words[i], lk );
- /* ok. here we go ... */
- { Word shouldBeZero = 1;
- LockPair* pair = NULL;
- TC_(initIterFM)( laog );
- while (TC_(nextIterFM)( laog, (Word*)&pair, &shouldBeZero)) {
- tl_assert(shouldBeZero == 0);
- tl_assert(pair);
- tl_assert(is_sane_LockN(pair->fst));
- tl_assert(is_sane_LockN(pair->snd));
- /* copy *pair into to pairsToDelete */
- VG_(addToXA)( pairsToDelete, pair );
- shouldBeZero = 1;
- pair = NULL;
- }
- TC_(doneIterFM)( laog );
- }
+ TC_(getPayloadWS)( &succs_words, &succs_size, univ_lsets, succs );
+ for (j = 0; j < succs_size; j++)
+ laog__del_edge( lk, (Lock*)succs_words[j] );
- for (i = 0; i < VG_(sizeXA)( pairsToDelete ); i++) {
- LockPair* p2 = NULL;
- LockPair* p = VG_(indexXA)( pairsToDelete, i );
- /* p points into the internal array of pairsToDelete; that is,
- it is a copy of the the one in the FM. It is not the same.
- Hence we need to delete it from the FM and then free up the
- one in the FM. Fortunately TC_(delFromFM) gives us back a
- pointer to the old key. */
- Bool b = TC_(delFromFM)( laog, (Word*)&p2, NULL, (Word)p );
- tl_assert(b); /* it must previously have been present (!) */
- tl_assert(p2 != p); /* p is a copy of the original, not a pointer to it */
- tl_assert(p2->fst == p->fst); /* ... but it contains the same stuff */
- tl_assert(p2->snd == p->snd);
- tc_free(p2);
+ for (i = 0; i < preds_size; i++) {
+ for (j = 0; j < succs_size; j++) {
+ if (preds_words[i] != succs_words[j])
+ laog__add_edge( (Lock*)preds_words[i], (Lock*)succs_words[j] );
+ }
}
+}
- /* finally ... */
- VG_(deleteXA)( pairsToDelete );
+static void laog__handle_lock_deletions (
+ WordSetID /* in univ_lsets */ locksToDelete
+ )
+{
+ Word i, ws_size;
+ Word* ws_words;
+
+ TC_(getPayloadWS)( &ws_words, &ws_size, univ_lsets, locksToDelete );
+ for (i = 0; i < ws_size; i++)
+ laog__handle_one_lock_deletion( (Lock*)ws_words[i] );
}
|
|
From: <js...@ac...> - 2007-10-03 14:03:38
|
Nightly build on minnie ( SuSE 10.0, ppc32 ) started at 2007-10-03 09:00: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 == 220 tests, 10 stderr failures, 6 stdout failures, 0 posttest failures == memcheck/tests/leak-tree (stderr) memcheck/tests/leakotron (stdout) memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_changes (stderr) memcheck/tests/xml1 (stderr) none/tests/faultstatus (stderr) none/tests/fdleak_cmsg (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) none/tests/ppc32/jm-fp (stdout) none/tests/ppc32/jm-fp (stderr) none/tests/ppc32/round (stdout) none/tests/ppc32/round (stderr) none/tests/ppc32/test_fx (stdout) none/tests/ppc32/test_fx (stderr) none/tests/ppc32/test_gx (stdout) |
|
From: Bart V. A. <bar...@gm...> - 2007-10-03 11:39:11
|
On 10/3/07, Julian Seward <js...@ac...> wrote: > > > > I agree with the concerns raised above. But regarding (3): how about the > > warnings gcc emits on format strings like "%,d", which are supported by > > Valgrind but which are not allowed by ANSI C ? > > I wondered about that too, but at least using gcc 4.1.2 I got no > complaints > about "%,d". So it seems ok. Do you have a setup/gcc version in which it > does complain about "%,d" ? > > J > The trend with gcc is that new versions move closer to the ANSI standard. Since the comma is not a valid flag character in ANSI C, we can expect that a future gcc version will complain about it. Do you think it would be a good idea to modify the Valgrind source code such that the formatting functions adhere strictly to the ANSI C standard and to remove extensions like the insertion of comma's as a thousands separator ? I'm in favor of this -- I find it confusing that Valgrind's format specifications differ slightly from those in the C language. Additionally, as far as I know there is currently no documentation available for Valgrind's format specifications. For more about format strings, see also paragraph 7.19.6.1 (The fprintf function) in http://std.dkuug.dk/JTC1/SC22/WG14/www/docs/n843.pdf Bart. |
|
From: Julian S. <js...@ac...> - 2007-10-03 11:07:09
|
> I agree with the concerns raised above. But regarding (3): how about the > warnings gcc emits on format strings like "%,d", which are supported by > Valgrind but which are not allowed by ANSI C ? I wondered about that too, but at least using gcc 4.1.2 I got no complaints about "%,d". So it seems ok. Do you have a setup/gcc version in which it does complain about "%,d" ? J |
|
From: Bart V. A. <bar...@gm...> - 2007-10-03 10:54:39
|
On 10/3/07, Julian Seward <js...@ac...> wrote: > > > > I'm wondering what is the right thing to do here. Having the format > string > > warnings is nice, but we should be consistent. Eg. when printing > pointers, > > should we use %p and cast to (void*) when necessary, instead of using > > 0x%lx? > > In the long run fixing the format strings to keep gcc happy seems to me > a good thing to do. Most of the fixing required is in reconciling > Addr/Word/UWord args with %p formats, either by casting the arg to void* > or changing the format to 0x%lx. Just occasionally gcc reports something > more interesting, about too few arguments, or a fundamental type > mismatch (32-bit int vs word-size int vs 64-bit int, etc). > > My concerns are: > > (1) that the output is not changed at all > > (2) it's a lot of boring work. Just a build for amd64-linux alone > generates 1438 warnings that need to be fixed. > > (3) it's not worth doing unless we can be sure to get rid of all > warnings when built with all versions of gcc we care about. > Because I don't want to end up in a situation where a supposedly > clean build still produces warnings. At least for valgrind 3.2.X > I tried to ensure it would still build and work on RedHat 7.3, which > uses gcc-2.96, so that's a pretty old compiler. > > Given these, and particularly (3), possibly a good solution is to do it > on a svn branch, and, if it looks ok, merge it. After all, that is what > branches are for. > > J > I agree with the concerns raised above. But regarding (3): how about the warnings gcc emits on format strings like "%,d", which are supported by Valgrind but which are not allowed by ANSI C ? I'm afraid every version of gcc that supports format string checking will emit a warning on such format strings. For an example of code that uses this kind of format specifications, see e.g. memcheck/mc_malloc_wrappers.c. Bart. |
|
From: Julian S. <js...@ac...> - 2007-10-03 10:22:19
|
> I'm wondering what is the right thing to do here. Having the format string
> warnings is nice, but we should be consistent. Eg. when printing pointers,
> should we use %p and cast to (void*) when necessary, instead of using
> 0x%lx?
In the long run fixing the format strings to keep gcc happy seems to me
a good thing to do. Most of the fixing required is in reconciling
Addr/Word/UWord args with %p formats, either by casting the arg to void*
or changing the format to 0x%lx. Just occasionally gcc reports something
more interesting, about too few arguments, or a fundamental type
mismatch (32-bit int vs word-size int vs 64-bit int, etc).
My concerns are:
(1) that the output is not changed at all
(2) it's a lot of boring work. Just a build for amd64-linux alone
generates 1438 warnings that need to be fixed.
(3) it's not worth doing unless we can be sure to get rid of all
warnings when built with all versions of gcc we care about.
Because I don't want to end up in a situation where a supposedly
clean build still produces warnings. At least for valgrind 3.2.X
I tried to ensure it would still build and work on RedHat 7.3, which
uses gcc-2.96, so that's a pretty old compiler.
Given these, and particularly (3), possibly a good solution is to do it
on a svn branch, and, if it looks ok, merge it. After all, that is what
branches are for.
J
|
|
From: Tom H. <th...@cy...> - 2007-10-03 02:31:00
|
Nightly build on alvis ( i686, Red Hat 7.3 ) started at 2007-10-03 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 == 256 tests, 27 stderr failures, 1 stdout failure, 0 posttest failures == memcheck/tests/addressable (stderr) memcheck/tests/badjump (stderr) memcheck/tests/describe-block (stderr) memcheck/tests/erringfds (stderr) memcheck/tests/leak-0 (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-pool-0 (stderr) memcheck/tests/leak-pool-1 (stderr) memcheck/tests/leak-pool-2 (stderr) memcheck/tests/leak-pool-3 (stderr) memcheck/tests/leak-pool-4 (stderr) memcheck/tests/leak-pool-5 (stderr) memcheck/tests/leak-regroot (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/long_namespace_xml (stderr) memcheck/tests/match-overrun (stderr) memcheck/tests/partial_load_dflt (stderr) memcheck/tests/partial_load_ok (stderr) memcheck/tests/partiallydefinedeq (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/sigkill (stderr) memcheck/tests/stack_changes (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/mremap (stderr) none/tests/mremap2 (stdout) |
|
From: Tom H. <th...@cy...> - 2007-10-03 02:23:08
|
Nightly build on dellow ( x86_64, Fedora 7 ) started at 2007-10-03 03:10: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 == 293 tests, 4 stderr failures, 2 stdout failures, 0 posttest failures == memcheck/tests/pointer-trace (stderr) memcheck/tests/vcpu_fnfns (stdout) memcheck/tests/x86/scalar (stderr) memcheck/tests/xml1 (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) |
|
From: Tom H. <th...@cy...> - 2007-10-03 02:19:51
|
Nightly build on lloyd ( x86_64, Fedora 7 ) started at 2007-10-03 03:05: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 == 293 tests, 4 stderr failures, 2 stdout failures, 0 posttest failures == memcheck/tests/pointer-trace (stderr) memcheck/tests/vcpu_fnfns (stdout) memcheck/tests/x86/scalar (stderr) memcheck/tests/xml1 (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) |
|
From: Tom H. <th...@cy...> - 2007-10-03 02:15:36
|
Nightly build on gill ( x86_64, Fedora Core 2 ) started at 2007-10-03 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 == 295 tests, 6 stderr failures, 1 stdout failure, 0 posttest failures == memcheck/tests/pointer-trace (stderr) memcheck/tests/stack_switch (stderr) memcheck/tests/x86/scalar (stderr) memcheck/tests/x86/scalar_supp (stderr) none/tests/fdleak_fcntl (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) |
|
From: Nicholas N. <nj...@cs...> - 2007-10-03 01:30:11
|
On Mon, 1 Oct 2007, Bart Van Assche wrote: > Do you really know what you are doing ? You are not just fixing warnings, > you are changing code. In trunk/coregrind/m_stacktrace.c you changed the > format string %08p into %p. As a result, the printed pointers are no longer > right-aligned. Did you understand what I wrote in the mail I sent on > September 26 to the valgrind-developers mailing list ? I'm wondering what is the right thing to do here. Having the format string warnings is nice, but we should be consistent. Eg. when printing pointers, should we use %p and cast to (void*) when necessary, instead of using 0x%lx? Julian, what do you think? Nick |
|
From: <sv...@va...> - 2007-10-03 01:08:18
|
Author: sewardj
Date: 2007-10-03 02:08:20 +0100 (Wed, 03 Oct 2007)
New Revision: 6931
Log:
First pass at detection of potential deadlocks resulting from
inconsistent lock acquisition orderings.
Modified:
branches/THRCHECK/thrcheck/tc_main.c
branches/THRCHECK/thrcheck/tc_wordfm.c
branches/THRCHECK/thrcheck/tc_wordfm.h
Modified: branches/THRCHECK/thrcheck/tc_main.c
===================================================================
--- branches/THRCHECK/thrcheck/tc_main.c 2007-10-02 09:40:23 UTC (rev 6930)
+++ branches/THRCHECK/thrcheck/tc_main.c 2007-10-03 01:08:20 UTC (rev 6931)
@@ -1179,12 +1179,14 @@
static void map_locks_delete ( Addr ga )
{
- Lock* lk = NULL;
- TC_(delFromFM)( map_locks, (Word*)&lk, (Word)ga );
+ Addr ga2 = 0;
+ Lock* lk = NULL;
+ TC_(delFromFM)( map_locks, (Word*)&ga2, (Word*)&lk, (Word)ga );
/* delFromFM produces the val which is being deleted, if it is
found. So assert it is non-null; that in effect asserts that we
are deleting a (ga, Lock) pair which actually exists. */
tl_assert(lk != NULL);
+ tl_assert(ga2 == ga);
}
@@ -2513,6 +2515,9 @@
/*--- Address range handlers ---*/
/*----------------------------------------------------------------*/
+static void laog__pre_thread_acquires_lock ( Thread*, Lock* ); /* fwds */
+static void laog__handle_lock_deletions ( WordSetID ); /* fwds */
+
static void remove_Lock_from_locksets_of_all_owning_Threads( Lock* lk )
{
Thread* thr;
@@ -2646,6 +2651,9 @@
VG_(printf)("shadow_mem_make_NoAccess(%p, %u, %p): maybe slow case\n",
(void*)a, (UWord)len, (void*)(a+len-1));
+ /* update lock order acquisition graph */
+ laog__handle_lock_deletions( locksToDelete );
+
/* Modify all shadow words, by removing locksToDelete from the lockset
of all ShM and ShR states.
Optimisation 1: skip SecMaps which do not have .hasShared set
@@ -2891,6 +2899,8 @@
goto noerror;
noerror:
+ /* check lock order acquisition graph, and update */
+ laog__pre_thread_acquires_lock( thr, lk );
/* update the thread's held-locks set */
thr->locksetA = TC_(addToWS)( univ_lsets, thr->locksetA, (Word)lk );
thr->locksetW = TC_(addToWS)( univ_lsets, thr->locksetW, (Word)lk );
@@ -2957,6 +2967,8 @@
goto noerror;
noerror:
+ /* check lock order acquisition graph, and update */
+ laog__pre_thread_acquires_lock( thr, lk );
/* update the thread's held-locks set */
thr->locksetA = TC_(addToWS)( univ_lsets, thr->locksetA, (Word)lk );
/* but don't update thr->locksetW, since lk is only rd-held */
@@ -3911,6 +3923,145 @@
/*--------------------------------------------------------------*/
+/*--- Lock acquisition order monitoring ---*/
+/*--------------------------------------------------------------*/
+
+/* Indicates that .fst must always be acquired before .snd */
+typedef
+ struct {
+ Lock* fst;
+ Lock* snd;
+ }
+ LockPair;
+
+static Word cmp_LockPair ( LockPair* lp1, LockPair* lp2 ) {
+ if (lp1->fst < lp2->fst) return -1;
+ if (lp1->fst > lp2->fst) return 1;
+ if (lp1->snd < lp2->snd) return -1;
+ if (lp1->snd > lp2->snd) return 1;
+ return 0;
+}
+
+/* lock order acquisition graph */
+static WordFM* laog = NULL; /* WordFM LockPair* void */
+
+/* Thread 'thr' is acquiring 'lk'. Check for inconsistent ordering
+ between 'lk' and the locks already held by 'thr' and issue a
+ complaint if so. Also, update the ordering graph appropriately.
+*/
+static void laog__pre_thread_acquires_lock (
+ Thread* thr, /* NB: BEFORE lock is added */
+ Lock* lk
+ )
+{
+ LockPair key;
+ Word* ls_words;
+ Word ls_size, i;
+ Bool complain;
+
+ /* It may be that 'thr' already holds 'lk' and is recursively
+ relocking in. In this case we just ignore the call. */
+ if (TC_(elemWS)( univ_lsets, thr->locksetA, (Word)lk ))
+ return;
+
+ if (!laog)
+ laog = TC_(newFM)( tc_zalloc, tc_free,
+ (Word(*)(Word,Word)) cmp_LockPair );
+
+ /* First, the check. Complain if
+ any (lk, old) `elem` laog | old <- locks already held by thr
+ */
+ complain = False;
+ TC_(getPayloadWS)( &ls_words, &ls_size, univ_lsets, thr->locksetA );
+ for (i = 0; i < ls_size; i++) {
+ key.fst = lk;
+ key.snd = (Lock*)ls_words[i];
+ if (TC_(lookupFM)( laog, NULL, NULL, (Word)&key)) {
+ complain = True;
+ break;
+ }
+ }
+ if (complain) {
+ record_error_Misc( thr, "Lock acquisition order is inconsistent "
+ "with previously observed ordering" );
+ }
+
+ /* Second, add to laog the pairs
+ (old, lk) | old <- locks already held by thr
+ */
+ for (i = 0; i < ls_size; i++) {
+ key.fst = (Lock*)ls_words[i];
+ key.snd = lk;
+ if (TC_(lookupFM)( laog, NULL, NULL, (Word)&key )) {
+ /* already present; do nothing */
+ } else {
+ LockPair* nyu = tc_zalloc(sizeof(LockPair));
+ tl_assert(nyu);
+ *nyu = key;
+ TC_(addToFM)( laog, (Word)nyu, (Word)0 );
+ }
+ }
+}
+
+
+/* Delete from 'laog' any pair mentioning a lock in locksToDelete */
+static void laog__handle_lock_deletions (
+ WordSetID /* in univ_lsets */ locksToDelete
+ )
+{
+ Word i;
+ XArray* pairsToDelete;
+
+ tl_assert( laog );
+ tl_assert( ! TC_(isEmptyWS)( univ_lsets, locksToDelete ) );
+
+ /* We can't iterate over laog whilst simultaneously deleting stuff
+ from it (unfortunately). So first round up all the ones to
+ delete into an XArray and then delete them afterwards. All
+ storage associated with the XArray is deleted at the end by
+ VG_(deleteXA). */
+ pairsToDelete = VG_(newXA)( tc_zalloc, tc_free, sizeof(LockPair) );
+ tl_assert(pairsToDelete);
+
+ /* ok. here we go ... */
+ { Word shouldBeZero = 1;
+ LockPair* pair = NULL;
+ TC_(initIterFM)( laog );
+ while (TC_(nextIterFM)( laog, (Word*)&pair, &shouldBeZero)) {
+ tl_assert(shouldBeZero == 0);
+ tl_assert(pair);
+ tl_assert(is_sane_LockN(pair->fst));
+ tl_assert(is_sane_LockN(pair->snd));
+ /* copy *pair into to pairsToDelete */
+ VG_(addToXA)( pairsToDelete, pair );
+ shouldBeZero = 1;
+ pair = NULL;
+ }
+ TC_(doneIterFM)( laog );
+ }
+
+ for (i = 0; i < VG_(sizeXA)( pairsToDelete ); i++) {
+ LockPair* p2 = NULL;
+ LockPair* p = VG_(indexXA)( pairsToDelete, i );
+ /* p points into the internal array of pairsToDelete; that is,
+ it is a copy of the the one in the FM. It is not the same.
+ Hence we need to delete it from the FM and then free up the
+ one in the FM. Fortunately TC_(delFromFM) gives us back a
+ pointer to the old key. */
+ Bool b = TC_(delFromFM)( laog, (Word*)&p2, NULL, (Word)p );
+ tl_assert(b); /* it must previously have been present (!) */
+ tl_assert(p2 != p); /* p is a copy of the original, not a pointer to it */
+ tl_assert(p2->fst == p->fst); /* ... but it contains the same stuff */
+ tl_assert(p2->snd == p->snd);
+ tc_free(p2);
+ }
+
+ /* finally ... */
+ VG_(deleteXA)( pairsToDelete );
+}
+
+
+/*--------------------------------------------------------------*/
/*--- Malloc/free replacements ---*/
/*--------------------------------------------------------------*/
Modified: branches/THRCHECK/thrcheck/tc_wordfm.c
===================================================================
--- branches/THRCHECK/thrcheck/tc_wordfm.c 2007-10-02 09:40:23 UTC (rev 6930)
+++ branches/THRCHECK/thrcheck/tc_wordfm.c 2007-10-03 01:08:20 UTC (rev 6931)
@@ -568,12 +568,15 @@
fm->dealloc(node);
}
-// Delete key from fm, returning associated val if found
-Bool TC_(delFromFM) ( WordFM* fm, /*OUT*/Word* oldV, Word key )
+// Delete key from fm, returning associated key and val if found
+Bool TC_(delFromFM) ( WordFM* fm,
+ /*OUT*/Word* oldK, /*OUT*/Word* oldV, Word 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;
fm->dealloc(node);
@@ -769,7 +772,7 @@
TC_(addToFM)(bag->fm, w, count-1);
} else {
tl_assert(count == 1);
- TC_(delFromFM)( bag->fm, NULL, w );
+ TC_(delFromFM)( bag->fm, NULL, NULL, w );
}
return True;
} else {
Modified: branches/THRCHECK/thrcheck/tc_wordfm.h
===================================================================
--- branches/THRCHECK/thrcheck/tc_wordfm.h 2007-10-02 09:40:23 UTC (rev 6930)
+++ branches/THRCHECK/thrcheck/tc_wordfm.h 2007-10-03 01:08:20 UTC (rev 6931)
@@ -73,8 +73,9 @@
previous v so that caller can finalise it. Oh well. */
void TC_(addToFM) ( WordFM* fm, Word k, Word v );
-// Delete key from fm, returning associated val if found
-Bool TC_(delFromFM) ( WordFM* fm, /*OUT*/Word* oldV, Word key );
+// Delete key from fm, returning associated key and val if found
+Bool TC_(delFromFM) ( WordFM* fm,
+ /*OUT*/Word* oldK, /*OUT*/Word* oldV, Word key );
// Look up in fm, assigning found key & val at spec'd addresses
Bool TC_(lookupFM) ( WordFM* fm,
|
|
From: <js...@ac...> - 2007-10-03 00:17:22
|
Nightly build on g5 ( SuSE 10.1, ppc970 ) started at 2007-10-03 02:00:01 CEST 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 == 228 tests, 6 stderr failures, 2 stdout failures, 0 posttest failures == memcheck/tests/deep_templates (stdout) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/pointer-trace (stderr) none/tests/faultstatus (stderr) none/tests/fdleak_cmsg (stderr) none/tests/mremap (stderr) none/tests/mremap2 (stdout) |