mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-12 14:20:04 +00:00
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:
@@ -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
|
||||
|
||||
|
||||
33
none/tests/linux/blockfault.c
Normal file
33
none/tests/linux/blockfault.c
Normal 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;
|
||||
}
|
||||
10
none/tests/linux/blockfault.stderr.exp
Normal file
10
none/tests/linux/blockfault.stderr.exp
Normal 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 ....
|
||||
|
||||
1
none/tests/linux/blockfault.vgtest
Normal file
1
none/tests/linux/blockfault.vgtest
Normal file
@@ -0,0 +1 @@
|
||||
prog: blockfault
|
||||
Reference in New Issue
Block a user