7 static void signalHandler(int sig
, siginfo_t
* info
, void* uctx_v
)
17 void* load_memory_content(void** ptr
)
21 // load x0, x1, x2 with data from ptr, and loop for a while. If we get
22 // a signal in the loop, these registers have uninitialized data in
23 // them, but should be valid inside the signal handler. Without our
24 // patch, valgrind complains. We can remove the individual lines from
25 // the patch, and see each argument in turn affecting valgrind
36 : "x0", "x1", "x2", "x3");
43 memset(&sa
, 0, sizeof sa
);
44 sa
.sa_flags
= SA_SIGINFO
;
45 sa
.sa_sigaction
= signalHandler
;
46 int rc
= sigaction(SIGALRM
, &sa
, 0);
48 struct itimerval timer
= {{0, 1000}, {0, 1000}};
49 setitimer(ITIMER_REAL
, &timer
, 0);
50 void** q
= malloc(100);
51 for (int i
= 0; i
< 1000; ++i
)
52 load_memory_content(q
);