]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Changed the order of the function definitions.
authorBart Van Assche <bvanassche@acm.org>
Sun, 15 Feb 2009 10:36:32 +0000 (10:36 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sun, 15 Feb 2009 10:36:32 +0000 (10:36 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9162

drd/drd_clientreq.c

index fef90c1a69e2658dd15ab8f1aaf40a888e467617..4384c04ffc507f6c056291f636099fd87a1f6687 100644 (file)
@@ -47,48 +47,15 @@ Bool DRD_(handle_client_request)(ThreadId vg_tid, UWord* arg, UWord* ret);
 static Addr DRD_(highest_used_stack_address)(const ThreadId vg_tid);
 
 
+/* Function definitions. */
+
 /**
- * Walk the stack up to the highest stack frame, and return the stack pointer
- * of the highest stack frame. It is assumed that there are no more than
- * ten stack frames above the current frame. This should be no problem
- * since this function is either called indirectly from the _init() function
- * in vgpreload_exp-drd-*.so or from the thread wrapper for a newly created
- * thread. See also drd_pthread_intercepts.c.
+ * Tell the Valgrind core the address of the DRD function that processes
+ * client requests. Must be called before any client code is run.
  */
-static Addr DRD_(highest_used_stack_address)(const ThreadId vg_tid)
+void DRD_(clientreq_init)(void)
 {
-    UInt nframes;
-    const UInt n_ips = 10;
-    UInt i;
-    Addr ips[n_ips], sps[n_ips];
-    Addr husa;
-
-    nframes = VG_(get_StackTrace)(vg_tid, ips, n_ips, sps, 0, 0);
-    tl_assert(1 <= nframes && nframes <= n_ips);
-
-    /* A hack to work around VG_(get_StackTrace)()'s behavior that sometimes */
-    /* the topmost stackframes it returns are bogus (this occurs sometimes   */
-    /* at least on amd64, ppc32 and ppc64).                                  */
-
-    husa = sps[0];
-
-    tl_assert(VG_(thread_get_stack_max)(vg_tid)
-              - VG_(thread_get_stack_size)(vg_tid) <= husa
-              && husa < VG_(thread_get_stack_max)(vg_tid));
-
-    for (i = 1; i < nframes; i++)
-    {
-      if (sps[i] == 0)
-        break;
-      if (husa < sps[i] && sps[i] < VG_(thread_get_stack_max)(vg_tid))
-        husa = sps[i];
-    }
-
-    tl_assert(VG_(thread_get_stack_max)(vg_tid)
-              - VG_(thread_get_stack_size)(vg_tid) <= husa
-              && husa < VG_(thread_get_stack_max)(vg_tid));
-
-    return husa;
+  VG_(needs_client_requests)(DRD_(handle_client_request));
 }
 
 /**
@@ -411,10 +378,45 @@ Bool DRD_(handle_client_request)(ThreadId vg_tid, UWord* arg, UWord* ret)
 }
 
 /**
- * Tell the Valgrind core the address of the DRD function that processes
- * client requests. Must be called before any client code is run.
+ * Walk the stack up to the highest stack frame, and return the stack pointer
+ * of the highest stack frame. It is assumed that there are no more than
+ * ten stack frames above the current frame. This should be no problem
+ * since this function is either called indirectly from the _init() function
+ * in vgpreload_exp-drd-*.so or from the thread wrapper for a newly created
+ * thread. See also drd_pthread_intercepts.c.
  */
-void DRD_(clientreq_init)(void)
+static Addr DRD_(highest_used_stack_address)(const ThreadId vg_tid)
 {
-  VG_(needs_client_requests)(DRD_(handle_client_request));
+    UInt nframes;
+    const UInt n_ips = 10;
+    UInt i;
+    Addr ips[n_ips], sps[n_ips];
+    Addr husa;
+
+    nframes = VG_(get_StackTrace)(vg_tid, ips, n_ips, sps, 0, 0);
+    tl_assert(1 <= nframes && nframes <= n_ips);
+
+    /* A hack to work around VG_(get_StackTrace)()'s behavior that sometimes */
+    /* the topmost stackframes it returns are bogus (this occurs sometimes   */
+    /* at least on amd64, ppc32 and ppc64).                                  */
+
+    husa = sps[0];
+
+    tl_assert(VG_(thread_get_stack_max)(vg_tid)
+              - VG_(thread_get_stack_size)(vg_tid) <= husa
+              && husa < VG_(thread_get_stack_max)(vg_tid));
+
+    for (i = 1; i < nframes; i++)
+    {
+      if (sps[i] == 0)
+        break;
+      if (husa < sps[i] && sps[i] < VG_(thread_get_stack_max)(vg_tid))
+        husa = sps[i];
+    }
+
+    tl_assert(VG_(thread_get_stack_max)(vg_tid)
+              - VG_(thread_get_stack_size)(vg_tid) <= husa
+              && husa < VG_(thread_get_stack_max)(vg_tid));
+
+    return husa;
 }