1 /**********************************************************************
4 Copyright (C) 1999 Lars Brinkhoff. See the file COPYING for licensing
7 **********************************************************************/
16 #include "user_util.h"
17 #include "ptrace_user.h"
18 #include "sysdep/ptrace.h"
19 #include "sysdep/sigcontext.h"
21 int proxy_wait_return(struct debugger
*debugger
, pid_t unused
)
23 debugger
->waiting
= 0;
25 if(debugger
->debugee
->died
|| (debugger
->wait_options
& __WCLONE
)){
26 debugger_cancelled_return(debugger
, -ECHILD
);
30 if(debugger
->debugee
->zombie
&& debugger
->debugee
->event
)
31 debugger
->debugee
->died
= 1;
33 if(debugger
->debugee
->event
){
34 debugger
->debugee
->event
= 0;
35 ptrace(PTRACE_POKEDATA
, debugger
->pid
,
36 debugger
->wait_status_ptr
,
37 debugger
->debugee
->wait_status
);
39 ptrace (PTRACE_POKEDATA, pid, rusage_ptr, ...); */
40 debugger_cancelled_return(debugger
, debugger
->debugee
->pid
);
44 /* pause will return -EINTR, which happens to be right for wait */
45 debugger_normal_return(debugger
, -1);
49 int parent_wait_return(struct debugger
*debugger
, pid_t unused
)
51 return(debugger_normal_return(debugger
, -1));
54 int real_wait_return(struct debugger
*debugger
)
61 ip
= ptrace(PTRACE_PEEKUSR
, pid
, PT_IP_OFFSET
, 0);
62 IP_RESTART_SYSCALL(ip
);
64 if(ptrace(PTRACE_POKEUSR
, pid
, PT_IP_OFFSET
, ip
) < 0)
65 tracer_panic("real_wait_return : Failed to restart system "
66 "call, errno = %d\n", errno
);
68 if((ptrace(PTRACE_SYSCALL
, debugger
->pid
, 0, SIGCHLD
) < 0) ||
69 (ptrace(PTRACE_SYSCALL
, debugger
->pid
, 0, 0) < 0) ||
70 (ptrace(PTRACE_SYSCALL
, debugger
->pid
, 0, 0) < 0) ||
71 debugger_normal_return(debugger
, -1))
72 tracer_panic("real_wait_return : gdb failed to wait, "
73 "errno = %d\n", errno
);
78 * Overrides for Emacs so that we follow Linus's tabbing style.
79 * Emacs will notice this stuff at the end of the file and automatically
80 * adjust the settings for this buffer only. This must remain at the end
82 * ---------------------------------------------------------------------------
84 * c-file-style: "linux"