It merely passes tcp pointer to upeek instead of pid.
This is needed if one wants to check or change
some tcp fields.
I have patches which require this. I can imagine someone else
eventually needing to look at tcp for completely orthogonal reasons.
+2008-12-16 Denys Vlasenko <dvlasenk@redhat.com>
+
+ * defs.h: Modify declaration of upeek to take struct tcb *
+ parameter instead of pid_t.
+ * process.c: Change all upeek calls accordingly.
+ * signal.c: Likewise.
+ * strace.c: Likewise.
+ * syscall.c: Likewise.
+ * util.c: Likewise.
+
2008-11-11 Dmitry V. Levin <ldv@altlinux.org>
* sock.c [LINUX] (sock_ioctl): Parse more SIOCS* ioctls.
extern const char *sprintflags P((const char *, const struct xlat *, int));
extern int umoven P((struct tcb *, long, int, char *));
extern int umovestr P((struct tcb *, long, int, char *));
-extern int upeek P((int, long, long *));
+extern int upeek P((struct tcb *, long, long *));
extern void dumpiov P((struct tcb *, int, long));
extern void dumpstr P((struct tcb *, long, int));
extern void printstr P((struct tcb *, long, int));
{
unsigned long *bsp, *ap;
- if (upeek(tcp->pid, PT_AR_BSP, (long *) &bsp) , 0)
+ if (upeek(tcp, PT_AR_BSP, (long *) &bsp) , 0)
return -1;
ap = ia64_rse_skip_regs(bsp, argnum);
else {
unsigned long *sp;
- if (upeek(tcp->pid, REG_SP, (long *) &sp) , 0)
+ if (upeek(tcp, REG_SP, (long *) &sp) , 0)
return -1;
ptrace(PTRACE_POKEDATA, tcp->pid,
#ifdef SUNOS4
void (*u_signal)();
- if (upeek(tcp->pid, uoff(u_signal[0]) + sig*sizeof(u_signal),
+ if (upeek(tcp, uoff(u_signal[0]) + sig*sizeof(u_signal),
(long *) &u_signal) < 0) {
return 0;
}
if (entering(tcp)) {
tcp->u_arg[0] = 0;
- if (upeek(tcp->pid,PT_GPR15,&usp)<0)
+ if (upeek(tcp,PT_GPR15,&usp)<0)
return 0;
if (umove(tcp, usp+__SIGNAL_FRAMESIZE, &sc) < 0)
return 0;
if (entering(tcp)) {
tcp->u_arg[0] = 0;
- if (upeek(tcp->pid, 4*UESP, &esp) < 0)
+ if (upeek(tcp, 4*UESP, &esp) < 0)
return 0;
if (umove(tcp, esp, &sc) < 0)
return 0;
/* offset of sigcontext in the kernel's sigframe structure: */
# define SIGFRAME_SC_OFFSET 0x90
tcp->u_arg[0] = 0;
- if (upeek(tcp->pid, PT_R12, &sp) < 0)
+ if (upeek(tcp, PT_R12, &sp) < 0)
return 0;
if (umove(tcp, sp + 16 + SIGFRAME_SC_OFFSET, &sc) < 0)
return 0;
if (entering(tcp)) {
tcp->u_arg[0] = 0;
- if (upeek(tcp->pid, sizeof(unsigned long)*PT_R1, &esp) < 0)
+ if (upeek(tcp, sizeof(unsigned long)*PT_R1, &esp) < 0)
return 0;
if (umove(tcp, esp, &sc) < 0)
return 0;
if (entering(tcp)) {
tcp->u_arg[0] = 0;
- if (upeek(tcp->pid, 4*PT_USP, &usp) < 0)
+ if (upeek(tcp, 4*PT_USP, &usp) < 0)
return 0;
if (umove(tcp, usp, &sc) < 0)
return 0;
if (entering(tcp)) {
tcp->u_arg[0] = 0;
- if (upeek(tcp->pid, REG_FP, &fp) < 0)
+ if (upeek(tcp, REG_FP, &fp) < 0)
return 0;
if (umove(tcp, fp, &sc) < 0)
return 0;
if(entering(tcp)) {
tcp->u_arg[0] = 0;
- if (upeek(tcp->pid, REG_SP, &sp) < 0)
+ if (upeek(tcp, REG_SP, &sp) < 0)
return 0;
/* There are six words followed by a 128-byte siginfo. */
sp = sp + 6 * 4 + 128;
struct siginfo si;
long psr;
- upeek(pid, PT_CR_IPSR, &psr);
- upeek(pid, PT_CR_IIP, &pc);
+ upeek(tcp, PT_CR_IPSR, &psr);
+ upeek(tcp, PT_CR_IIP, &pc);
pc += (psr >> PSR_RI) & 0x3;
ptrace(PT_GETSIGINFO, pid, 0, (long) &si);
return 0;
}
- if (upeek(pid, PT_GPR2, &syscall_mode) < 0)
+ if (upeek(tcp, PT_GPR2, &syscall_mode) < 0)
return -1;
if (syscall_mode != -ENOSYS) {
PT_GPR8, PT_GPR9, PT_GPR10, PT_GPR11,
PT_GPR12, PT_GPR13, PT_GPR14, PT_GPR15};
- if (upeek(pid, PT_PSWADDR, &pc) < 0)
+ if (upeek(tcp, PT_PSWADDR, &pc) < 0)
return -1;
errno = 0;
opcode = ptrace(PTRACE_PEEKTEXT, pid, (char *)(pc-sizeof(long)), 0);
tmp = 0;
offset_reg = (opcode & 0x000f0000) >> 16;
- if (offset_reg && (upeek(pid, gpr_offset[offset_reg], &tmp) < 0))
+ if (offset_reg && (upeek(tcp, gpr_offset[offset_reg], &tmp) < 0))
return -1;
svc_addr += tmp;
tmp = 0;
offset_reg = (opcode & 0x0000f000) >> 12;
- if (offset_reg && (upeek(pid, gpr_offset[offset_reg], &tmp) < 0))
+ if (offset_reg && (upeek(tcp, gpr_offset[offset_reg], &tmp) < 0))
return -1;
svc_addr += tmp;
#endif
tmp = 0;
offset_reg = (opcode & 0x00f00000) >> 20;
- if (offset_reg && (upeek(pid, gpr_offset[offset_reg], &tmp) < 0))
+ if (offset_reg && (upeek(tcp, gpr_offset[offset_reg], &tmp) < 0))
return -1;
scno = (scno | tmp) & 0xff;
}
}
#elif defined (POWERPC)
- if (upeek(pid, sizeof(unsigned long)*PT_R0, &scno) < 0)
+ if (upeek(tcp, sizeof(unsigned long)*PT_R0, &scno) < 0)
return -1;
if (!(tcp->flags & TCB_INSYSCALL)) {
/* Check if we return from execve. */
}
}
#elif defined(BFIN)
- if (upeek(pid, PT_ORIG_P0, &scno))
+ if (upeek(tcp, PT_ORIG_P0, &scno))
return -1;
/* Check if we return from execve. */
if (tcp->flags & TCB_WAITEXECVE && tcp->flags & TCB_INSYSCALL)
tcp->flags &= ~(TCB_INSYSCALL | TCB_WAITEXECVE);
#elif defined (I386)
- if (upeek(pid, 4*ORIG_EAX, &scno) < 0)
+ if (upeek(tcp, 4*ORIG_EAX, &scno) < 0)
return -1;
#elif defined (X86_64)
- if (upeek(pid, 8*ORIG_RAX, &scno) < 0)
+ if (upeek(tcp, 8*ORIG_RAX, &scno) < 0)
return -1;
if (!(tcp->flags & TCB_INSYSCALL)) {
* It takes only one ptrace and thus doesn't need
* to be cached.
*/
- if (upeek(pid, 8*CS, &val) < 0)
+ if (upeek(tcp, 8*CS, &val) < 0)
return -1;
switch(val)
{
*/
unsigned long val, rip, i;
- if(upeek(pid, 8*RIP, &rip)<0)
+ if(upeek(tcp, 8*RIP, &rip)<0)
perror("upeek(RIP)");
/* sizeof(syscall) == sizeof(int 0x80) == 2 */
}
#elif defined(IA64)
# define IA64_PSR_IS ((long)1 << 34)
- if (upeek (pid, PT_CR_IPSR, &psr) >= 0)
+ if (upeek (tcp, PT_CR_IPSR, &psr) >= 0)
ia32 = (psr & IA64_PSR_IS) != 0;
if (!(tcp->flags & TCB_INSYSCALL)) {
if (ia32) {
- if (upeek(pid, PT_R1, &scno) < 0) /* orig eax */
+ if (upeek(tcp, PT_R1, &scno) < 0) /* orig eax */
return -1;
} else {
- if (upeek (pid, PT_R15, &scno) < 0)
+ if (upeek (tcp, PT_R15, &scno) < 0)
return -1;
}
/* Check if we return from execve. */
}
} else {
/* syscall in progress */
- if (upeek (pid, PT_R8, &r8) < 0)
+ if (upeek (tcp, PT_R8, &r8) < 0)
return -1;
- if (upeek (pid, PT_R10, &r10) < 0)
+ if (upeek (tcp, PT_R10, &r10) < 0)
return -1;
}
#elif defined (ARM)
}
}
#elif defined (M68K)
- if (upeek(pid, 4*PT_ORIG_D0, &scno) < 0)
+ if (upeek(tcp, 4*PT_ORIG_D0, &scno) < 0)
return -1;
#elif defined (LINUX_MIPSN32)
unsigned long long regs[38];
}
}
#elif defined (MIPS)
- if (upeek(pid, REG_A3, &a3) < 0)
+ if (upeek(tcp, REG_A3, &a3) < 0)
return -1;
if(!(tcp->flags & TCB_INSYSCALL)) {
- if (upeek(pid, REG_V0, &scno) < 0)
+ if (upeek(tcp, REG_V0, &scno) < 0)
return -1;
/* Check if we return from execve. */
}
}
} else {
- if (upeek(pid, REG_V0, &r2) < 0)
+ if (upeek(tcp, REG_V0, &r2) < 0)
return -1;
}
#elif defined (ALPHA)
- if (upeek(pid, REG_A3, &a3) < 0)
+ if (upeek(tcp, REG_A3, &a3) < 0)
return -1;
if (!(tcp->flags & TCB_INSYSCALL)) {
- if (upeek(pid, REG_R0, &scno) < 0)
+ if (upeek(tcp, REG_R0, &scno) < 0)
return -1;
/* Check if we return from execve. */
}
}
else {
- if (upeek(pid, REG_R0, &r0) < 0)
+ if (upeek(tcp, REG_R0, &r0) < 0)
return -1;
}
#elif defined (SPARC) || defined (SPARC64)
}
}
#elif defined(HPPA)
- if (upeek(pid, PT_GR20, &scno) < 0)
+ if (upeek(tcp, PT_GR20, &scno) < 0)
return -1;
if (!(tcp->flags & TCB_INSYSCALL)) {
/* Check if we return from execve. */
/*
* In the new syscall ABI, the system call number is in R3.
*/
- if (upeek(pid, 4*(REG_REG0+3), &scno) < 0)
+ if (upeek(tcp, 4*(REG_REG0+3), &scno) < 0)
return -1;
if (scno < 0) {
}
}
#elif defined(SH64)
- if (upeek(pid, REG_SYSCALL, &scno) < 0)
+ if (upeek(tcp, REG_SYSCALL, &scno) < 0)
return -1;
scno &= 0xFFFF;
#endif /* SH64 */
#endif /* LINUX */
#ifdef SUNOS4
- if (upeek(pid, uoff(u_arg[7]), &scno) < 0)
+ if (upeek(tcp, uoff(u_arg[7]), &scno) < 0)
return -1;
#elif defined(SH)
/* new syscall ABI returns result in R0 */
- if (upeek(pid, 4*REG_REG0, (long *)&r0) < 0)
+ if (upeek(tcp, 4*REG_REG0, (long *)&r0) < 0)
return -1;
#elif defined(SH64)
/* ABI defines result returned in r9 */
- if (upeek(pid, REG_GENERAL(9), (long *)&r9) < 0)
+ if (upeek(tcp, REG_GENERAL(9), (long *)&r9) < 0)
return -1;
#endif
syscall_fixup(tcp)
struct tcb *tcp;
{
-#ifndef USE_PROCFS
- int pid = tcp->pid;
-#else /* USE_PROCFS */
+#ifdef USE_PROCFS
int scno = known_scno(tcp);
if (!(tcp->flags & TCB_INSYSCALL)) {
#endif /* SUNOS4 */
#ifdef LINUX
#if defined (I386)
- if (upeek(pid, 4*EAX, &eax) < 0)
+ if (upeek(tcp, 4*EAX, &eax) < 0)
return -1;
if (eax != -ENOSYS && !(tcp->flags & TCB_INSYSCALL)) {
if (debug)
return 0;
}
#elif defined (X86_64)
- if (upeek(pid, 8*RAX, &rax) < 0)
+ if (upeek(tcp, 8*RAX, &rax) < 0)
return -1;
if (current_personality == 1)
rax = (long int)(int)rax; /* sign extend from 32 bits */
return 0;
}
#elif defined (S390) || defined (S390X)
- if (upeek(pid, PT_GPR2, &gpr2) < 0)
+ if (upeek(tcp, PT_GPR2, &gpr2) < 0)
return -1;
if (syscall_mode != -ENOSYS)
syscall_mode = tcp->scno;
}
#elif defined (POWERPC)
# define SO_MASK 0x10000000
- if (upeek(pid, sizeof(unsigned long)*PT_CCR, &flags) < 0)
+ if (upeek(tcp, sizeof(unsigned long)*PT_CCR, &flags) < 0)
return -1;
- if (upeek(pid, sizeof(unsigned long)*PT_R3, &result) < 0)
+ if (upeek(tcp, sizeof(unsigned long)*PT_R3, &result) < 0)
return -1;
if (flags & SO_MASK)
result = -result;
#elif defined (M68K)
- if (upeek(pid, 4*PT_D0, &d0) < 0)
+ if (upeek(tcp, 4*PT_D0, &d0) < 0)
return -1;
if (d0 != -ENOSYS && !(tcp->flags & TCB_INSYSCALL)) {
if (debug)
* Nothing required
*/
#elif defined(BFIN)
- if (upeek(pid, PT_R0, &r0) < 0)
+ if (upeek(tcp, PT_R0, &r0) < 0)
return -1;
#elif defined (HPPA)
- if (upeek(pid, PT_GR28, &r28) < 0)
+ if (upeek(tcp, PT_GR28, &r28) < 0)
return -1;
#elif defined(IA64)
- if (upeek(pid, PT_R10, &r10) < 0)
+ if (upeek(tcp, PT_R10, &r10) < 0)
return -1;
- if (upeek(pid, PT_R8, &r8) < 0)
+ if (upeek(tcp, PT_R8, &r8) < 0)
return -1;
if (ia32 && r8 != -ENOSYS && !(tcp->flags & TCB_INSYSCALL)) {
if (debug)
#endif /* LINUX */
#ifdef SUNOS4
/* get error code from user struct */
- if (upeek(pid, uoff(u_error), &u_error) < 0)
+ if (upeek(tcp, uoff(u_error), &u_error) < 0)
return -1;
u_error >>= 24; /* u_error is a char */
/* get system call return value */
- if (upeek(pid, uoff(u_rval1), &tcp->u_rval) < 0)
+ if (upeek(tcp, uoff(u_rval1), &tcp->u_rval) < 0)
return -1;
#endif /* SUNOS4 */
#ifdef SVR4
return -1;
#else
#ifdef POWERPC
- if (upeek(tcp->pid, sizeof(unsigned long)*PT_CCR, &flags) < 0)
+ if (upeek(tcp, sizeof(unsigned long)*PT_CCR, &flags) < 0)
return -1;
if (error) {
flags |= SO_MASK;
syscall_enter(tcp)
struct tcb *tcp;
{
-#ifndef USE_PROCFS
- int pid = tcp->pid;
-#endif /* !USE_PROCFS */
#ifdef LINUX
#if defined(S390) || defined(S390X)
{
else
tcp->u_nargs = MAX_ARGS;
for (i = 0; i < tcp->u_nargs; i++) {
- if (upeek(pid,i==0 ? PT_ORIGGPR2:PT_GPR2+i*sizeof(long), &tcp->u_arg[i]) < 0)
+ if (upeek(tcp,i==0 ? PT_ORIGGPR2:PT_GPR2+i*sizeof(long), &tcp->u_arg[i]) < 0)
return -1;
}
}
/* WTA: if scno is out-of-bounds this will bomb. Add range-check
* for scno somewhere above here!
*/
- if (upeek(pid, REG_A0+i, &tcp->u_arg[i]) < 0)
+ if (upeek(tcp, REG_A0+i, &tcp->u_arg[i]) < 0)
return -1;
}
}
# define PT_RBS_END PT_AR_BSP
# endif
- if (upeek(pid, PT_RBS_END, &rbs_end) < 0)
+ if (upeek(tcp, PT_RBS_END, &rbs_end) < 0)
return -1;
- if (upeek(pid, PT_CFM, (long *) &cfm) < 0)
+ if (upeek(tcp, PT_CFM, (long *) &cfm) < 0)
return -1;
sof = (cfm >> 0) & 0x7f;
int i;
if (/* EBX = out0 */
- upeek(pid, PT_R11, (long *) &tcp->u_arg[0]) < 0
+ upeek(tcp, PT_R11, (long *) &tcp->u_arg[0]) < 0
/* ECX = out1 */
- || upeek(pid, PT_R9, (long *) &tcp->u_arg[1]) < 0
+ || upeek(tcp, PT_R9, (long *) &tcp->u_arg[1]) < 0
/* EDX = out2 */
- || upeek(pid, PT_R10, (long *) &tcp->u_arg[2]) < 0
+ || upeek(tcp, PT_R10, (long *) &tcp->u_arg[2]) < 0
/* ESI = out3 */
- || upeek(pid, PT_R14, (long *) &tcp->u_arg[3]) < 0
+ || upeek(tcp, PT_R14, (long *) &tcp->u_arg[3]) < 0
/* EDI = out4 */
- || upeek(pid, PT_R15, (long *) &tcp->u_arg[4]) < 0
+ || upeek(tcp, PT_R15, (long *) &tcp->u_arg[4]) < 0
/* EBP = out5 */
- || upeek(pid, PT_R13, (long *) &tcp->u_arg[5]) < 0)
+ || upeek(tcp, PT_R13, (long *) &tcp->u_arg[5]) < 0)
return -1;
for (i = 0; i < 6; ++i)
else
nargs = tcp->u_nargs = MAX_ARGS;
if(nargs > 4) {
- if(upeek(pid, REG_SP, &sp) < 0)
+ if(upeek(tcp, REG_SP, &sp) < 0)
return -1;
for(i = 0; i < 4; i++) {
- if (upeek(pid, REG_A0 + i, &tcp->u_arg[i])<0)
+ if (upeek(tcp, REG_A0 + i, &tcp->u_arg[i])<0)
return -1;
}
umoven(tcp, sp+16, (nargs-4) * sizeof(tcp->u_arg[0]),
(char *)(tcp->u_arg + 4));
} else {
for(i = 0; i < nargs; i++) {
- if (upeek(pid, REG_A0 + i, &tcp->u_arg[i]) < 0)
+ if (upeek(tcp, REG_A0 + i, &tcp->u_arg[i]) < 0)
return -1;
}
}
else
tcp->u_nargs = MAX_ARGS;
for (i = 0; i < tcp->u_nargs; i++) {
- if (upeek(pid, (i==0) ?
+ if (upeek(tcp, (i==0) ?
(sizeof(unsigned long)*PT_ORIG_R3) :
((i+PT_R3)*sizeof(unsigned long)),
&tcp->u_arg[i]) < 0)
else
tcp->u_nargs = MAX_ARGS;
for (i = 0; i < tcp->u_nargs; i++) {
- if (upeek(pid, PT_GR26-4*i, &tcp->u_arg[i]) < 0)
+ if (upeek(tcp, PT_GR26-4*i, &tcp->u_arg[i]) < 0)
return -1;
}
}
tcp->u_nargs = sizeof(argreg) / sizeof(argreg[0]);
for (i = 0; i < tcp->u_nargs; ++i)
- if (upeek(pid, argreg[i], &tcp->u_arg[i]) < 0)
+ if (upeek(tcp, argreg[i], &tcp->u_arg[i]) < 0)
return -1;
}
#elif defined(SH)
tcp->u_nargs = sysent[tcp->scno].nargs;
for (i = 0; i < tcp->u_nargs; i++) {
- if (upeek(pid, 4*syscall_regs[i], &tcp->u_arg[i]) < 0)
+ if (upeek(tcp, 4*syscall_regs[i], &tcp->u_arg[i]) < 0)
return -1;
}
}
tcp->u_nargs = sysent[tcp->scno].nargs;
for (i = 0; i < tcp->u_nargs; i++) {
- if (upeek(pid, REG_GENERAL(syscall_regs[i]), &tcp->u_arg[i]) < 0)
+ if (upeek(tcp, REG_GENERAL(syscall_regs[i]), &tcp->u_arg[i]) < 0)
return -1;
}
}
else
tcp->u_nargs = MAX_ARGS;
for (i = 0; i < tcp->u_nargs; i++) {
- if (upeek(pid, argreg[current_personality][i]*8, &tcp->u_arg[i]) < 0)
+ if (upeek(tcp, argreg[current_personality][i]*8, &tcp->u_arg[i]) < 0)
return -1;
}
}
else
tcp->u_nargs = MAX_ARGS;
for (i = 0; i < tcp->u_nargs; i++) {
- if (upeek(pid, i*4, &tcp->u_arg[i]) < 0)
+ if (upeek(tcp, i*4, &tcp->u_arg[i]) < 0)
return -1;
}
}
for (i = 0; i < tcp->u_nargs; i++) {
struct user *u;
- if (upeek(pid, uoff(u_arg[0]) +
+ if (upeek(tcp, uoff(u_arg[0]) +
(i*sizeof(u->u_arg[0])), &tcp->u_arg[i]) < 0)
return -1;
}
return -1;
val = regs.r_o1;
#elif defined(SH)
- if (upeek(tcp->pid, 4*(REG_REG0+1), &val) < 0)
+ if (upeek(tcp, 4*(REG_REG0+1), &val) < 0)
return -1;
#elif defined(IA64)
- if (upeek(tcp->pid, PT_R9, &val) < 0)
+ if (upeek(tcp, PT_R9, &val) < 0)
return -1;
#endif /* SPARC || SPARC64 */
#endif /* LINUX */
#ifdef SUNOS4
- if (upeek(tcp->pid, uoff(u_rval2), &val) < 0)
+ if (upeek(tcp, uoff(u_rval2), &val) < 0)
return -1;
#endif /* SUNOS4 */
#ifndef USE_PROCFS
int
-upeek(pid, off, res)
-int pid;
+upeek(tcp, off, res)
+struct tcb *tcp;
long off;
long *res;
{
}
#endif /* SUNOS4_KERNEL_ARCH_KLUDGE */
errno = 0;
- val = ptrace(PTRACE_PEEKUSER, pid, (char *) off, 0);
+ val = ptrace(PTRACE_PEEKUSER, tcp->pid, (char *) off, 0);
if (val == -1 && errno) {
char buf[60];
- sprintf(buf,"upeek: ptrace(PTRACE_PEEKUSER,%d,%lu,0)",pid,off);
+ sprintf(buf,"upeek: ptrace(PTRACE_PEEKUSER,%d,%lu,0)", tcp->pid, off);
perror(buf);
return -1;
}
#ifdef LINUX
long pc;
#if defined(I386)
- if (upeek(tcp->pid, 4*EIP, &pc) < 0)
+ if (upeek(tcp, 4*EIP, &pc) < 0)
return -1;
#elif defined(X86_64)
- if (upeek(tcp->pid, 8*RIP, &pc) < 0)
+ if (upeek(tcp, 8*RIP, &pc) < 0)
return -1;
#elif defined(IA64)
- if (upeek(tcp->pid, PT_B0, &pc) < 0)
+ if (upeek(tcp, PT_B0, &pc) < 0)
return -1;
#elif defined(ARM)
- if (upeek(tcp->pid, 4*15, &pc) < 0)
+ if (upeek(tcp, 4*15, &pc) < 0)
return -1;
#elif defined(BFIN)
- if (upeek(tcp->pid, REG_PC, &pc) < 0)
+ if (upeek(tcp, REG_PC, &pc) < 0)
return -1;
#elif defined(POWERPC)
- if (upeek(tcp->pid, sizeof(unsigned long)*PT_NIP, &pc) < 0)
+ if (upeek(tcp, sizeof(unsigned long)*PT_NIP, &pc) < 0)
return -1;
#elif defined(M68K)
- if (upeek(tcp->pid, 4*PT_PC, &pc) < 0)
+ if (upeek(tcp, 4*PT_PC, &pc) < 0)
return -1;
#elif defined(ALPHA)
- if (upeek(tcp->pid, REG_PC, &pc) < 0)
+ if (upeek(tcp, REG_PC, &pc) < 0)
return -1;
#elif defined(MIPS)
- if (upeek(tcp->pid, REG_EPC, &pc) < 0)
+ if (upeek(tcp, REG_EPC, &pc) < 0)
return -1;
#elif defined(SPARC) || defined(SPARC64)
struct regs regs;
return -1;
pc = regs.r_pc;
#elif defined(S390) || defined(S390X)
- if(upeek(tcp->pid,PT_PSWADDR,&pc) < 0)
+ if(upeek(tcp,PT_PSWADDR,&pc) < 0)
return -1;
#elif defined(HPPA)
- if(upeek(tcp->pid,PT_IAOQ0,&pc) < 0)
+ if(upeek(tcp,PT_IAOQ0,&pc) < 0)
return -1;
#elif defined(SH)
- if (upeek(tcp->pid, 4*REG_PC ,&pc) < 0)
+ if (upeek(tcp, 4*REG_PC ,&pc) < 0)
return -1;
#elif defined(SH64)
- if (upeek(tcp->pid, REG_PC ,&pc) < 0)
+ if (upeek(tcp, REG_PC ,&pc) < 0)
return -1;
#endif
return pc;
#ifdef I386
long eip;
- if (upeek(tcp->pid, 4*EIP, &eip) < 0) {
+ if (upeek(tcp, 4*EIP, &eip) < 0) {
PRINTBADPC;
return;
}
#elif defined(S390) || defined(S390X)
long psw;
- if(upeek(tcp->pid,PT_PSWADDR,&psw) < 0) {
+ if(upeek(tcp,PT_PSWADDR,&psw) < 0) {
PRINTBADPC;
return;
}
#elif defined(X86_64)
long rip;
- if (upeek(tcp->pid, 8*RIP, &rip) < 0) {
+ if (upeek(tcp, 8*RIP, &rip) < 0) {
PRINTBADPC;
return;
}
#elif defined(IA64)
long ip;
- if (upeek(tcp->pid, PT_B0, &ip) < 0) {
+ if (upeek(tcp, PT_B0, &ip) < 0) {
PRINTBADPC;
return;
}
#elif defined(POWERPC)
long pc;
- if (upeek(tcp->pid, sizeof(unsigned long)*PT_NIP, &pc) < 0) {
+ if (upeek(tcp, sizeof(unsigned long)*PT_NIP, &pc) < 0) {
tprintf ("[????????] ");
return;
}
#elif defined(M68K)
long pc;
- if (upeek(tcp->pid, 4*PT_PC, &pc) < 0) {
+ if (upeek(tcp, 4*PT_PC, &pc) < 0) {
tprintf ("[????????] ");
return;
}
#elif defined(ALPHA)
long pc;
- if (upeek(tcp->pid, REG_PC, &pc) < 0) {
+ if (upeek(tcp, REG_PC, &pc) < 0) {
tprintf ("[????????????????] ");
return;
}
#elif defined(HPPA)
long pc;
- if(upeek(tcp->pid,PT_IAOQ0,&pc) < 0) {
+ if(upeek(tcp,PT_IAOQ0,&pc) < 0) {
tprintf ("[????????] ");
return;
}
#elif defined(MIPS)
long pc;
- if (upeek(tcp->pid, REG_EPC, &pc) < 0) {
+ if (upeek(tcp, REG_EPC, &pc) < 0) {
tprintf ("[????????] ");
return;
}
#elif defined(SH)
long pc;
- if (upeek(tcp->pid, 4*REG_PC, &pc) < 0) {
+ if (upeek(tcp, 4*REG_PC, &pc) < 0) {
tprintf ("[????????] ");
return;
}
#elif defined(SH64)
long pc;
- if (upeek(tcp->pid, REG_PC, &pc) < 0) {
+ if (upeek(tcp, REG_PC, &pc) < 0) {
tprintf ("[????????????????] ");
return;
}
#elif defined(ARM)
long pc;
- if (upeek(tcp->pid, 4*15, &pc) < 0) {
+ if (upeek(tcp, 4*15, &pc) < 0) {
PRINTBADPC;
return;
}
#elif defined(BFIN)
long pc;
- if (upeek(tcp->pid, PT_PC, &pc) < 0) {
+ if (upeek(tcp, PT_PC, &pc) < 0) {
PRINTBADPC;
return;
}
return 0;
}
- if (upeek(tcp->pid, PT_AR_BSP, &bsp) < 0)
+ if (upeek(tcp, PT_AR_BSP, &bsp) < 0)
return -1;
- if (upeek(tcp->pid, PT_CFM, (long *) &cfm) < 0)
+ if (upeek(tcp, PT_CFM, (long *) &cfm) < 0)
return -1;
sof = (cfm >> 0) & 0x7f;
int ret;
if (ia32)
- ret = upeek (tcp->pid, PT_R11, valp);
+ ret = upeek (tcp, PT_R11, valp);
else
ret = umoven (tcp,
(unsigned long) ia64_rse_skip_regs(*state, 0),
int ret;
if (ia32)
- ret = upeek (tcp->pid, PT_R9, valp);
+ ret = upeek (tcp, PT_R9, valp);
else
ret = umoven (tcp,
(unsigned long) ia64_rse_skip_regs(*state, 1),
# define arg_setup(tcp, state) (0)
# define arg_finish_change(tcp, state) 0
# define get_arg0(tcp, cookie, valp) \
- (upeek ((tcp)->pid, arg0_offset, (valp)))
+ (upeek ((tcp), arg0_offset, (valp)))
# define get_arg1(tcp, cookie, valp) \
- (upeek ((tcp)->pid, arg1_offset, (valp)))
+ (upeek ((tcp), arg1_offset, (valp)))
static int
set_arg0 (struct tcb *tcp, void *cookie, long val)
tcp->pid);
return -1;
}
- if (upeek(tcp->pid, PT_CR_IIP, &tcp->baddr) < 0)
+ if (upeek(tcp, PT_CR_IIP, &tcp->baddr) < 0)
return -1;
if (debug)
fprintf(stderr, "[%d] setting bpt at %lx\n",
pid_t pid;
pid = tcp->pid;
- if (upeek(pid, PT_CR_IPSR, &ipsr) < 0)
+ if (upeek(tcp, PT_CR_IPSR, &ipsr) < 0)
return -1;
- if (upeek(pid, PT_CR_IIP, &addr) < 0)
+ if (upeek(tcp, PT_CR_IIP, &addr) < 0)
return -1;
/* store "ri" in low two bits */
tcp->baddr = addr | ((ipsr >> 41) & 0x3);
return -1;
}
#if defined (I386)
- if (upeek(tcp->pid, 4*EIP, &tcp->baddr) < 0)
+ if (upeek(tcp, 4*EIP, &tcp->baddr) < 0)
return -1;
#elif defined (X86_64)
- if (upeek(tcp->pid, 8*RIP, &tcp->baddr) < 0)
+ if (upeek(tcp, 8*RIP, &tcp->baddr) < 0)
return -1;
#elif defined (M68K)
- if (upeek(tcp->pid, 4*PT_PC, &tcp->baddr) < 0)
+ if (upeek(tcp, 4*PT_PC, &tcp->baddr) < 0)
return -1;
#elif defined (ALPHA)
return -1;
#elif defined (MIPS)
return -1; /* FIXME: I do not know what i do - Flo */
#elif defined (POWERPC)
- if (upeek(tcp->pid, sizeof(unsigned long)*PT_NIP, &tcp->baddr) < 0)
+ if (upeek(tcp, sizeof(unsigned long)*PT_NIP, &tcp->baddr) < 0)
return -1;
#elif defined(S390) || defined(S390X)
- if (upeek(tcp->pid,PT_PSWADDR, &tcp->baddr) < 0)
+ if (upeek(tcp,PT_PSWADDR, &tcp->baddr) < 0)
return -1;
#elif defined(HPPA)
- if (upeek(tcp->pid, PT_IAOQ0, &tcp->baddr) < 0)
+ if (upeek(tcp, PT_IAOQ0, &tcp->baddr) < 0)
return -1;
tcp->baddr &= ~0x03;
#elif defined(SH)
- if (upeek(tcp->pid, 4*REG_PC, &tcp->baddr) < 0)
+ if (upeek(tcp, 4*REG_PC, &tcp->baddr) < 0)
return -1;
#else
#error unknown architecture
}
tcp->flags &= ~TCB_BPTSET;
- if (upeek(tcp->pid, PT_CR_IIP, &addr) < 0)
+ if (upeek(tcp, PT_CR_IIP, &addr) < 0)
return -1;
if (addr != tcp->baddr) {
/* The breakpoint has not been reached yet. */
pid = tcp->pid;
- if (upeek(pid, PT_CR_IPSR, &ipsr) < 0)
+ if (upeek(tcp, PT_CR_IPSR, &ipsr) < 0)
return -1;
- if (upeek(pid, PT_CR_IIP, &addr) < 0)
+ if (upeek(tcp, PT_CR_IIP, &addr) < 0)
return -1;
/* restore original bundle: */
tcp->flags &= ~TCB_BPTSET;
#ifdef I386
- if (upeek(tcp->pid, 4*EIP, &eip) < 0)
+ if (upeek(tcp, 4*EIP, &eip) < 0)
return -1;
if (eip != tcp->baddr) {
/* The breakpoint has not been reached yet. */
return 0;
}
#elif defined(X86_64)
- if (upeek(tcp->pid, 8*RIP, &eip) < 0)
+ if (upeek(tcp, 8*RIP, &eip) < 0)
return -1;
if (eip != tcp->baddr) {
/* The breakpoint has not been reached yet. */
return 0;
}
#elif defined(POWERPC)
- if (upeek(tcp->pid, sizeof(unsigned long)*PT_NIP, &pc) < 0)
+ if (upeek(tcp, sizeof(unsigned long)*PT_NIP, &pc) < 0)
return -1;
if (pc != tcp->baddr) {
/* The breakpoint has not been reached yet. */
return 0;
}
#elif defined(M68K)
- if (upeek(tcp->pid, 4*PT_PC, &pc) < 0)
+ if (upeek(tcp, 4*PT_PC, &pc) < 0)
return -1;
if (pc != tcp->baddr) {
/* The breakpoint has not been reached yet. */
return 0;
}
#elif defined(ALPHA)
- if (upeek(tcp->pid, REG_PC, &pc) < 0)
+ if (upeek(tcp, REG_PC, &pc) < 0)
return -1;
if (pc != tcp->baddr) {
/* The breakpoint has not been reached yet. */
return 0;
}
#elif defined(HPPA)
- if (upeek(tcp->pid, PT_IAOQ0, &iaoq) < 0)
+ if (upeek(tcp, PT_IAOQ0, &iaoq) < 0)
return -1;
iaoq &= ~0x03;
if (iaoq != tcp->baddr && iaoq != tcp->baddr + 4) {
ptrace(PTRACE_POKEUSER, tcp->pid, (void *)PT_IAOQ0, iaoq);
ptrace(PTRACE_POKEUSER, tcp->pid, (void *)PT_IAOQ1, iaoq);
#elif defined(SH)
- if (upeek(tcp->pid, 4*REG_PC, &pc) < 0)
+ if (upeek(tcp, 4*REG_PC, &pc) < 0)
return -1;
if (pc != tcp->baddr) {
/* The breakpoint has not been reached yet. */
#ifdef SUNOS4
static int
-getex(pid, hdr)
-int pid;
+getex(tcp, hdr)
+struct tcb *tcp;
struct exec *hdr;
{
int n;
for (n = 0; n < sizeof *hdr; n += 4) {
long res;
- if (upeek(pid, uoff(u_exdata) + n, &res) < 0)
+ if (upeek(tcp, uoff(u_exdata) + n, &res) < 0)
return -1;
memcpy(((char *) hdr) + n, &res, 4);
}
struct link_dynamic_2 ld;
char *strtab, *cp;
- if (getex(pid, &hdr) < 0)
+ if (getex(tcp, &hdr) < 0)
return -1;
if (!hdr.a_dynamic)
return -1;