From: Nicholas Nethercote Date: Thu, 1 May 2003 08:06:41 +0000 (+0000) Subject: Added "_W" suffix to stack sizes to indicate they are in words. X-Git-Tag: svn/VALGRIND_2_0_0~182 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4bf271eb18e147a86876e4ed9edb271f69d9179b;p=thirdparty%2Fvalgrind.git Added "_W" suffix to stack sizes to indicate they are in words. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1578 --- diff --git a/coregrind/vg_include.h b/coregrind/vg_include.h index 103c052c14..2d2131cb32 100644 --- a/coregrind/vg_include.h +++ b/coregrind/vg_include.h @@ -137,9 +137,9 @@ /* 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. */ diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c index 73801fbdc2..dbfb1326e9 100644 --- a/coregrind/vg_main.c +++ b/coregrind/vg_main.c @@ -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. */ diff --git a/coregrind/vg_signals.c b/coregrind/vg_signals.c index 4ac642bc67..4cafe38640 100644 --- a/coregrind/vg_signals.c +++ b/coregrind/vg_signals.c @@ -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) {