Added new command-line option --trace-rwlock. Added regression test exp-drd/tests/rwlock_race. Updated to do list. Fixed bug in vc_min(), the function that computes the elementwise minimum of two vector clocks. Fixed bug in thread_update_danger_set(). Fixed recently introduced bug in mutex code with regard to vector clock combining.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7549 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/exp-drd/drd_thread.c b/exp-drd/drd_thread.c
index 6a151d4..8807117 100644
--- a/exp-drd/drd_thread.c
+++ b/exp-drd/drd_thread.c
@@ -582,7 +582,7 @@
 }
 
 /**
- * Discard all segments that have a defined ordered against the latest vector
+ * Discard all segments that have a defined order against the latest vector
  * clock of every thread -- these segments can no longer be involved in a
  * data race.
  */
@@ -875,7 +875,7 @@
       VG_(message)(Vg_DebugMsg, "%s", msg);
    }
 
-   for (p = s_threadinfo[tid].first; p; p = p->next)
+   p = s_threadinfo[tid].last;
    {
       unsigned j;
 
@@ -896,7 +896,8 @@
       {
          if (IsValidDrdThreadId(j))
          {
-            const Segment* const q = s_threadinfo[j].last;
+            const Segment* q;
+            for (q = s_threadinfo[j].last; q; q = q->prev)
             if (j != tid && q != 0
                 && ! vc_lte(&q->vc, &p->vc) && ! vc_lte(&p->vc, &q->vc))
             {