]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Take account the ABI-mandated stack redzone when changing stack
authorJulian Seward <jseward@acm.org>
Mon, 12 Apr 2010 19:51:04 +0000 (19:51 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 12 Apr 2010 19:51:04 +0000 (19:51 +0000)
shvals.  AFAIR this has never been handled correctly by Helgrind.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11101

helgrind/hg_main.c

index 2f4e13b280532f9b360b95f1511f5df130d0768d..e77c06c1f8125e8942135e2ea6a8abd97295b051 100644 (file)
@@ -1500,6 +1500,16 @@ void evh__new_mem ( Addr a, SizeT len ) {
       all__sanity_check("evh__new_mem-post");
 }
 
+static
+void evh__new_mem_stack ( Addr a, SizeT len ) {
+   if (SHOW_EVENTS >= 2)
+      VG_(printf)("evh__new_mem_stack(%p, %lu)\n", (void*)a, len );
+   shadow_mem_make_New( get_current_Thread(),
+                        -VG_STACK_REDZONE_SZB + a, len );
+   if (len >= SCE_BIGRANGE_T && (HG_(clo_sanity_flags) & SCE_BIGRANGE))
+      all__sanity_check("evh__new_mem_stack-post");
+}
+
 static
 void evh__new_mem_w_tid ( Addr a, SizeT len, ThreadId tid ) {
    if (SHOW_EVENTS >= 2)
@@ -2022,7 +2032,7 @@ static void evh__HG_PTHREAD_MUTEX_UNLOCK_POST ( ThreadId tid, void* mutex )
 
 
 /* ------------------------------------------------------- */
-/* -------------- events to do with mutexes -------------- */
+/* -------------- events to do with spinlocks ------------ */
 /* ------------------------------------------------------- */
 
 /* All a bit of a kludge.  Pretend we're really dealing with ordinary
@@ -4810,7 +4820,7 @@ static void hg_pre_clo_init ( void )
    VG_(track_new_mem_stack_signal)( evh__new_mem_w_tid );
    VG_(track_new_mem_brk)         ( evh__new_mem_w_tid );
    VG_(track_new_mem_mmap)        ( evh__new_mem_w_perms );
-   VG_(track_new_mem_stack)       ( evh__new_mem );
+   VG_(track_new_mem_stack)       ( evh__new_mem_stack );
 
    // FIXME: surely this isn't thread-aware
    VG_(track_copy_mem_remap)      ( evh__copy_mem );