/* 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
/* ---------------------------------------------------------------------
/* 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. */
/* 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)))
/* 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:
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. */
/* 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,
}
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 );
/* 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) {