]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Added "_W" suffix to stack sizes to indicate they are in words.
authorNicholas Nethercote <njn@valgrind.org>
Thu, 1 May 2003 08:06:41 +0000 (08:06 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Thu, 1 May 2003 08:06:41 +0000 (08:06 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1578

coregrind/vg_include.h
coregrind/vg_main.c
coregrind/vg_signals.c

index 103c052c14f80f906fe7704656de99559afe7807..2d2131cb32e44d22a6fdad1b4ed3386ca590a4f3 100644 (file)
 /* Max number of callers for context in a suppression. */
 #define VG_N_SUPP_CALLERS  4
 
-/* Valgrind's stack sizes */
-#define VG_STACK_SIZE       10000
-#define VG_SIGSTACK_SIZE    10000
+/* Valgrind's stack sizes, in words */
+#define VG_STACK_SIZE_W       10000
+#define VG_SIGSTACK_SIZE_W    10000
 
 
 /* ---------------------------------------------------------------------
@@ -1305,13 +1305,13 @@ extern void VG_(unimplemented) ( Char* msg )
 
 /* The stack on which Valgrind runs.  We can't use the same stack as the
    simulatee -- that's an important design decision.  */
-extern UInt VG_(stack)[VG_STACK_SIZE];
+extern UInt VG_(stack)[VG_STACK_SIZE_W];
 
 /* Similarly, we have to ask for signals to be delivered on an alternative
    stack, since it is possible, although unlikely, that we'll have to run
    client code from inside the Valgrind-installed signal handler.  If this
    happens it will be done by vg_deliver_signal_immediately(). */
-extern UInt VG_(sigstack)[VG_SIGSTACK_SIZE];
+extern UInt VG_(sigstack)[VG_SIGSTACK_SIZE_W];
 
 /* Holds client's %esp at the point we gained control.  From this the
    client's argc, argv and envp are deduced. */
index 73801fbdc226d73f188ae347a602714bd7edc1ae..dbfb1326e901d068f9a0a251fff252d4ceb36ec5 100644 (file)
@@ -413,10 +413,10 @@ static void vg_init_baseBlock ( void )
 
 /* The stack on which Valgrind runs.  We can't use the same stack as
    the simulatee -- that's an important design decision.  */
-UInt VG_(stack)[VG_STACK_SIZE];
+UInt VG_(stack)[VG_STACK_SIZE_W];
 
 /* Ditto our signal delivery stack. */
-UInt VG_(sigstack)[VG_SIGSTACK_SIZE];
+UInt VG_(sigstack)[VG_SIGSTACK_SIZE_W];
 
 /* Saving stuff across system calls. */
 __attribute__ ((aligned (16)))
@@ -1422,9 +1422,9 @@ void VG_(main) ( void )
 
    /* Set up our stack sanity-check words. */
    for (i = 0; i < 10; i++) {
-      VG_(stack)[i] = (UInt)(&VG_(stack)[i])                 ^ 0xA4B3C2D1;
-      VG_(stack)[VG_STACK_SIZE-1-i] 
-                    = (UInt)(&VG_(stack)[VG_STACK_SIZE-i-1]) ^ 0xABCD4321;
+      VG_(stack)[i] = (UInt)(&VG_(stack)[i])                   ^ 0xA4B3C2D1;
+      VG_(stack)[VG_STACK_SIZE_W-1-i] 
+                    = (UInt)(&VG_(stack)[VG_STACK_SIZE_W-i-1]) ^ 0xABCD4321;
    }
 
    /* Read /proc/self/maps into a buffer.  Must be before:
@@ -1811,8 +1811,8 @@ void VG_(do_sanity_checks) ( Bool force_expensive )
    for (i = 0; i < 10; i++) {
       vg_assert(VG_(stack)[i]
                 == ((UInt)(&VG_(stack)[i]) ^ 0xA4B3C2D1));
-      vg_assert(VG_(stack)[VG_STACK_SIZE-1-i] 
-                == ((UInt)(&VG_(stack)[VG_STACK_SIZE-i-1]) ^ 0xABCD4321));
+      vg_assert(VG_(stack)[VG_STACK_SIZE_W-1-i] 
+                == ((UInt)(&VG_(stack)[VG_STACK_SIZE_W-i-1]) ^ 0xABCD4321));
    }
 
    /* Check stuff pertaining to the memory check system. */
index 4ac642bc6716aafe9f00936ea402ed8033b9e8df..4cafe3864037fc365b606b51adc156792add8919 100644 (file)
@@ -1323,12 +1323,12 @@ void vg_oursignalhandler ( Int sigNo )
 
    /* Sanity check.  Ensure we're really running on the signal stack
       we asked for. */
-   if ( !(
-          ((Char*)(&(VG_(sigstack)[0])) <= (Char*)(&dummy_local))
-          &&
-          ((Char*)(&dummy_local) < (Char*)(&(VG_(sigstack)[VG_SIGSTACK_SIZE])))
+   if (!(
+         ((Char*)(&(VG_(sigstack)[0])) <= (Char*)(&dummy_local))
+         &&
+         ((Char*)(&dummy_local) < (Char*)(&(VG_(sigstack)[VG_SIGSTACK_SIZE_W])))
          )
-        ) {
+      ) {
      VG_(message)(Vg_DebugMsg, 
         "FATAL: signal delivered on the wrong stack?!");
      VG_(message)(Vg_DebugMsg, 
@@ -1341,7 +1341,7 @@ void vg_oursignalhandler ( Int sigNo )
    }
 
    vg_assert((Char*)(&(VG_(sigstack)[0])) <= (Char*)(&dummy_local));
-   vg_assert((Char*)(&dummy_local) < (Char*)(&(VG_(sigstack)[VG_SIGSTACK_SIZE])));
+   vg_assert((Char*)(&dummy_local) < (Char*)(&(VG_(sigstack)[VG_SIGSTACK_SIZE_W])));
 
    VG_(block_all_host_signals)( &saved_procmask );
 
@@ -1495,7 +1495,7 @@ void VG_(sigstartup_actions) ( void )
 
    /* Register an alternative stack for our own signal handler to run on. */
    altstack_info.ss_sp = &(VG_(sigstack)[0]);
-   altstack_info.ss_size = VG_SIGSTACK_SIZE * sizeof(UInt);
+   altstack_info.ss_size = VG_SIGSTACK_SIZE_W * sizeof(UInt);
    altstack_info.ss_flags = 0;
    ret = VG_(ksigaltstack)(&altstack_info, NULL);
    if (ret != 0) {