Add to Memcheck a flag --ignore-range-below-sp=<offset>-<offset>, for

ignoring accesses on the stack below SP.  Serves as a more modern
replacement for --workaround-gcc296-bugs, which is now deprecated.
Fixes #360571.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16073
This commit is contained in:
Julian Seward
2016-10-18 17:16:11 +00:00
parent d752f54716
commit 766292973d
14 changed files with 234 additions and 9 deletions

View File

@@ -746,13 +746,20 @@ void MC_(record_address_error) ( ThreadId tid, Addr a, Int szB,
if (VG_(is_watched)( (isWrite ? write_watchpoint : read_watchpoint), a, szB))
return;
just_below_esp = is_just_below_ESP( VG_(get_SP)(tid), a );
Addr current_sp = VG_(get_SP)(tid);
just_below_esp = is_just_below_ESP( current_sp, a );
/* If this is caused by an access immediately below %ESP, and the
user asks nicely, we just ignore it. */
if (MC_(clo_workaround_gcc296_bugs) && just_below_esp)
return;
/* Also, if this is caused by an access in the range of offsets
below the stack pointer as described by
--ignore-range-below-sp, ignore it. */
if (MC_(in_ignored_range_below_sp)( current_sp, a, szB ))
return;
extra.Err.Addr.isWrite = isWrite;
extra.Err.Addr.szB = szB;
extra.Err.Addr.maybe_gcc = just_below_esp;