#include "sysdep/sigcontext.h"
#include "frame_user.h"
#include "kern_util.h"
+#include "user_util.h"
#include "ptrace_user.h"
#include "os.h"
/* Wait for it to stop itself and continue it with a SIGUSR1 to force
* it into the signal handler.
*/
- n = waitpid(pid, &status, WUNTRACED);
+ CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
if(n < 0){
printf("capture_stack : waitpid failed - errno = %d\n", errno);
exit(1);
* At this point, the handler has stuffed the addresses of
* sig, sc, and SA_RESTORER in raw.
*/
- n = waitpid(pid, &status, WUNTRACED);
+ CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
if(n < 0){
printf("capture_stack : waitpid failed - errno = %d\n", errno);
exit(1);
errno);
exit(1);
}
- if(waitpid(pid, &status, 0) < 0){
+ CATCH_EINTR(n = waitpid(pid, &status, 0));
+ if(n < 0){
printf("capture_stack : waitpid failed - errno = %d\n", errno);
exit(1);
}
}
if(sigaltstack(&ss, NULL) < 0){
printf("sigaltstack failed - errno = %d\n", errno);
- kill(getpid(), SIGKILL);
+ kill(os_getpid(), SIGKILL);
}
if(restorer){
if(err < 0){
printf("sigaction failed - errno = %d\n", errno);
- kill(getpid(), SIGKILL);
+ kill(os_getpid(), SIGKILL);
}
os_stop_process(os_getpid());
setup_arch_frame_raw(&raw_sc->common.arch, &sc + 1, raw_sc->common.sr);
os_stop_process(os_getpid());
- kill(getpid(), SIGKILL);
+ kill(os_getpid(), SIGKILL);
}
static int sc_child(void *arg)
ucontext->uc_mcontext.fpregs, raw_si->common.sr);
os_stop_process(os_getpid());
- kill(getpid(), SIGKILL);
+ kill(os_getpid(), SIGKILL);
}
static int si_child(void *arg)
struct sc_frame_raw raw_sc;
struct si_frame_raw raw_si;
void *stack, *sigstack;
- unsigned long top, sig_top, base;
+ unsigned long top, base;
stack = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
}
top = (unsigned long) stack + PAGE_SIZE - sizeof(void *);
- sig_top = (unsigned long) sigstack + PAGE_SIZE;
/* Get the sigcontext, no sigrestorer layout */
raw_sc.restorer = 0;