Lines Matching defs:P

60 Pabort_agent(struct ps_prochandle *P)
62 int sysnum = P->status.pr_lwp.pr_syscall;
66 (void) Pstop(P, 0);
67 stop = Psysexit(P, sysnum, TRUE);
69 if (Psetrun(P, 0, PRSABORT) == 0) {
70 while (Pwait(P, 0) == -1 && errno == EINTR)
72 (void) Psysexit(P, sysnum, stop);
81 Pcreate_agent(struct ps_prochandle *P)
94 if (P->agentcnt > 0) {
95 P->agentcnt++;
103 if (P->state == PS_DEAD || P->state == PS_UNDEAD ||
104 P->state == PS_IDLE) {
113 (void) Pstop(P, 0);
114 Psync(P);
115 if (!(P->status.pr_lwp.pr_flags & PR_AGENT)) {
117 (void) memcpy(&cmd.regs, &P->status.pr_lwp.pr_reg[0],
118 sizeof (P->status.pr_lwp.pr_reg));
119 if (write(P->ctlfd, &cmd, sizeof (cmd)) != sizeof (cmd))
124 (void) Pstopstatus(P, PCNULL, 0);
128 procfs_path, (int)P->pid);
142 P->agentstatfd = fd;
148 P->agentctlfd = fd;
155 if ((P->status.pr_lwp.pr_flags & PR_ASLEEP) ||
156 ((P->status.pr_lwp.pr_flags & PR_STOPPED) &&
157 P->status.pr_lwp.pr_why == PR_SYSENTRY)) {
159 (P->status.pr_lwp.pr_flags & PR_ASLEEP) ?
161 Pabort_agent(P);
165 P->agentcnt++;
166 if (Pstopstatus(P, PCNULL, 0) != 0) {
167 Pdestroy_agent(P);
174 if (P->agentstatfd >= 0)
175 (void) close(P->agentstatfd);
176 if (P->agentctlfd >= 0)
177 (void) close(P->agentctlfd);
178 P->agentstatfd = -1;
179 P->agentctlfd = -1;
181 (void) Pstopstatus(P, PCNULL, 0);
190 Pdestroy_agent(struct ps_prochandle *P)
192 if (P->agentcnt > 1)
193 P->agentcnt--;
197 Psync(P); /* Flush out any pending changes */
199 (void) Pstopstatus(P, PCNULL, 0);
200 flags = P->status.pr_lwp.pr_flags;
208 Pabort_agent(P);
216 (void) pr_lwp_exit(P);
217 (void) close(P->agentctlfd);
218 (void) close(P->agentstatfd);
219 P->agentctlfd = -1;
220 P->agentstatfd = -1;
221 P->agentcnt = 0;
227 (void) Pstopstatus(P, PCNULL, 0);
235 execute(struct ps_prochandle *P, int sysindex)
237 int ctlfd = (P->agentctlfd >= 0)? P->agentctlfd : P->ctlfd;
247 sentry = Psysentry(P, sysindex, TRUE); /* set stop-on-syscall-entry */
252 if (memcmp(&P->status.pr_lwp.pr_lwphold, &blockable_sigs,
254 hold = P->status.pr_lwp.pr_lwphold;
255 P->status.pr_lwp.pr_lwphold = blockable_sigs;
256 P->flags |= SETHOLD;
263 if ((cursig = P->status.pr_lwp.pr_cursig) != 0) {
265 ctl.siginfo = P->status.pr_lwp.pr_info;
268 if (Psetrun(P, 0, PRCSIG | PRCFAULT) == -1)
271 while (P->state == PS_RUN) {
272 (void) Pwait(P, 0);
274 if (P->state != PS_STOP)
280 P->status.pr_lwp.pr_lwphold = hold;
281 P->flags |= SETHOLD;
284 (void) Psysentry(P, sysindex, sentry); /* restore sysentry stop */
286 if (P->status.pr_lwp.pr_why == PR_SYSENTRY &&
287 P->status.pr_lwp.pr_what == sysindex)
298 Psyscall(struct ps_prochandle *P,
324 if (P->state == PS_DEAD || P->state == PS_UNDEAD || P->state == PS_IDLE)
327 model = P->status.pr_dmodel;
339 if (Pcreate_agent(P) != 0)
346 save_pstatus = P->status;
348 if (P->state != PS_STOP || /* check state of LWP */
349 (P->status.pr_flags & PR_ASLEEP))
352 if (Pscantext(P)) /* bad text ? */
361 sp = P->status.pr_lwp.pr_reg[R_SP] + STACK_BIAS;
375 sp = (uint32_t)P->status.pr_lwp.pr_reg[R_SP];
423 ap = Psyscall_setup(P, nargs, sysindex, sp);
424 P->flags |= SETREGS; /* set registers before continuing */
430 if (execute(P, sysindex) != 0 ||
431 (!Pissyscall(P, P->status.pr_lwp.pr_reg[R_PC]) &&
432 !Pissyscall_prev(P, P->status.pr_lwp.pr_reg[R_PC], NULL)))
446 if (Pwrite(P, adp->arg_object, adp->arg_size,
452 if (Psyscall_copyinargs(P, nargs, argp, ap) != 0)
461 sexit = Psysexit(P, sysindex, TRUE); /* catch this syscall exit */
463 if (Psetrun(P, 0, 0) == -1)
465 while (P->state == PS_RUN)
466 (void) Pwait(P, 0);
467 } while (P->state == PS_STOP && P->status.pr_lwp.pr_why != PR_SYSEXIT);
468 (void) Psysexit(P, sysindex, sexit); /* restore original setting */
480 if (P->state != PS_STOP || P->status.pr_lwp.pr_why != PR_SYSEXIT)
483 if (P->status.pr_lwp.pr_what != sysindex)
486 if (!Pissyscall_prev(P, P->status.pr_lwp.pr_reg[R_PC], NULL)) {
501 if (Pread(P, adp->arg_object, adp->arg_size,
507 if (Psyscall_copyoutargs(P, nargs, argp, ap) != 0)
513 if (P->status.pr_lwp.pr_errno) { /* error return */
514 error = P->status.pr_lwp.pr_errno;
520 rval->sys_rval1 = P->status.pr_lwp.pr_rval1;
521 rval->sys_rval2 = P->status.pr_lwp.pr_rval2;
523 P->status.pr_lwp.pr_rval1, P->status.pr_lwp.pr_rval2);
562 if (P->state != PS_UNDEAD) {
563 P->status = save_pstatus;
564 P->flags |= SETREGS;
565 Psync(P);
567 Pdestroy_agent(P);