Added DRD_(thread_address_on_any_stack)().

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9338 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/drd/drd_thread.h b/drd/drd_thread.h
index 919ca92..d861464 100644
--- a/drd/drd_thread.h
+++ b/drd/drd_thread.h
@@ -253,6 +253,27 @@
 	  && a < DRD_(g_threadinfo)[DRD_(g_drd_running_tid)].stack_max);
 }
 
+/**
+ * Return true if and only if the specified address is on the stack of any
+ * thread.
+ */
+static __inline__
+Bool DRD_(thread_address_on_any_stack)(const Addr a)
+{
+  int i;
+
+  for (i = 1; i < DRD_N_THREADS; i++)
+  {
+    if (DRD_(g_threadinfo)[i].vg_thread_exists
+        && DRD_(g_threadinfo)[i].stack_min <= a
+	&& a < DRD_(g_threadinfo)[i].stack_max)
+    {
+      return True;
+    }
+  }
+  return False;
+}
+
 /** Return a pointer to the latest segment for the specified thread. */
 static __inline__
 Segment* DRD_(thread_get_segment)(const DrdThreadId tid)