8 // Regression test for bug 91162: if a client had a SEGV signal handler,
9 // and jumped to a bogus address, Valgrind would abort. With the fix,
10 // the following test runs to completion correctly.
12 static jmp_buf myjmpbuf
;
15 void SIGSEGV_handler(int signum
)
22 struct sigaction sigsegv_new
, sigsegv_saved
;
25 /* Install own SIGSEGV handler */
26 memset(&sigsegv_new
, 0, sizeof(sigsegv_new
));
27 sigsegv_new
.sa_handler
= SIGSEGV_handler
;
28 sigsegv_new
.sa_flags
= 0;
29 #if !defined(__APPLE__) && !defined(__sun) && !defined(__FreeBSD__)
30 sigsegv_new
.sa_restorer
= NULL
;
32 res
= sigemptyset( &sigsegv_new
.sa_mask
);
35 res
= sigaction( SIGSEGV
, &sigsegv_new
, &sigsegv_saved
);
38 if (setjmp(myjmpbuf
) == 0) {
39 // Jump to zero; will cause seg fault
40 #if defined(__powerpc64__) && (_CALL_ELF != 2)
41 unsigned long int fn
[3];
48 ((void(*)(void)) fn
) ();
49 fprintf(stderr
, "Got here??\n");
51 fprintf(stderr
, "Signal caught, as expected\n");