|
From: <sv...@va...> - 2009-02-21 16:17:55
|
Author: bart
Date: 2009-02-21 16:17:50 +0000 (Sat, 21 Feb 2009)
New Revision: 9214
Log:
- Bug fix: swapped order of VG_(OSetGen_Remove)() and
(*p->any.cleanup)(p) such that the "first observed at" information is
now included in error messages.
- Performance optimization: started using VG_(OSetGen_ResetIterAt)().
Modified:
trunk/drd/drd_clientobj.c
trunk/drd/tests/bar_bad.stderr.exp
trunk/drd/tests/tc04_free_lock.stderr.exp
trunk/drd/tests/tc09_bad_unlock.stderr.exp
trunk/drd/tests/tc20_verifywrap.stderr.exp-glibc2.3
trunk/drd/tests/tc20_verifywrap.stderr.exp-glibc2.5
trunk/drd/tests/tc20_verifywrap.stderr.exp-glibc2.5-ppc
trunk/drd/tests/tc20_verifywrap.stderr.exp-glibc2.8
trunk/drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3
trunk/drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3-b
trunk/drd/tests/tc20_verifywrap2.stderr.exp-glibc2.5
trunk/drd/tests/tc20_verifywrap2.stderr.exp-glibc2.5-ppc
trunk/drd/tests/tc20_verifywrap2.stderr.exp-glibc2.8
Modified: trunk/drd/drd_clientobj.c
===================================================================
--- trunk/drd/drd_clientobj.c 2009-02-21 16:13:50 UTC (rev 9213)
+++ trunk/drd/drd_clientobj.c 2009-02-21 16:17:50 UTC (rev 9214)
@@ -85,9 +85,10 @@
return VG_(OSetGen_Lookup)(s_clientobj_set, &addr);
}
-/** Return the data associated with the client object at client address addr
- * and that has object type t. Return 0 if there is no client object in the
- * set with the specified start address.
+/**
+ * Return the data associated with the client object at client address addr
+ * and that has object type t. Return 0 if there is no client object in the
+ * set with the specified start address.
*/
DrdClientobj* DRD_(clientobj_get)(const Addr addr, const ObjType t)
{
@@ -144,6 +145,12 @@
return p;
}
+/**
+ * Remove the information that was stored about the client object.
+ *
+ * @param[in] addr Address of the client object in the client address space.
+ * @param[in] t Type of the client object.
+ */
Bool DRD_(clientobj_remove)(const Addr addr, const ObjType t)
{
DrdClientobj* p;
@@ -154,27 +161,28 @@
return clientobj_remove_obj(p);
}
+/**
+ * Remove the information that was stored about the client object p.
+ *
+ * @note The order of operations below is important. The client object is
+ * removed from the client object set after the cleanup function has been
+ * called such that if the cleanup function can still use the function
+ * DRD_(clientobj_get_any)(). This happens e.g. in the function
+ * first_observed() in drd_error.c.
+ */
static Bool clientobj_remove_obj(DrdClientobj* const p)
{
- DrdClientobj* q;
+ tl_assert(p);
if (s_trace_clientobj)
{
VG_(message)(Vg_UserMsg, "Removing client object 0x%lx of type %d",
p->any.a1, p->any.type);
-#if 0
- VG_(get_and_pp_StackTrace)(VG_(get_running_tid)(),
- VG_(clo_backtrace_size));
-#endif
}
- tl_assert(p);
- q = VG_(OSetGen_Remove)(s_clientobj_set, &p->any.a1);
- tl_assert(p == q);
-
- tl_assert(VG_(OSetGen_Lookup)(s_clientobj_set, &p->any.a1) == 0);
tl_assert(p->any.cleanup);
(*p->any.cleanup)(p);
+ VG_(OSetGen_Remove)(s_clientobj_set, &p->any.a1);
VG_(OSetGen_FreeNode)(s_clientobj_set, p);
return True;
}
@@ -196,13 +204,10 @@
if (a1 <= p->any.a1 && p->any.a1 < a2)
{
removed_at = p->any.a1;
- DRD_(clientobj_remove)(p->any.a1, p->any.type);
+ clientobj_remove_obj(p);
/* The above call removes an element from the oset and hence */
/* invalidates the iterator. Set the iterator back. */
- VG_(OSetGen_ResetIter)(s_clientobj_set);
- while ((p = VG_(OSetGen_Next)(s_clientobj_set)) != 0
- && p->any.a1 <= removed_at)
- { }
+ VG_(OSetGen_ResetIterAt)(s_clientobj_set, &removed_at);
}
else
{
Modified: trunk/drd/tests/bar_bad.stderr.exp
===================================================================
--- trunk/drd/tests/bar_bad.stderr.exp 2009-02-21 16:13:50 UTC (rev 9213)
+++ trunk/drd/tests/bar_bad.stderr.exp 2009-02-21 16:17:50 UTC (rev 9214)
@@ -34,6 +34,9 @@
Destruction of barrier that is being waited upon: barrier 0x........
at 0x........: pthread_barrier_destroy (drd_pthread_intercepts.c:?)
by 0x........: main (bar_bad.c:?)
+barrier 0x........ was first observed at:
+ at 0x........: pthread_barrier_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (bar_bad.c:?)
destroy a barrier that was never initialised
@@ -44,3 +47,6 @@
Destruction of barrier that is being waited upon: barrier 0x........
at 0x........: free (vg_replace_malloc.c:...)
by 0x........: main (bar_bad.c:?)
+barrier 0x........ was first observed at:
+ at 0x........: pthread_barrier_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (bar_bad.c:?)
Modified: trunk/drd/tests/tc04_free_lock.stderr.exp
===================================================================
--- trunk/drd/tests/tc04_free_lock.stderr.exp 2009-02-21 16:13:50 UTC (rev 9213)
+++ trunk/drd/tests/tc04_free_lock.stderr.exp 2009-02-21 16:17:50 UTC (rev 9214)
@@ -2,17 +2,32 @@
Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
at 0x........: free (vg_replace_malloc.c:...)
by 0x........: main (tc04_free_lock.c:24)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc04_free_lock.c:20)
Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
at 0x........: bar (tc04_free_lock.c:40)
by 0x........: main (tc04_free_lock.c:26)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_lock (drd_pthread_intercepts.c:?)
+ by 0x........: bar (tc04_free_lock.c:38)
+ by 0x........: main (tc04_free_lock.c:26)
Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
at 0x........: foo (tc04_free_lock.c:49)
by 0x........: main (tc04_free_lock.c:27)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: foo (tc04_free_lock.c:46)
+ by 0x........: main (tc04_free_lock.c:27)
Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
at 0x........: bar (tc04_free_lock.c:40)
by 0x........: main (tc04_free_lock.c:28)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_lock (drd_pthread_intercepts.c:?)
+ by 0x........: bar (tc04_free_lock.c:38)
+ by 0x........: main (tc04_free_lock.c:28)
ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0)
Modified: trunk/drd/tests/tc09_bad_unlock.stderr.exp
===================================================================
--- trunk/drd/tests/tc09_bad_unlock.stderr.exp 2009-02-21 16:13:50 UTC (rev 9213)
+++ trunk/drd/tests/tc09_bad_unlock.stderr.exp 2009-02-21 16:17:50 UTC (rev 9214)
@@ -29,6 +29,10 @@
Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
at 0x........: nearly_main (tc09_bad_unlock.c:45)
by 0x........: main (tc09_bad_unlock.c:49)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: nearly_main (tc09_bad_unlock.c:31)
+ by 0x........: main (tc09_bad_unlock.c:49)
---------------------
Mutex not locked by calling thread: mutex 0x........, recursion count 0, owner 1.
@@ -61,5 +65,9 @@
Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
at 0x........: nearly_main (tc09_bad_unlock.c:45)
by 0x........: main (tc09_bad_unlock.c:50)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: nearly_main (tc09_bad_unlock.c:31)
+ by 0x........: main (tc09_bad_unlock.c:50)
ERROR SUMMARY: 8 errors from 8 contexts (suppressed: 0 from 0)
Modified: trunk/drd/tests/tc20_verifywrap.stderr.exp-glibc2.3
===================================================================
--- trunk/drd/tests/tc20_verifywrap.stderr.exp-glibc2.3 2009-02-21 16:13:50 UTC (rev 9213)
+++ trunk/drd/tests/tc20_verifywrap.stderr.exp-glibc2.3 2009-02-21 16:17:50 UTC (rev 9214)
@@ -24,6 +24,9 @@
Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
at 0x........: pthread_mutex_destroy (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:102)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc20_verifywrap.c:100)
make pthread_mutex_lock fail: skipped on glibc < 2.4
@@ -132,8 +135,14 @@
Destroying locked rwlock: rwlock 0x.........
at 0x........: main (tc20_verifywrap.c:262)
+rwlock 0x........ was first observed at:
+ at 0x........: pthread_rwlock_init* (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc20_verifywrap.c:216)
Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
at 0x........: main (tc20_verifywrap.c:262)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc20_verifywrap.c:145)
ERROR SUMMARY: 15 errors from 15 contexts (suppressed: 0 from 0)
Modified: trunk/drd/tests/tc20_verifywrap.stderr.exp-glibc2.5
===================================================================
--- trunk/drd/tests/tc20_verifywrap.stderr.exp-glibc2.5 2009-02-21 16:13:50 UTC (rev 9213)
+++ trunk/drd/tests/tc20_verifywrap.stderr.exp-glibc2.5 2009-02-21 16:17:50 UTC (rev 9214)
@@ -24,6 +24,9 @@
Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
at 0x........: pthread_mutex_destroy (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:102)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc20_verifywrap.c:100)
The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_lock (drd_pthread_intercepts.c:?)
@@ -136,8 +139,14 @@
Destroying locked rwlock: rwlock 0x.........
at 0x........: main (tc20_verifywrap.c:262)
+rwlock 0x........ was first observed at:
+ at 0x........: pthread_rwlock_init* (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc20_verifywrap.c:216)
Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
at 0x........: main (tc20_verifywrap.c:262)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc20_verifywrap.c:145)
ERROR SUMMARY: 16 errors from 16 contexts (suppressed: 0 from 0)
Modified: trunk/drd/tests/tc20_verifywrap.stderr.exp-glibc2.5-ppc
===================================================================
--- trunk/drd/tests/tc20_verifywrap.stderr.exp-glibc2.5-ppc 2009-02-21 16:13:50 UTC (rev 9213)
+++ trunk/drd/tests/tc20_verifywrap.stderr.exp-glibc2.5-ppc 2009-02-21 16:17:50 UTC (rev 9214)
@@ -24,6 +24,9 @@
Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
at 0x........: pthread_mutex_destroy (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:102)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc20_verifywrap.c:100)
The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_lock (drd_pthread_intercepts.c:?)
Modified: trunk/drd/tests/tc20_verifywrap.stderr.exp-glibc2.8
===================================================================
--- trunk/drd/tests/tc20_verifywrap.stderr.exp-glibc2.8 2009-02-21 16:13:50 UTC (rev 9213)
+++ trunk/drd/tests/tc20_verifywrap.stderr.exp-glibc2.8 2009-02-21 16:17:50 UTC (rev 9214)
@@ -24,6 +24,9 @@
Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
at 0x........: pthread_mutex_destroy (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:102)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc20_verifywrap.c:100)
The object at address 0x........ is not a mutex.
at 0x........: pthread_mutex_lock (drd_pthread_intercepts.c:?)
Modified: trunk/drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3
===================================================================
--- trunk/drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3 2009-02-21 16:13:50 UTC (rev 9213)
+++ trunk/drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3 2009-02-21 16:17:50 UTC (rev 9214)
@@ -159,10 +159,16 @@
Destroying locked rwlock: rwlock 0x.........
at 0x........: main (tc20_verifywrap.c:262)
+rwlock 0x........ was first observed at:
+ at 0x........: pthread_rwlock_init* (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc20_verifywrap.c:216)
[1/1] mutex_destroy error checking mutex 0x........ rc 1 owner 1
Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
at 0x........: main (tc20_verifywrap.c:262)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc20_verifywrap.c:145)
[1/1] mutex_destroy invalid mutex 0x........ rc 0 owner 0
[1/1] mutex_trylock recursive mutex 0x........ rc 0 owner 0
[1/1] post_mutex_lock recursive mutex 0x........ rc 0 owner 0
Modified: trunk/drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3-b
===================================================================
--- trunk/drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3-b 2009-02-21 16:13:50 UTC (rev 9213)
+++ trunk/drd/tests/tc20_verifywrap2.stderr.exp-glibc2.3-b 2009-02-21 16:17:50 UTC (rev 9214)
@@ -159,10 +159,16 @@
Destroying locked rwlock: rwlock 0x.........
at 0x........: main (tc20_verifywrap.c:262)
+rwlock 0x........ was first observed at:
+ at 0x........: pthread_rwlock_init* (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc20_verifywrap.c:216)
[1/1] mutex_destroy error checking mutex 0x........ rc 1 owner 1
Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
at 0x........: main (tc20_verifywrap.c:262)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc20_verifywrap.c:145)
[1/1] mutex_destroy invalid mutex 0x........ rc 0 owner 0
[1/1] mutex_trylock recursive mutex 0x........ rc 0 owner 0
[1/1] post_mutex_lock recursive mutex 0x........ rc 0 owner 0
Modified: trunk/drd/tests/tc20_verifywrap2.stderr.exp-glibc2.5
===================================================================
--- trunk/drd/tests/tc20_verifywrap2.stderr.exp-glibc2.5 2009-02-21 16:13:50 UTC (rev 9213)
+++ trunk/drd/tests/tc20_verifywrap2.stderr.exp-glibc2.5 2009-02-21 16:17:50 UTC (rev 9214)
@@ -29,6 +29,9 @@
Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
at 0x........: pthread_mutex_destroy (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:102)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc20_verifywrap.c:100)
[1/1] mutex_trylock invalid mutex 0x........ rc 0 owner 0
The object at address 0x........ is not a mutex.
@@ -165,10 +168,16 @@
Destroying locked rwlock: rwlock 0x.........
at 0x........: main (tc20_verifywrap.c:262)
+rwlock 0x........ was first observed at:
+ at 0x........: pthread_rwlock_init* (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc20_verifywrap.c:216)
[1/1] mutex_destroy error checking mutex 0x........ rc 1 owner 1
Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
at 0x........: main (tc20_verifywrap.c:262)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc20_verifywrap.c:145)
[1/1] mutex_destroy invalid mutex 0x........ rc 0 owner 0
[1/1] mutex_trylock recursive mutex 0x........ rc 0 owner 0
[1/1] post_mutex_lock recursive mutex 0x........ rc 0 owner 0
Modified: trunk/drd/tests/tc20_verifywrap2.stderr.exp-glibc2.5-ppc
===================================================================
--- trunk/drd/tests/tc20_verifywrap2.stderr.exp-glibc2.5-ppc 2009-02-21 16:13:50 UTC (rev 9213)
+++ trunk/drd/tests/tc20_verifywrap2.stderr.exp-glibc2.5-ppc 2009-02-21 16:17:50 UTC (rev 9214)
@@ -29,6 +29,9 @@
Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
at 0x........: pthread_mutex_destroy (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:102)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc20_verifywrap.c:100)
[1/1] mutex_trylock invalid mutex 0x........ rc 0 owner 0
The object at address 0x........ is not a mutex.
Modified: trunk/drd/tests/tc20_verifywrap2.stderr.exp-glibc2.8
===================================================================
--- trunk/drd/tests/tc20_verifywrap2.stderr.exp-glibc2.8 2009-02-21 16:13:50 UTC (rev 9213)
+++ trunk/drd/tests/tc20_verifywrap2.stderr.exp-glibc2.8 2009-02-21 16:17:50 UTC (rev 9214)
@@ -29,6 +29,9 @@
Destroying locked mutex: mutex 0x........, recursion count 1, owner 1.
at 0x........: pthread_mutex_destroy (drd_pthread_intercepts.c:?)
by 0x........: main (tc20_verifywrap.c:102)
+mutex 0x........ was first observed at:
+ at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (tc20_verifywrap.c:100)
[1/1] mutex_trylock invalid mutex 0x........ rc 0 owner 0
The object at address 0x........ is not a mutex.
|