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