Merged r9546..r9548 (moved blockfault, and filtering fixes) from the DARWIN

branch.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9549
This commit is contained in:
Nicholas Nethercote
2009-04-15 07:11:36 +00:00
parent 1d78658d98
commit 13e765c304
9 changed files with 12 additions and 15 deletions

View File

@@ -4,11 +4,13 @@ include $(top_srcdir)/Makefile.tool-tests.am
noinst_SCRIPTS = filter_stderr
EXTRA_DIST = $(noinst_SCRIPTS) \
blockfault.stderr.exp blockfault.vgtest \
mremap.stderr.exp mremap.stdout.exp mremap.vgtest \
mremap2.stderr.exp mremap2.stdout.exp mremap2.stdout.exp2 \
mremap2.stdout.exp-glibc28-amd64 mremap2.vgtest
check_PROGRAMS = \
blockfault \
mremap \
mremap2

View File

@@ -0,0 +1,33 @@
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include "tests/sys_mman.h"
static void handler(int sig, siginfo_t *info, void *v)
{
printf("info: sig=%d code=%d addr=%p\n",
info->si_signo, info->si_code, info->si_addr);
exit(0);
}
/* Blocking a fault, ie SIGSEGV, won't work, and is the same as having
the default handler */
int main()
{
int* unmapped_page = get_unmapped_page();
struct sigaction sa;
sigset_t mask;
sa.sa_sigaction = handler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_SIGINFO;
sigaction(SIGSEGV, &sa, NULL);
sigfillset(&mask);
sigprocmask(SIG_BLOCK, &mask, NULL);
*(volatile int *)unmapped_page = 213;
return 0;
}

View File

@@ -0,0 +1,10 @@
Process terminating with default action of signal 11 (SIGSEGV)
Access not within mapped region at address 0x........
at 0x........: main (blockfault.c:30)
If you believe this happened as a result of a stack overflow in your
program's main thread (unlikely but possible), you can try to increase
the size of the main thread stack using the --main-stacksize= flag.
The main thread stack size used in this run was ....

View File

@@ -0,0 +1 @@
prog: blockfault