Home | History | Annotate | Download | only in strace

Lines Matching refs:tcp

335 printnum(tcp, addr, fmt)
336 struct tcb *tcp;
346 if (umove(tcp, addr, &num) < 0) {
390 printpath(tcp, addr)
391 struct tcb *tcp;
396 else if (umovestr(tcp, addr, MAXPATHLEN, path) < 0)
404 printpathn(tcp, addr, n)
405 struct tcb *tcp;
411 else if (umovestr(tcp, addr, n, path) < 0)
420 printstr(tcp, addr, len)
421 struct tcb *tcp;
445 if (umovestr(tcp, addr, n, (char *) str) < 0) {
452 if (umoven(tcp, addr, n, (char *) str) < 0) {
533 dumpiov(tcp, len, addr)
534 struct tcb * tcp;
548 if (umoven(tcp, addr, size, (char *) iov) >= 0) {
554 dumpstr(tcp, (long) iov[i].iov_base,
564 dumpstr(tcp, addr, len)
565 struct tcb *tcp;
585 if (umoven(tcp, addr, len, (char *) str) < 0)
626 umoven(tcp, addr, len, laddr)
627 struct tcb *tcp;
634 int pid = tcp->pid;
680 int pid = tcp->pid;
732 int fd = tcp->pfd_as;
734 int fd = tcp->pfd;
749 umovestr(tcp, addr, len, laddr)
750 struct tcb *tcp;
757 int fd = tcp->pfd_as;
759 int fd = tcp->pfd;
786 int pid = tcp->pid;
986 getpc(tcp)
987 struct tcb *tcp;
993 if (upeek(tcp->pid, 4*EIP, &pc) < 0)
996 if (upeek(tcp->pid, 8*RIP, &pc) < 0)
999 if (upeek(tcp->pid, PT_B0, &pc) < 0)
1002 if (upeek(tcp->pid, 4*15, &pc) < 0)
1005 if (upeek(tcp->pid, sizeof(unsigned long)*PT_NIP, &pc) < 0)
1008 if (upeek(tcp->pid, 4*PT_PC, &pc) < 0)
1011 if (upeek(tcp->pid, REG_PC, &pc) < 0)
1014 if (upeek(tcp->pid, REG_EPC, &pc) < 0)
1018 if (ptrace(PTRACE_GETREGS,tcp->pid,(char *)&regs,0) < 0)
1022 if(upeek(tcp->pid,PT_PSWADDR,&pc) < 0)
1025 if(upeek(tcp->pid,PT_IAOQ0,&pc) < 0)
1028 if (upeek(tcp->pid, 4*REG_PC ,&pc) < 0)
1031 if (upeek(tcp->pid, REG_PC ,&pc) < 0)
1044 if (ptrace(PTRACE_GETREGS, tcp->pid, (char *) &regs, 0) < 0) {
1058 pread(tcp->pfd_reg, &regs, sizeof(regs), 0);
1065 printcall(tcp)
1066 struct tcb *tcp;
1076 if (upeek(tcp->pid, 4*EIP, &eip) < 0) {
1084 if(upeek(tcp->pid,PT_PSWADDR,&psw) < 0) {
1097 if (upeek(tcp->pid, 8*RIP, &rip) < 0) {
1105 if (upeek(tcp->pid, PT_B0, &ip) < 0) {
1113 if (upeek(tcp->pid, sizeof(unsigned long)*PT_NIP, &pc) < 0) {
1121 if (upeek(tcp->pid, 4*PT_PC, &pc) < 0) {
1129 if (upeek(tcp->pid, REG_PC, &pc) < 0) {
1136 if (ptrace(PTRACE_GETREGS,tcp->pid,(char *)&regs,0) < 0) {
1144 if(upeek(tcp->pid,PT_IAOQ0,&pc) < 0) {
1152 if (upeek(tcp->pid, REG_EPC, &pc) < 0) {
1160 if (upeek(tcp->pid, 4*REG_PC, &pc) < 0) {
1168 if (upeek(tcp->pid, REG_PC, &pc) < 0) {
1176 if (upeek(tcp->pid, 4*15, &pc) < 0) {
1187 if (ptrace(PTRACE_GETREGS, tcp->pid, (char *) &regs, 0) < 0) {
1202 pread(tcp->pfd_reg, &regs, sizeof(regs), 0);
1229 arg_setup(struct tcb *tcp, arg_setup_state *state)
1236 if (upeek(tcp->pid, PT_AR_BSP, (long *) &bsp) < 0)
1238 if (upeek(tcp->pid, PT_CFM, (long *) &cfm) < 0)
1249 # define arg_finish_change(tcp, state) 0
1253 get_arg0 (struct tcb *tcp, arg_setup_state *state, long *valp)
1258 ret = upeek (tcp->pid, PT_R11, valp);
1260 ret = umoven (tcp,
1267 get_arg1 (struct tcb *tcp, arg_setup_state *state, long *valp)
1272 ret = upeek (tcp->pid, PT_R9, valp);
1274 ret = umoven (tcp,
1282 set_arg0 (struct tcb *tcp, arg_setup_state *state, long val)
1293 ptrace(req, tcp->pid, ap, val);
1298 set_arg1 (struct tcb *tcp, arg_setup_state *state, long val)
1309 ptrace(req, tcp->pid, ap, val);
1317 # define arg_setup(tcp, state) \
1318 (ptrace (PTRACE_GETREGS, tcp->pid, (char *) (state), 0))
1319 # define arg_finish_change(tcp, state) \
1320 (ptrace (PTRACE_SETREGS, tcp->pid, (char *) (state), 0))
1322 # define get_arg0(tcp, state, valp) (*(valp) = (state)->r_o0, 0)
1323 # define get_arg1(tcp, state, valp) (*(valp) = (state)->r_o1, 0)
1324 # define set_arg0(tcp, state, val) ((state)->r_o0 = (val), 0)
1325 # define set_arg1(tcp, state, val) ((state)->r_o1 = (val), 0)
1326 # define restore_arg0(tcp, state, val) 0
1337 # define restore_arg0(tcp, state, val) ((void) (state), 0)
1338 # define restore_arg1(tcp, state, val) ((void) (state), 0)
1347 # define restore_arg0(tcp, state, val) ((void) (state), 0)
1361 # define restore_arg0(tcp, state, val) 0
1366 # define restore_arg0(tcp, state, val) 0
1372 # define arg_setup(tcp, state) (0)
1373 # define arg_finish_change(tcp, state) 0
1374 # define get_arg0(tcp, cookie, valp) \
1375 (upeek ((tcp)->pid, arg0_offset, (valp)))
1376 # define get_arg1(tcp, cookie, valp) \
1377 (upeek ((tcp)->pid, arg1_offset, (valp)))
1380 set_arg0 (struct tcb *tcp, void *cookie, long val)
1382 return ptrace (PTRACE_POKEUSER, tcp->pid, (char*)arg0_offset, val);
1386 set_arg1 (struct tcb *tcp, void *cookie, long val)
1388 return ptrace (PTRACE_POKEUSER, tcp->pid, (char*)arg1_offset, val);
1394 # define restore_arg0(tcp, state, val) set_arg0((tcp), (state), (val))
1397 # define restore_arg1(tcp, state, val) set_arg1((tcp), (state), (val))
1406 setbpt(tcp)
1407 struct tcb *tcp;
1412 if (tcp->flags & TCB_BPTSET) {
1413 fprintf(stderr, "PANIC: TCB already set in pid %u\n", tcp->pid);
1417 switch (known_scno(tcp)) {
1425 if (arg_setup (tcp, &state) < 0
1426 || get_arg0 (tcp, &state, &tcp->inst[0]) < 0
1427 || get_arg1 (tcp, &state, &tcp->inst[1]) < 0
1428 || change_syscall(tcp, SYS_clone) < 0
1429 || set_arg0 (tcp, &state, CLONE_PTRACE|SIGCHLD) < 0
1430 || set_arg1 (tcp, &state, 0) < 0
1431 || arg_finish_change (tcp, &state) < 0)
1433 tcp->u_arg[arg0_index] = CLONE_PTRACE|SIGCHLD;
1434 tcp->u_arg[arg1_index] = 0;
1435 tcp->flags |= TCB_BPTSET;
1443 if ((tcp->u_arg[arg0_index] & CLONE_PTRACE) == 0
1444 && (arg_setup (tcp, &state) < 0
1445 || set_arg0 (tcp, &state,
1446 tcp->u_arg[arg0_index] | CLONE_PTRACE) < 0
1447 || arg_finish_change (tcp, &state) < 0))
1449 tcp->flags |= TCB_BPTSET;
1450 tcp->inst[0] = tcp->u_arg[arg0_index];
1451 tcp->inst[1] = tcp->u_arg[arg1_index];
1456 tcp->scno, tcp->pid);
1464 clearbpt(tcp)
1465 struct tcb *tcp;
1468 if (arg_setup (tcp, &state) < 0
1469 || restore_arg0 (tcp, &state, tcp->inst[0]) < 0
1470 || restore_arg1 (tcp, &state, tcp->inst[1]) < 0
1471 || arg_finish_change (tcp, &state))
1473 tcp->flags &= ~TCB_BPTSET;
1480 setbpt(tcp)
1481 struct tcb *tcp;
1492 if (tcp->flags & TCB_BPTSET) {
1493 fprintf(stderr, "PANIC: TCB already set in pid %u\n", tcp->pid);
1496 if (ptrace(PTRACE_GETREGS, tcp->pid, (char *)&regs, 0) < 0) {
1500 tcp->baddr = regs.r_o7 + 8;
1502 tcp->inst[0] = ptrace(PTRACE_PEEKTEXT, tcp->pid, (char *)tcp->baddr, 0);
1522 inst |= (tcp->inst[0] & 0xffffffffUL);
1524 ptrace(PTRACE_POKETEXT, tcp->pid, (char *) tcp->baddr, inst);
1529 tcp->flags |= TCB_BPTSET;
1535 if (tcp->flags & TCB_BPTSET) {
1537 tcp->pid);
1540 if (upeek(tcp->pid, PT_CR_IIP, &tcp->baddr) < 0)
1544 tcp->pid, tcp->baddr);
1545 tcp->inst[0] = ptrace(PTRACE_PEEKTEXT, tcp->pid,
1546 (char *) tcp->baddr, 0);
1551 ptrace(PTRACE_POKETEXT, tcp->pid, (char *) tcp->baddr, LOOP);
1556 tcp->flags |= TCB_BPTSET;
1573 pid = tcp->pid;
1579 tcp->baddr = addr | ((ipsr >> 41) & 0x3);
1582 tcp->inst[0] = ptrace(PTRACE_PEEKTEXT, pid, (char *) addr + 0,
1584 tcp->inst[1] = ptrace(PTRACE_PEEKTEXT, pid, (char *) addr + 8,
1598 tcp->flags |= TCB_BPTSET;
1630 if (tcp->flags & TCB_BPTSET) {
1631 fprintf(stderr, "PANIC: bpt already set in pid %u\n", tcp->pid);
1635 if (upeek(tcp->pid, 4*EIP, &tcp->baddr) < 0)
1638 if (upeek(tcp->pid, 8*RIP, &tcp->baddr) < 0)
1641 if (upeek(tcp->pid, 4*PT_PC, &tcp->baddr) < 0)
1650 if (upeek(tcp->pid, sizeof(unsigned long)*PT_NIP, &tcp->baddr) < 0)
1653 if (upeek(tcp->pid,PT_PSWADDR, &tcp->baddr) < 0)
1656 if (upeek(tcp->pid, PT_IAOQ0, &tcp->baddr) < 0)
1658 tcp->baddr &= ~0x03;
1660 if (upeek(tcp->pid, 4*REG_PC, &tcp->baddr) < 0)
1666 fprintf(stderr, "[%d] setting bpt at %lx\n", tcp->pid, tcp->baddr);
1667 tcp->inst[0] = ptrace(PTRACE_PEEKTEXT, tcp->pid, (char *) tcp->baddr, 0);
1672 ptrace(PTRACE_POKETEXT, tcp->pid, (char *) tcp->baddr, LOOP);
1677 tcp->flags |= TCB_BPTSET;
1697 if (tcp->flags & TCB_BPTSET) {
1698 fprintf(stderr, "PANIC: TCB already set in pid %u\n", tcp->pid);
1701 if (ptrace(PTRACE_GETREGS, tcp->pid, (char *)&regs, 0) < 0) {
1705 tcp->baddr = regs.r_o7 + 8;
1706 if (ptrace(PTRACE_READTEXT, tcp->pid, (char *)tcp->baddr,
1707 sizeof tcp->inst, (char *)tcp->inst) < 0) {
1722 if (ptrace(PTRACE_WRITETEXT, tcp->pid, (char *) tcp->baddr,
1727 tcp->flags |= TCB_BPTSET;
1736 clearbpt(tcp)
1737 struct tcb *tcp;
1757 if (!(tcp->flags & TCB_BPTSET)) {
1758 fprintf(stderr, "PANIC: TCB not set in pid %u\n", tcp->pid);
1762 ptrace(PTRACE_POKETEXT, tcp->pid, (char *) tcp->baddr, tcp->inst[0]);
1767 tcp->flags &= ~TCB_BPTSET;
1773 fprintf(stderr, "[%d] clearing bpt\n", tcp->pid);
1774 if (!(tcp->flags & TCB_BPTSET)) {
1775 fprintf(stderr, "PANIC: TCB not set in pid %u\n", tcp->pid);
1779 ptrace(PTRACE_POKETEXT, tcp->pid, (char *) tcp->baddr, tcp->inst[0]);
1784 tcp->flags &= ~TCB_BPTSET;
1786 if (upeek(tcp->pid, PT_CR_IIP, &addr) < 0)
1788 if (addr != tcp->baddr) {
1793 addr, tcp->baddr);
1800 pid = tcp->pid;
1809 ptrace(PTRACE_POKETEXT, pid, (char *) addr + 0, tcp->inst[0]);
1810 ptrace(PTRACE_POKETEXT, pid, (char *) addr + 8, tcp->inst[1]);
1817 ipsr = (ipsr & ~(0x3ul << 41)) | ((tcp->baddr & 0x3) << 41);
1825 tcp->flags &= ~TCB_BPTSET;
1827 if (addr != (tcp->baddr & ~0x3)) {
1831 addr, tcp->baddr);
1838 fprintf(stderr, "[%d] clearing bpt\n", tcp->pid);
1839 if (!(tcp->flags & TCB_BPTSET)) {
1840 fprintf(stderr, "PANIC: TCB not set in pid %u\n", tcp->pid);
1844 ptrace(PTRACE_POKETEXT, tcp->pid, (char *) tcp->baddr, tcp->inst[0]);
1849 tcp->flags &= ~TCB_BPTSET;
1852 if (upeek(tcp->pid, 4*EIP, &eip) < 0)
1854 if (eip != tcp->baddr) {
1859 eip, tcp->baddr);
1863 if (upeek(tcp->pid, 8*RIP, &eip) < 0)
1865 if (eip != tcp->baddr) {
1870 eip, tcp->baddr);
1874 if (upeek(tcp->pid, sizeof(unsigned long)*PT_NIP, &pc) < 0)
1876 if (pc != tcp->baddr) {
1880 pc, tcp->baddr);
1884 if (upeek(tcp->pid, 4*PT_PC, &pc) < 0)
1886 if (pc != tcp->baddr) {
1890 pc, tcp->baddr);
1894 if (upeek(tcp->pid, REG_PC, &pc) < 0)
1896 if (pc != tcp->baddr) {
1900 pc, tcp->baddr);
1904 if (upeek(tcp->pid, PT_IAOQ0, &iaoq) < 0)
1907 if (iaoq != tcp->baddr && iaoq != tcp->baddr + 4) {
1911 iaoq, tcp->baddr);
1914 iaoq = tcp->baddr | 3;
1919 ptrace(PTRACE_POKEUSER, tcp->pid, (void *)PT_IAOQ0, iaoq);
1920 ptrace(PTRACE_POKEUSER, tcp->pid, (void *)PT_IAOQ1, iaoq);
1922 if (upeek(tcp->pid, 4*REG_PC, &pc) < 0)
1924 if (pc != tcp->baddr) {
1928 pc, tcp->baddr);
1943 if (!(tcp->flags & TCB_BPTSET)) {
1944 fprintf(stderr, "PANIC: TCB not set in pid %u\n", tcp->pid);
1947 if (ptrace(PTRACE_WRITETEXT, tcp->pid, (char *) tcp->baddr,
1948 sizeof tcp->inst, (char *) tcp->inst) < 0) {
1952 tcp->flags &= ~TCB_BPTSET;
1959 if (ptrace(PTRACE_GETREGS, tcp->pid, (char *)&regs, 0) < 0) {
1963 if ((regs.r_pc < tcp->baddr) ||
1964 (regs.r_pc > tcp->baddr + 4)) {
1969 regs.r_pc, tcp->parent->baddr);
1972 if (regs.r_pc != tcp->baddr)
1975 regs.r_pc, tcp->baddr);
1977 regs.r_pc = tcp->baddr;
1978 if (ptrace(PTRACE_SETREGS, tcp->pid, (char *)&regs, 0) < 0) {
2018 fixvfork(tcp)
2019 struct tcb *tcp;
2021 int pid = tcp->pid;
2037 if (umove(tcp, (int) N_DATADDR(hdr), &dyn) < 0) {
2041 if (umove(tcp, (int) dyn.ld_un.ld_2, &ld) < 0) {
2049 if (umoven(tcp, (int)ld.ld_symbols+(int)N_TXTADDR(hdr),