2 * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
3 * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
5 * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
6 * Copyright (c) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Linux for s390 port by D.J. Barrow
8 * <barrow_dj@mail.yahoo.com,djbarrow@de.ibm.com>
10 * All rights reserved.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 #include <sys/resource.h>
44 #include <sys/utsname.h>
46 #include <sys/syscall.h>
49 #include <machine/reg.h>
52 #if HAVE_LINUX_PTRACE_H
54 #include <linux/ptrace.h>
59 #ifndef PTRACE_PEEKUSR
60 # define PTRACE_PEEKUSR PTRACE_PEEKUSER
62 #ifndef PTRACE_POKEUSR
63 # define PTRACE_POKEUSR PTRACE_POKEUSER
68 #include <asm/posix_types.h>
70 #define GETGROUPS_T __kernel_gid_t
73 #if defined(LINUX) && defined(IA64)
74 # include <asm/ptrace_offsets.h>
79 #include <sys/prctl.h>
83 #define WCOREDUMP(status) ((status) & 0200)
86 /* WTA: this was `&& !defined(LINUXSPARC)', this seems unneeded though? */
87 #if defined(HAVE_PRCTL)
88 static struct xlat prctl_options[] = {
90 { PR_MAXPROCS, "PR_MAXPROCS" },
93 { PR_ISBLOCKED, "PR_ISBLOCKED" },
95 #ifdef PR_SETSTACKSIZE
96 { PR_SETSTACKSIZE, "PR_SETSTACKSIZE" },
98 #ifdef PR_GETSTACKSIZE
99 { PR_GETSTACKSIZE, "PR_GETSTACKSIZE" },
102 { PR_MAXPPROCS, "PR_MAXPPROCS" },
104 #ifdef PR_UNBLKONEXEC
105 { PR_UNBLKONEXEC, "PR_UNBLKONEXEC" },
108 { PR_ATOMICSIM, "PR_ATOMICSIM" },
111 { PR_SETEXITSIG, "PR_SETEXITSIG" },
114 { PR_RESIDENT, "PR_RESIDENT" },
117 { PR_ATTACHADDR, "PR_ATTACHADDR" },
120 { PR_DETACHADDR, "PR_DETACHADDR" },
123 { PR_TERMCHILD, "PR_TERMCHILD" },
126 { PR_GETSHMASK, "PR_GETSHMASK" },
129 { PR_GETNSHARE, "PR_GETNSHARE" },
131 #if defined(PR_SET_PDEATHSIG)
132 { PR_SET_PDEATHSIG, "PR_SET_PDEATHSIG" },
135 { PR_COREPID, "PR_COREPID" },
137 #ifdef PR_ATTACHADDRPERM
138 { PR_ATTACHADDRPERM, "PR_ATTACHADDRPERM" },
140 #ifdef PR_PTHREADEXIT
141 { PR_PTHREADEXIT, "PR_PTHREADEXIT" },
143 #ifdef PR_SET_PDEATHSIG
144 { PR_SET_PDEATHSIG, "PR_SET_PDEATHSIG" },
146 #ifdef PR_GET_PDEATHSIG
147 { PR_GET_PDEATHSIG, "PR_GET_PDEATHSIG" },
159 printxval(prctl_options, tcp->u_arg[0], "PR_???");
160 switch (tcp->u_arg[0]) {
165 #ifdef PR_SET_DEATHSIG
166 case PR_GET_PDEATHSIG:
170 for (i = 1; i < tcp->u_nargs; i++)
171 tprintf(", %#lx", tcp->u_arg[i]);
175 switch (tcp->u_arg[0]) {
176 #ifdef PR_GET_PDEATHSIG
177 case PR_GET_PDEATHSIG:
178 for (i=1; i<tcp->u_nargs; i++)
179 tprintf(", %#lx", tcp->u_arg[i]);
189 #endif /* HAVE_PRCTL */
205 printpathn(tcp, tcp->u_arg[0], tcp->u_arg[1]);
206 tprintf(", %lu", tcp->u_arg[1]);
217 tprintf("%#lx", tcp->u_arg[0]);
219 printpath(tcp, tcp->u_arg[0]);
220 tprintf(", %lu", tcp->u_arg[1]);
226 sys_setdomainname(tcp)
230 printpathn(tcp, tcp->u_arg[0], tcp->u_arg[1]);
231 tprintf(", %lu", tcp->u_arg[1]);
239 sys_getdomainname(tcp)
244 tprintf("%#lx", tcp->u_arg[0]);
246 printpath(tcp, tcp->u_arg[0]);
247 tprintf(", %lu", tcp->u_arg[1]);
258 fprintf(stderr, "_exit returned!\n");
261 /* special case: we stop tracing this process, finish line now */
262 tprintf("%ld) ", tcp->u_arg[0]);
274 tcp->flags |= TCB_EXITING;
286 tcp->auxstr = "child process";
287 return RVAL_UDECIMAL | RVAL_STR;
294 change_syscall(tcp, new)
298 #if defined(I386) && defined(LINUX)
299 /* Attempt to make vfork into fork, which we can follow. */
300 if (ptrace(PTRACE_POKEUSER, tcp->pid,
301 (void *)(ORIG_EAX * 4), new) < 0)
312 struct tcb *tcpchild;
319 if (nprocs == MAX_PROCS) {
320 tcp->flags &= ~TCB_FOLLOWFORK;
321 fprintf(stderr, "sys_fork: tcb table full\n");
325 tcp->flags |= TCB_FOLLOWFORK;
328 if ((tcpchild = alloctcb(tcp->u_rval)) == NULL) {
329 fprintf(stderr, "sys_fork: tcb table full\n");
332 proc_open(tcpchild, 1);
341 /* defines copied from linux/sched.h since we can't include that
342 * ourselves (it conflicts with *lots* of libc includes)
344 #define CSIGNAL 0x000000ff /* signal mask to be sent at exit */
345 #define CLONE_VM 0x00000100 /* set if VM shared between processes */
346 #define CLONE_FS 0x00000200 /* set if fs info shared between processes */
347 #define CLONE_FILES 0x00000400 /* set if open files shared between processes */
348 #define CLONE_SIGHAND 0x00000800 /* set if signal handlers shared */
349 #define CLONE_PID 0x00001000 /* set if pid shared */
350 #define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */
351 #define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */
352 #define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */
354 static struct xlat clone_flags[] = {
355 { CLONE_VM, "CLONE_VM" },
356 { CLONE_FS, "CLONE_FS" },
357 { CLONE_FILES, "CLONE_FILES" },
358 { CLONE_SIGHAND, "CLONE_SIGHAND" },
359 { CLONE_PID, "CLONE_PID" },
360 { CLONE_PTRACE, "CLONE_PTRACE" },
361 { CLONE_VFORK, "CLONE_VFORK" },
362 { CLONE_PARENT, "CLONE_PARENT" },
371 tprintf("child_stack=%#lx, flags=", tcp->u_arg[1]);
372 if (printflags(clone_flags, tcp->u_arg[0]) == 0)
385 return RVAL_UDECIMAL;
396 unsigned long *bsp, *ap;
398 if (upeek(tcp->pid, PT_AR_BSP, (long *) &bsp) , 0)
401 ap = ia64_rse_skip_regs(bsp, argnum);
403 ptrace(PTRACE_POKEDATA, tcp->pid, ap, tcp->u_arg[argnum]);
409 # error Sorry, not done yet.
419 struct tcb *tcpchild;
424 if (nprocs == MAX_PROCS) {
425 tcp->flags &= ~TCB_FOLLOWFORK;
426 fprintf(stderr, "sys_fork: tcb table full\n");
429 tcp->flags |= TCB_FOLLOWFORK;
431 tcp->u_arg[0] |= CLONE_PTRACE;
434 if (!(tcp->flags & TCB_FOLLOWFORK))
441 if ((tcpchild = alloctcb(pid)) == NULL) {
442 fprintf(stderr, " [tcb table full]\n");
443 kill(pid, SIGKILL); /* XXX */
447 /* For fork we need to re-attach, but thanks to CLONE_PTRACE we're
450 tcpchild->flags |= TCB_ATTACHED;
454 fprintf(stderr, "Process %d attached\n", pid);
464 struct tcb *tcpchild;
469 if (tcp->scno == SYS_vfork) {
470 /* Attempt to make vfork into fork, which we can follow. */
472 change_syscall(tcp, SYS_fork) < 0)
477 if (!followfork || dont_follow)
479 if (nprocs == MAX_PROCS) {
480 tcp->flags &= ~TCB_FOLLOWFORK;
481 fprintf(stderr, "sys_fork: tcb table full\n");
484 tcp->flags |= TCB_FOLLOWFORK;
489 int bpt = tcp->flags & TCB_BPTSET;
491 if (!(tcp->flags & TCB_FOLLOWFORK))
500 if ((tcpchild = alloctcb(pid)) == NULL) {
501 fprintf(stderr, " [tcb table full]\n");
502 kill(pid, SIGKILL); /* XXX */
506 if (ptrace(PTRACE_ATTACH, pid, (char *) 1, 0) < 0) {
507 perror("PTRACE_ATTACH");
508 fprintf(stderr, "Too late?\n");
515 /* The child must have run before it can be attached. */
520 select(0, NULL, NULL, NULL, &tv);
522 if (ptrace(PTRACE_ATTACH, pid, (char *)1, 0) < 0) {
523 perror("PTRACE_ATTACH");
524 fprintf(stderr, "Too late?\n");
529 /* Try to catch the new process as soon as possible. */
532 for (i = 0; i < 1024; i++)
533 if (ptrace(PTRACE_ATTACH, pid, (char *) 1, 0) >= 0)
536 perror("PTRACE_ATTACH");
537 fprintf(stderr, "Too late?\n");
544 tcpchild->flags |= TCB_ATTACHED;
545 /* Child has BPT too, must be removed on first occasion */
547 tcpchild->flags |= TCB_BPTSET;
548 tcpchild->baddr = tcp->baddr;
549 memcpy(tcpchild->inst, tcp->inst,
550 sizeof tcpchild->inst);
553 tcpchild->parent = tcp;
556 fprintf(stderr, "Process %d attached\n", pid);
563 #if defined(SUNOS4) || defined(LINUX)
570 return RVAL_UDECIMAL;
574 #endif /* SUNOS4 || LINUX */
578 static char idstr[16];
585 sprintf(idstr, "ppid %lu", getrval2(tcp));
597 sprintf(idstr, "euid %lu", getrval2(tcp));
609 sprintf(idstr, "egid %lu", getrval2(tcp));
625 tprintf("%u", (uid_t) tcp->u_arg[0]);
635 tprintf("%u", (gid_t) tcp->u_arg[0]);
647 tprintf("%#lx, %#lx, %#lx", tcp->u_arg[0],
648 tcp->u_arg[1], tcp->u_arg[2]);
650 if (umove(tcp, tcp->u_arg[0], &uid) < 0)
651 tprintf("%#lx, ", tcp->u_arg[0]);
653 tprintf("ruid %lu, ", (unsigned long) uid);
654 if (umove(tcp, tcp->u_arg[0], &uid) < 0)
655 tprintf("%#lx, ", tcp->u_arg[0]);
657 tprintf("euid %lu, ", (unsigned long) uid);
658 if (umove(tcp, tcp->u_arg[0], &uid) < 0)
659 tprintf("%#lx", tcp->u_arg[0]);
661 tprintf("suid %lu", (unsigned long) uid);
674 tprintf("%#lx, %#lx, %#lx", tcp->u_arg[0],
675 tcp->u_arg[1], tcp->u_arg[2]);
677 if (umove(tcp, tcp->u_arg[0], &gid) < 0)
678 tprintf("%#lx, ", tcp->u_arg[0]);
680 tprintf("rgid %lu, ", (unsigned long) gid);
681 if (umove(tcp, tcp->u_arg[0], &gid) < 0)
682 tprintf("%#lx, ", tcp->u_arg[0]);
684 tprintf("egid %lu, ", (unsigned long) gid);
685 if (umove(tcp, tcp->u_arg[0], &gid) < 0)
686 tprintf("%#lx", tcp->u_arg[0]);
688 tprintf("sgid %lu", (unsigned long) gid);
702 (unsigned long) (uid_t) tcp->u_arg[0],
703 (unsigned long) (uid_t) tcp->u_arg[1]);
714 (unsigned long) (gid_t) tcp->u_arg[0],
715 (unsigned long) (gid_t) tcp->u_arg[1]);
726 tprintf("ruid %u, euid %u, suid %u",
727 (uid_t) tcp->u_arg[0],
728 (uid_t) tcp->u_arg[1],
729 (uid_t) tcp->u_arg[2]);
738 tprintf("rgid %u, egid %u, sgid %u",
739 (uid_t) tcp->u_arg[0],
740 (uid_t) tcp->u_arg[1],
741 (uid_t) tcp->u_arg[2]);
757 tprintf("%u, ", len);
762 gidset = (GETGROUPS_T *) malloc(len * sizeof(GETGROUPS_T));
763 if (gidset == NULL) {
764 fprintf(stderr, "sys_setgroups: out of memory\n");
768 tprintf("%#lx", tcp->u_arg[1]);
769 else if (umoven(tcp, tcp->u_arg[1],
770 len * sizeof(GETGROUPS_T), (char *) gidset) < 0)
774 for (i = 0; i < len; i++)
775 tprintf("%s%lu", i ? ", " : "",
776 (unsigned long) gidset[i]);
779 free((char *) gidset);
793 tprintf("%u, ", len);
800 gidset = (GETGROUPS_T *) malloc(len * sizeof(GETGROUPS_T));
801 if (gidset == NULL) {
802 fprintf(stderr, "sys_getgroups: out of memory\n");
807 else if (!verbose(tcp) || tcp->u_arg[0] == 0)
808 tprintf("%#lx", tcp->u_arg[1]);
809 else if (umoven(tcp, tcp->u_arg[1],
810 len * sizeof(GETGROUPS_T), (char *) gidset) < 0)
814 for (i = 0; i < len; i++)
815 tprintf("%s%lu", i ? ", " : "",
816 (unsigned long) gidset[i]);
819 free((char *)gidset);
830 tprintf("%lu, %lu", tcp->u_arg[0], tcp->u_arg[1]);
842 tprintf("%lu", tcp->u_arg[0]);
853 tprintf("%lu", tcp->u_arg[0]);
870 tprintf("%lu", tcp->u_arg[0]);
880 tprintf("%lu, %lu", tcp->u_arg[0], tcp->u_arg[1]);
886 fake_execve(tcp, program, argv, envp)
895 if (!(qual_flags[SYS_execve - __NR_SYSCALL_BASE] & QUAL_TRACE))
898 if (!(qual_flags[SYS_execve] & QUAL_TRACE))
903 string_quote(program);
905 for (i = 0; argv[i] != NULL; i++) {
908 string_quote(argv[i]);
910 for (i = 0; envp[i] != NULL; i++)
912 tprintf("], [/* %d var%s */]) ", i, (i != 1) ? "s" : "");
925 int max = max_strlen / 2;
927 for (sep = ""; --max >= 0; sep = ", ") {
930 if (umove(tcp, addr, &cp) < 0) {
931 tprintf("%#lx", addr);
937 printstr(tcp, (long) cp, -1);
938 addr += sizeof(char *);
945 printargc(fmt, tcp, addr)
953 for (count = 0; umove(tcp, addr, &cp) >= 0 && cp != NULL; count++) {
954 addr += sizeof(char *);
956 tprintf(fmt, count, count == 1 ? "" : "s");
964 printpath(tcp, tcp->u_arg[0]);
966 tprintf(", %#lx", tcp->u_arg[1]);
968 else if (abbrev(tcp))
969 printargc(", [/* %d arg%s */]", tcp, tcp->u_arg[1]);
973 printargv(tcp, tcp->u_arg[1]);
985 printpath(tcp, tcp->u_arg[0]);
987 tprintf(", %#lx", tcp->u_arg[1]);
989 else if (abbrev(tcp))
990 printargc(", [/* %d arg%s */]", tcp, tcp->u_arg[1]);
994 printargv(tcp, tcp->u_arg[1]);
998 tprintf(", %#lx", tcp->u_arg[2]);
999 else if (abbrev(tcp))
1000 printargc(", [/* %d var%s */]", tcp, tcp->u_arg[2]);
1003 printargv(tcp, tcp->u_arg[2]);
1008 #if defined(ALPHA) || defined(SPARC) || defined(POWERPC)
1009 tcp->flags |= TCB_WAITEXECVE;
1010 #endif /* ALPHA || SPARC || POWERPC */
1020 if (exiting(tcp) && !syserror(tcp) && followfork)
1028 #define __WCLONE 0x8000000
1032 static struct xlat wait4_options[] = {
1033 { WNOHANG, "WNOHANG" },
1035 { WUNTRACED, "WUNTRACED" },
1038 { WEXITED, "WEXITED" },
1041 { WTRAPPED, "WTRAPPED" },
1044 { WSTOPPED, "WSTOPPED" },
1047 { WCONTINUED, "WCONTINUED" },
1050 { WNOWAIT, "WNOWAIT" },
1053 { __WCLONE, "__WCLONE" },
1065 * Here is a tricky presentation problem. This solution
1066 * is still not entirely satisfactory but since there
1067 * are no wait status constructors it will have to do.
1069 if (WIFSTOPPED(status))
1070 tprintf("[WIFSTOPPED(s) && WSTOPSIG(s) == %s]",
1071 signame(WSTOPSIG(status)));
1072 else if WIFSIGNALED(status)
1073 tprintf("[WIFSIGNALED(s) && WTERMSIG(s) == %s%s]",
1074 signame(WTERMSIG(status)),
1075 WCOREDUMP(status) ? " && WCOREDUMP(s)" : "");
1076 else if WIFEXITED(status) {
1077 tprintf("[WIFEXITED(s) && WEXITSTATUS(s) == %d]",
1078 WEXITSTATUS(status));
1082 tprintf("[%#x]", status);
1087 printwaitn(tcp, n, bitness)
1095 if (entering(tcp)) {
1096 tprintf("%ld, ", tcp->u_arg[0]);
1101 else if (syserror(tcp) || tcp->u_rval == 0)
1102 tprintf("%#lx", tcp->u_arg[1]);
1103 else if (umove(tcp, tcp->u_arg[1], &status) < 0)
1106 exited = printstatus(status);
1109 if (!printflags(wait4_options, tcp->u_arg[2]))
1117 else if (tcp->u_rval > 0) {
1120 printrusage32(tcp, tcp->u_arg[3]);
1123 printrusage(tcp, tcp->u_arg[3]);
1127 else if (tcp->u_rval > 0 && exited)
1128 printrusage(tcp, tcp->u_arg[3]);
1131 tprintf("%#lx", tcp->u_arg[3]);
1141 if (entering(tcp)) {
1142 /* WTA: fix bug with hanging children */
1143 if (!(tcp->u_arg[2] & WNOHANG) && tcp->nchildren > 0) {
1144 /* There are traced children */
1145 tcp->flags |= TCB_SUSPENDED;
1146 tcp->waitpid = tcp->u_arg[0];
1159 /* The library wrapper stuffs this into the user variable. */
1161 printstatus(getrval2(tcp));
1172 return printwaitn(tcp, 3, 0);
1179 return printwaitn(tcp, 4, 0);
1187 return printwaitn(tcp, 4, 1);
1193 static struct xlat waitid_types[] = {
1195 { P_PPID, "P_PPID" },
1196 { P_PGID, "P_PGID" },
1203 { P_LWPID, "P_LWPID" },
1208 static struct xlat siginfo_codes[] = {
1210 { SI_NOINFO, "SI_NOINFO" },
1213 { SI_USER, "SI_USER" },
1216 { SI_LWP, "SI_LWP" },
1219 { SI_QUEUE, "SI_QUEUE" },
1222 { SI_TIMER, "SI_TIMER" },
1225 { SI_ASYNCIO, "SI_ASYNCIO" },
1228 { SI_MESGQ, "SI_MESGQ" },
1233 static struct xlat sigtrap_codes[] = {
1234 { TRAP_BRKPT, "TRAP_BRKPT" },
1235 { TRAP_TRACE, "TRAP_TRACE" },
1239 static struct xlat sigcld_codes[] = {
1240 { CLD_EXITED, "CLD_EXITED" },
1241 { CLD_KILLED, "CLD_KILLED" },
1242 { CLD_DUMPED, "CLD_DUMPED" },
1243 { CLD_TRAPPED, "CLD_TRAPPED" },
1244 { CLD_STOPPED, "CLD_STOPPED" },
1245 { CLD_CONTINUED,"CLD_CONTINUED" },
1249 static struct xlat sigpoll_codes[] = {
1250 { POLL_IN, "POLL_IN" },
1251 { POLL_OUT, "POLL_OUT" },
1252 { POLL_MSG, "POLL_MSG" },
1253 { POLL_ERR, "POLL_ERR" },
1254 { POLL_PRI, "POLL_PRI" },
1255 { POLL_HUP, "POLL_HUP" },
1259 static struct xlat sigprof_codes[] = {
1261 { PROF_SIG, "PROF_SIG" },
1266 static struct xlat sigill_codes[] = {
1267 { ILL_ILLOPC, "ILL_ILLOPC" },
1268 { ILL_ILLOPN, "ILL_ILLOPN" },
1269 { ILL_ILLADR, "ILL_ILLADR" },
1270 { ILL_ILLTRP, "ILL_ILLTRP" },
1271 { ILL_PRVOPC, "ILL_PRVOPC" },
1272 { ILL_PRVREG, "ILL_PRVREG" },
1273 { ILL_COPROC, "ILL_COPROC" },
1274 { ILL_BADSTK, "ILL_BADSTK" },
1278 static struct xlat sigemt_codes[] = {
1280 { EMT_TAGOVF, "EMT_TAGOVF" },
1285 static struct xlat sigfpe_codes[] = {
1286 { FPE_INTDIV, "FPE_INTDIV" },
1287 { FPE_INTOVF, "FPE_INTOVF" },
1288 { FPE_FLTDIV, "FPE_FLTDIV" },
1289 { FPE_FLTOVF, "FPE_FLTOVF" },
1290 { FPE_FLTUND, "FPE_FLTUND" },
1291 { FPE_FLTRES, "FPE_FLTRES" },
1292 { FPE_FLTINV, "FPE_FLTINV" },
1293 { FPE_FLTSUB, "FPE_FLTSUB" },
1297 static struct xlat sigsegv_codes[] = {
1298 { SEGV_MAPERR, "SEGV_MAPERR" },
1299 { SEGV_ACCERR, "SEGV_ACCERR" },
1303 static struct xlat sigbus_codes[] = {
1304 { BUS_ADRALN, "BUS_ADRALN" },
1305 { BUS_ADRERR, "BUS_ADRERR" },
1306 { BUS_OBJERR, "BUS_OBJERR" },
1316 tprintf("{si_signo=");
1317 printsignal(sip->si_signo);
1318 code = xlookup(siginfo_codes, sip->si_code);
1320 switch (sip->si_signo) {
1322 code = xlookup(sigtrap_codes, sip->si_code);
1325 code = xlookup(sigcld_codes, sip->si_code);
1328 code = xlookup(sigpoll_codes, sip->si_code);
1331 code = xlookup(sigprof_codes, sip->si_code);
1334 code = xlookup(sigill_codes, sip->si_code);
1337 code = xlookup(sigemt_codes, sip->si_code);
1340 code = xlookup(sigfpe_codes, sip->si_code);
1343 code = xlookup(sigsegv_codes, sip->si_code);
1346 code = xlookup(sigbus_codes, sip->si_code);
1351 tprintf(", si_code=%s", code);
1353 tprintf(", si_code=%#x", sip->si_code);
1355 if (sip->si_code != SI_NOINFO) {
1357 if (sip->si_errno) {
1358 if (sip->si_errno < 0 || sip->si_errno >= nerrnos)
1359 tprintf(", si_errno=%d", sip->si_errno);
1361 tprintf(", si_errno=%s",
1362 errnoent[sip->si_errno]);
1364 if (SI_FROMUSER(sip)) {
1366 tprintf(", si_pid=%ld, si_uid=%ld",
1367 sip->si_pid, sip->si_uid);
1368 switch (sip->si_code) {
1372 #endif /* SI_QUEUE */
1376 #endif /* SI_MESGQ */
1377 tprintf(", si_value=%d",
1378 sip->si_value.sival_int);
1381 #endif /* SI_QUEUE */
1384 switch (sip->si_signo) {
1386 tprintf(", si_pid=%ld, si_status=",
1388 if (sip->si_code == CLD_EXITED)
1389 tprintf("%d", sip->si_status);
1391 printsignal(sip->si_status);
1393 case SIGILL: case SIGFPE:
1394 case SIGSEGV: case SIGBUS:
1395 tprintf(", si_addr=%#lx",
1396 (unsigned long) sip->si_addr);
1399 switch (sip->si_code) {
1400 case POLL_IN: case POLL_OUT: case POLL_MSG:
1401 tprintf(", si_band=%ld",
1402 (long) sip->si_band);
1422 if (entering(tcp)) {
1423 printxval(waitid_types, tcp->u_arg[0], "P_???");
1424 tprintf(", %ld, ", tcp->u_arg[1]);
1425 if (tcp->nchildren > 0) {
1426 /* There are traced children */
1427 tcp->flags |= TCB_SUSPENDED;
1428 tcp->waitpid = tcp->u_arg[0];
1436 else if (syserror(tcp))
1437 tprintf("%#lx", tcp->u_arg[2]);
1438 else if (umove(tcp, tcp->u_arg[2], &si) < 0)
1444 if (!printflags(wait4_options, tcp->u_arg[3]))
1457 tprintf("%lu", tcp->u_arg[0]);
1465 struct utsname uname;
1468 if (syserror(tcp) || !verbose(tcp))
1469 tprintf("%#lx", tcp->u_arg[0]);
1470 else if (umove(tcp, tcp->u_arg[0], &uname) < 0)
1472 else if (!abbrev(tcp)) {
1474 tprintf("{sysname=\"%s\", nodename=\"%s\", ",
1475 uname.sysname, uname.nodename);
1476 tprintf("release=\"%s\", version=\"%s\", ",
1477 uname.release, uname.version);
1478 tprintf("machine=\"%s\"", uname.machine);
1481 tprintf(", domainname=\"%s\"", uname.domainname);
1482 #endif /* __GLIBC__ */
1487 tprintf("{sys=\"%s\", node=\"%s\", ...}",
1488 uname.sysname, uname.nodename);
1495 static struct xlat ptrace_cmds[] = {
1496 { PTRACE_TRACEME, "PTRACE_TRACEME" },
1497 { PTRACE_PEEKTEXT, "PTRACE_PEEKTEXT", },
1498 { PTRACE_PEEKDATA, "PTRACE_PEEKDATA", },
1499 { PTRACE_PEEKUSER, "PTRACE_PEEKUSER", },
1500 { PTRACE_POKETEXT, "PTRACE_POKETEXT", },
1501 { PTRACE_POKEDATA, "PTRACE_POKEDATA", },
1502 { PTRACE_POKEUSER, "PTRACE_POKEUSER", },
1503 { PTRACE_CONT, "PTRACE_CONT" },
1504 { PTRACE_KILL, "PTRACE_KILL" },
1505 { PTRACE_SINGLESTEP, "PTRACE_SINGLESTEP" },
1506 { PTRACE_ATTACH, "PTRACE_ATTACH" },
1507 { PTRACE_DETACH, "PTRACE_DETACH" },
1509 { PTRACE_GETREGS, "PTRACE_GETREGS" },
1510 { PTRACE_SETREGS, "PTRACE_SETREGS" },
1511 { PTRACE_GETFPREGS, "PTRACE_GETFPREGS", },
1512 { PTRACE_SETFPREGS, "PTRACE_SETFPREGS", },
1513 { PTRACE_READDATA, "PTRACE_READDATA" },
1514 { PTRACE_WRITEDATA, "PTRACE_WRITEDATA" },
1515 { PTRACE_READTEXT, "PTRACE_READTEXT" },
1516 { PTRACE_WRITETEXT, "PTRACE_WRITETEXT" },
1517 { PTRACE_GETFPAREGS, "PTRACE_GETFPAREGS" },
1518 { PTRACE_SETFPAREGS, "PTRACE_SETFPAREGS" },
1520 { PTRACE_GETWINDOW, "PTRACE_GETWINDOW" },
1521 { PTRACE_SETWINDOW, "PTRACE_SETWINDOW" },
1523 { PTRACE_22, "PTRACE_PTRACE_22" },
1524 { PTRACE_23, "PTRACE_PTRACE_23" },
1527 { PTRACE_SYSCALL, "PTRACE_SYSCALL" },
1529 { PTRACE_DUMPCORE, "PTRACE_DUMPCORE" },
1531 { PTRACE_SETWRBKPT, "PTRACE_SETWRBKPT" },
1532 { PTRACE_SETACBKPT, "PTRACE_SETACBKPT" },
1533 { PTRACE_CLRDR7, "PTRACE_CLRDR7" },
1535 { PTRACE_26, "PTRACE_26" },
1536 { PTRACE_27, "PTRACE_27" },
1537 { PTRACE_28, "PTRACE_28" },
1539 { PTRACE_GETUCODE, "PTRACE_GETUCODE" },
1544 #ifndef SUNOS4_KERNEL_ARCH_KLUDGE
1546 #endif /* !SUNOS4_KERNEL_ARCH_KLUDGE */
1547 struct xlat struct_user_offsets[] = {
1550 { PT_PSWMASK, "psw_mask" },
1551 { PT_PSWADDR, "psw_addr" },
1552 { PT_GPR0, "gpr0" },
1553 { PT_GPR1, "gpr1" },
1554 { PT_GPR2, "gpr2" },
1555 { PT_GPR3, "gpr3" },
1556 { PT_GPR4, "gpr4" },
1557 { PT_GPR5, "gpr5" },
1558 { PT_GPR6, "gpr6" },
1559 { PT_GPR7, "gpr7" },
1560 { PT_GPR8, "gpr8" },
1561 { PT_GPR9, "gpr9" },
1562 { PT_GPR10, "gpr10" },
1563 { PT_GPR11, "gpr11" },
1564 { PT_GPR12, "gpr12" },
1565 { PT_GPR13, "gpr13" },
1566 { PT_GPR14, "gpr14" },
1567 { PT_GPR15, "gpr15" },
1568 { PT_ACR0, "acr0" },
1569 { PT_ACR1, "acr1" },
1570 { PT_ACR2, "acr2" },
1571 { PT_ACR3, "acr3" },
1572 { PT_ACR4, "acr4" },
1573 { PT_ACR5, "acr5" },
1574 { PT_ACR6, "acr6" },
1575 { PT_ACR7, "acr7" },
1576 { PT_ACR8, "acr8" },
1577 { PT_ACR9, "acr9" },
1578 { PT_ACR10, "acr10" },
1579 { PT_ACR11, "acr11" },
1580 { PT_ACR12, "acr12" },
1581 { PT_ACR13, "acr13" },
1582 { PT_ACR14, "acr14" },
1583 { PT_ACR15, "acr15" },
1584 { PT_ORIGGPR2, "orig_gpr2" },
1586 { PT_FPR0_HI, "fpr0.hi" },
1587 { PT_FPR0_LO, "fpr0.lo" },
1588 { PT_FPR1_HI, "fpr1.hi" },
1589 { PT_FPR1_LO, "fpr1.lo" },
1590 { PT_FPR2_HI, "fpr2.hi" },
1591 { PT_FPR2_LO, "fpr2.lo" },
1592 { PT_FPR3_HI, "fpr3.hi" },
1593 { PT_FPR3_LO, "fpr3.lo" },
1594 { PT_FPR4_HI, "fpr4.hi" },
1595 { PT_FPR4_LO, "fpr4.lo" },
1596 { PT_FPR5_HI, "fpr5.hi" },
1597 { PT_FPR5_LO, "fpr5.lo" },
1598 { PT_FPR6_HI, "fpr6.hi" },
1599 { PT_FPR6_LO, "fpr6.lo" },
1600 { PT_FPR7_HI, "fpr7.hi" },
1601 { PT_FPR7_LO, "fpr7.lo" },
1602 { PT_FPR8_HI, "fpr8.hi" },
1603 { PT_FPR8_LO, "fpr8.lo" },
1604 { PT_FPR9_HI, "fpr9.hi" },
1605 { PT_FPR9_LO, "fpr9.lo" },
1606 { PT_FPR10_HI, "fpr10.hi" },
1607 { PT_FPR10_LO, "fpr10.lo" },
1608 { PT_FPR11_HI, "fpr11.hi" },
1609 { PT_FPR11_LO, "fpr11.lo" },
1610 { PT_FPR12_HI, "fpr12.hi" },
1611 { PT_FPR12_LO, "fpr12.lo" },
1612 { PT_FPR13_HI, "fpr13.hi" },
1613 { PT_FPR13_LO, "fpr13.lo" },
1614 { PT_FPR14_HI, "fpr14.hi" },
1615 { PT_FPR14_LO, "fpr14.lo" },
1616 { PT_FPR15_HI, "fpr15.hi" },
1617 { PT_FPR15_LO, "fpr15.lo" },
1619 { PT_CR_10, "cr10" },
1620 { PT_CR_11, "cr11" },
1623 /* XXX No support for these offsets yet. */
1624 #elif defined(POWERPC)
1625 { 4*PT_R0, "4*PT_R0" },
1626 { 4*PT_R1, "4*PT_R1" },
1627 { 4*PT_R2, "4*PT_R2" },
1628 { 4*PT_R3, "4*PT_R3" },
1629 { 4*PT_R4, "4*PT_R4" },
1630 { 4*PT_R5, "4*PT_R5" },
1631 { 4*PT_R6, "4*PT_R6" },
1632 { 4*PT_R7, "4*PT_R7" },
1633 { 4*PT_R8, "4*PT_R8" },
1634 { 4*PT_R9, "4*PT_R9" },
1635 { 4*PT_R10, "4*PT_R10" },
1636 { 4*PT_R11, "4*PT_R11" },
1637 { 4*PT_R12, "4*PT_R12" },
1638 { 4*PT_R13, "4*PT_R13" },
1639 { 4*PT_R14, "4*PT_R14" },
1640 { 4*PT_R15, "4*PT_R15" },
1641 { 4*PT_R16, "4*PT_R16" },
1642 { 4*PT_R17, "4*PT_R17" },
1643 { 4*PT_R18, "4*PT_R18" },
1644 { 4*PT_R19, "4*PT_R19" },
1645 { 4*PT_R20, "4*PT_R20" },
1646 { 4*PT_R21, "4*PT_R21" },
1647 { 4*PT_R22, "4*PT_R22" },
1648 { 4*PT_R23, "4*PT_R23" },
1649 { 4*PT_R24, "4*PT_R24" },
1650 { 4*PT_R25, "4*PT_R25" },
1651 { 4*PT_R26, "4*PT_R26" },
1652 { 4*PT_R27, "4*PT_R27" },
1653 { 4*PT_R28, "4*PT_R28" },
1654 { 4*PT_R29, "4*PT_R29" },
1655 { 4*PT_R30, "4*PT_R30" },
1656 { 4*PT_R31, "4*PT_R31" },
1657 { 4*PT_NIP, "4*PT_NIP" },
1658 { 4*PT_MSR, "4*PT_MSR" },
1659 { 4*PT_ORIG_R3, "4*PT_ORIG_R3" },
1660 { 4*PT_CTR, "4*PT_CTR" },
1661 { 4*PT_LNK, "4*PT_LNK" },
1662 { 4*PT_XER, "4*PT_XER" },
1663 { 4*PT_CCR, "4*PT_CCR" },
1664 { 4*PT_FPR0, "4*PT_FPR0" },
1734 { PT_F32, "f32" }, { PT_F33, "f33" }, { PT_F34, "f34" },
1735 { PT_F35, "f35" }, { PT_F36, "f36" }, { PT_F37, "f37" },
1736 { PT_F38, "f38" }, { PT_F39, "f39" }, { PT_F40, "f40" },
1737 { PT_F41, "f41" }, { PT_F42, "f42" }, { PT_F43, "f43" },
1738 { PT_F44, "f44" }, { PT_F45, "f45" }, { PT_F46, "f46" },
1739 { PT_F47, "f47" }, { PT_F48, "f48" }, { PT_F49, "f49" },
1740 { PT_F50, "f50" }, { PT_F51, "f51" }, { PT_F52, "f52" },
1741 { PT_F53, "f53" }, { PT_F54, "f54" }, { PT_F55, "f55" },
1742 { PT_F56, "f56" }, { PT_F57, "f57" }, { PT_F58, "f58" },
1743 { PT_F59, "f59" }, { PT_F60, "f60" }, { PT_F61, "f61" },
1744 { PT_F62, "f62" }, { PT_F63, "f63" }, { PT_F64, "f64" },
1745 { PT_F65, "f65" }, { PT_F66, "f66" }, { PT_F67, "f67" },
1746 { PT_F68, "f68" }, { PT_F69, "f69" }, { PT_F70, "f70" },
1747 { PT_F71, "f71" }, { PT_F72, "f72" }, { PT_F73, "f73" },
1748 { PT_F74, "f74" }, { PT_F75, "f75" }, { PT_F76, "f76" },
1749 { PT_F77, "f77" }, { PT_F78, "f78" }, { PT_F79, "f79" },
1750 { PT_F80, "f80" }, { PT_F81, "f81" }, { PT_F82, "f82" },
1751 { PT_F83, "f83" }, { PT_F84, "f84" }, { PT_F85, "f85" },
1752 { PT_F86, "f86" }, { PT_F87, "f87" }, { PT_F88, "f88" },
1753 { PT_F89, "f89" }, { PT_F90, "f90" }, { PT_F91, "f91" },
1754 { PT_F92, "f92" }, { PT_F93, "f93" }, { PT_F94, "f94" },
1755 { PT_F95, "f95" }, { PT_F96, "f96" }, { PT_F97, "f97" },
1756 { PT_F98, "f98" }, { PT_F99, "f99" }, { PT_F100, "f100" },
1757 { PT_F101, "f101" }, { PT_F102, "f102" }, { PT_F103, "f103" },
1758 { PT_F104, "f104" }, { PT_F105, "f105" }, { PT_F106, "f106" },
1759 { PT_F107, "f107" }, { PT_F108, "f108" }, { PT_F109, "f109" },
1760 { PT_F110, "f110" }, { PT_F111, "f111" }, { PT_F112, "f112" },
1761 { PT_F113, "f113" }, { PT_F114, "f114" }, { PT_F115, "f115" },
1762 { PT_F116, "f116" }, { PT_F117, "f117" }, { PT_F118, "f118" },
1763 { PT_F119, "f119" }, { PT_F120, "f120" }, { PT_F121, "f121" },
1764 { PT_F122, "f122" }, { PT_F123, "f123" }, { PT_F124, "f124" },
1765 { PT_F125, "f125" }, { PT_F126, "f126" }, { PT_F127, "f127" },
1767 { PT_F2, "f2" }, { PT_F3, "f3" }, { PT_F4, "f4" },
1768 { PT_F5, "f5" }, { PT_F10, "f10" }, { PT_F11, "f11" },
1769 { PT_F12, "f12" }, { PT_F13, "f13" }, { PT_F14, "f14" },
1770 { PT_F15, "f15" }, { PT_F16, "f16" }, { PT_F17, "f17" },
1771 { PT_F18, "f18" }, { PT_F19, "f19" }, { PT_F20, "f20" },
1772 { PT_F21, "f21" }, { PT_F22, "f22" }, { PT_F23, "f23" },
1773 { PT_F24, "f24" }, { PT_F25, "f25" }, { PT_F26, "f26" },
1774 { PT_F27, "f27" }, { PT_F28, "f28" }, { PT_F29, "f29" },
1775 { PT_F30, "f30" }, { PT_F31, "f31" }, { PT_R4, "r4" },
1776 { PT_R5, "r5" }, { PT_R6, "r6" }, { PT_R7, "r7" },
1778 { PT_B1, "b1" }, { PT_B2, "b2" }, { PT_B3, "b3" },
1779 { PT_B4, "b4" }, { PT_B5, "b5" },
1780 { PT_K_AR_PFS, "kar.pfs" },
1781 { PT_AR_LC, "ar.lc" }, { PT_K_AR_UNAT, "kar.unat" },
1782 { PT_K_AR_RNAT, "kar.rnat" }, { PT_K_AR_BSPSTORE, "kar.bspstore" },
1783 { PT_K_PR, "k.pr" },
1785 { PT_CR_IPSR, "cr.ipsr" }, { PT_CR_IIP, "cr.iip" },
1786 { PT_CR_IFS, "cr.ifs" }, { PT_AR_UNAT, "ar.unat" },
1787 { PT_AR_PFS, "ar.pfs" }, { PT_AR_RSC, "ar.rsc" },
1788 { PT_AR_RNAT, "ar.rnat" }, { PT_AR_BSPSTORE, "ar.bspstore" },
1789 { PT_PR, "pr" }, { PT_B6, "b6" }, { PT_AR_BSP, "ar.bsp" },
1790 { PT_R1, "r1" }, { PT_R2, "r2" }, { PT_R3, "r3" },
1791 { PT_R12, "r12" }, { PT_R13, "r13" }, { PT_R14, "r14" },
1792 { PT_R15, "r15" }, { PT_R8, "r8" }, { PT_R9, "r9" },
1793 { PT_R10, "r10" }, { PT_R11, "r11" }, { PT_R16, "r16" },
1794 { PT_R17, "r17" }, { PT_R18, "r18" }, { PT_R19, "r19" },
1795 { PT_R20, "r20" }, { PT_R21, "r21" }, { PT_R22, "r22" },
1796 { PT_R23, "r23" }, { PT_R24, "r24" }, { PT_R25, "r25" },
1797 { PT_R26, "r26" }, { PT_R27, "r27" }, { PT_R28, "r28" },
1798 { PT_R29, "r29" }, { PT_R30, "r30" }, { PT_R31, "r31" },
1799 { PT_AR_CCV, "ar.ccv" }, { PT_AR_FPSR, "ar.fpsr" },
1800 { PT_B0, "b0" }, { PT_B7, "b7" }, { PT_F6, "f6" },
1801 { PT_F7, "f7" }, { PT_F8, "f8" }, { PT_F9, "f9" },
1815 { 4*ORIG_EAX, "4*ORIG_EAX" },
1819 { 4*UESP, "4*UESP" },
1823 { 4*PT_D1, "4*PT_D1" },
1824 { 4*PT_D2, "4*PT_D2" },
1825 { 4*PT_D3, "4*PT_D3" },
1826 { 4*PT_D4, "4*PT_D4" },
1827 { 4*PT_D5, "4*PT_D5" },
1828 { 4*PT_D6, "4*PT_D6" },
1829 { 4*PT_D7, "4*PT_D7" },
1830 { 4*PT_A0, "4*PT_A0" },
1831 { 4*PT_A1, "4*PT_A1" },
1832 { 4*PT_A2, "4*PT_A2" },
1833 { 4*PT_A3, "4*PT_A3" },
1834 { 4*PT_A4, "4*PT_A4" },
1835 { 4*PT_A5, "4*PT_A5" },
1836 { 4*PT_A6, "4*PT_A6" },
1837 { 4*PT_D0, "4*PT_D0" },
1838 { 4*PT_USP, "4*PT_USP" },
1839 { 4*PT_ORIG_D0, "4*PT_ORIG_D0" },
1840 { 4*PT_SR, "4*PT_SR" },
1841 { 4*PT_PC, "4*PT_PC" },
1845 { uoff(u_fpvalid), "offsetof(struct user, u_fpvalid)" },
1848 { uoff(u_fpvalid), "offsetof(struct user, u_fpvalid)" },
1851 { uoff(i387), "offsetof(struct user, i387)" },
1854 { uoff(m68kfp), "offsetof(struct user, m68kfp)" },
1857 { uoff(u_tsize), "offsetof(struct user, u_tsize)" },
1858 { uoff(u_dsize), "offsetof(struct user, u_dsize)" },
1859 { uoff(u_ssize), "offsetof(struct user, u_ssize)" },
1860 { uoff(start_code), "offsetof(struct user, start_code)" },
1861 { uoff(start_stack), "offsetof(struct user, start_stack)" },
1862 { uoff(signal), "offsetof(struct user, signal)" },
1864 { uoff(reserved), "offsetof(struct user, reserved)" },
1866 { uoff(u_ar0), "offsetof(struct user, u_ar0)" },
1867 #if !defined(ARM) && !defined(MIPS) && !defined(S390)
1868 { uoff(u_fpstate), "offsetof(struct user, u_fpstate)" },
1870 { uoff(magic), "offsetof(struct user, magic)" },
1871 { uoff(u_comm), "offsetof(struct user, u_comm)" },
1873 { uoff(u_debugreg), "offsetof(struct user, u_debugreg)" },
1877 #endif /* !POWERPC/!SPARC */
1880 { uoff(u_pcb), "offsetof(struct user, u_pcb)" },
1881 { uoff(u_procp), "offsetof(struct user, u_procp)" },
1882 { uoff(u_ar0), "offsetof(struct user, u_ar0)" },
1883 { uoff(u_comm[0]), "offsetof(struct user, u_comm[0])" },
1884 { uoff(u_arg[0]), "offsetof(struct user, u_arg[0])" },
1885 { uoff(u_ap), "offsetof(struct user, u_ap)" },
1886 { uoff(u_qsave), "offsetof(struct user, u_qsave)" },
1887 { uoff(u_rval1), "offsetof(struct user, u_rval1)" },
1888 { uoff(u_rval2), "offsetof(struct user, u_rval2)" },
1889 { uoff(u_error), "offsetof(struct user, u_error)" },
1890 { uoff(u_eosys), "offsetof(struct user, u_eosys)" },
1891 { uoff(u_ssave), "offsetof(struct user, u_ssave)" },
1892 { uoff(u_signal[0]), "offsetof(struct user, u_signal)" },
1893 { uoff(u_sigmask[0]), "offsetof(struct user, u_sigmask)" },
1894 { uoff(u_sigonstack), "offsetof(struct user, u_sigonstack)" },
1895 { uoff(u_sigintr), "offsetof(struct user, u_sigintr)" },
1896 { uoff(u_sigreset), "offsetof(struct user, u_sigreset)" },
1897 { uoff(u_oldmask), "offsetof(struct user, u_oldmask)" },
1898 { uoff(u_code), "offsetof(struct user, u_code)" },
1899 { uoff(u_addr), "offsetof(struct user, u_addr)" },
1900 { uoff(u_sigstack), "offsetof(struct user, u_sigstack)" },
1901 { uoff(u_ofile), "offsetof(struct user, u_ofile)" },
1902 { uoff(u_pofile), "offsetof(struct user, u_pofile)" },
1903 { uoff(u_ofile_arr[0]), "offsetof(struct user, u_ofile_arr[0])" },
1904 { uoff(u_pofile_arr[0]),"offsetof(struct user, u_pofile_arr[0])"},
1905 { uoff(u_lastfile), "offsetof(struct user, u_lastfile)" },
1906 { uoff(u_cwd), "offsetof(struct user, u_cwd)" },
1907 { uoff(u_cdir), "offsetof(struct user, u_cdir)" },
1908 { uoff(u_rdir), "offsetof(struct user, u_rdir)" },
1909 { uoff(u_cmask), "offsetof(struct user, u_cmask)" },
1910 { uoff(u_ru), "offsetof(struct user, u_ru)" },
1911 { uoff(u_cru), "offsetof(struct user, u_cru)" },
1912 { uoff(u_timer[0]), "offsetof(struct user, u_timer[0])" },
1913 { uoff(u_XXX[0]), "offsetof(struct user, u_XXX[0])" },
1914 { uoff(u_ioch), "offsetof(struct user, u_ioch)" },
1915 { uoff(u_start), "offsetof(struct user, u_start)" },
1916 { uoff(u_acflag), "offsetof(struct user, u_acflag)" },
1917 { uoff(u_prof.pr_base), "offsetof(struct user, u_prof.pr_base)" },
1918 { uoff(u_prof.pr_size), "offsetof(struct user, u_prof.pr_size)" },
1919 { uoff(u_prof.pr_off), "offsetof(struct user, u_prof.pr_off)" },
1920 { uoff(u_prof.pr_scale),"offsetof(struct user, u_prof.pr_scale)"},
1921 { uoff(u_rlimit[0]), "offsetof(struct user, u_rlimit)" },
1922 { uoff(u_exdata.Ux_A), "offsetof(struct user, u_exdata.Ux_A)" },
1923 { uoff(u_exdata.ux_shell[0]),"offsetof(struct user, u_exdata.ux_shell[0])"},
1924 { uoff(u_lofault), "offsetof(struct user, u_lofault)" },
1926 { sizeof(struct user), "sizeof(struct user)" },
1938 cmd = xlookup(ptrace_cmds, tcp->u_arg[0]);
1941 if (entering(tcp)) {
1942 tprintf("%s, %lu, ", cmd, tcp->u_arg[1]);
1943 addr = tcp->u_arg[2];
1944 if (tcp->u_arg[0] == PTRACE_PEEKUSER
1945 || tcp->u_arg[0] == PTRACE_POKEUSER) {
1946 for (x = struct_user_offsets; x->str; x++) {
1951 tprintf("%#lx, ", addr);
1952 else if (x->val > addr && x != struct_user_offsets) {
1954 tprintf("%s + %ld, ", x->str, addr - x->val);
1957 tprintf("%s, ", x->str);
1960 tprintf("%#lx, ", tcp->u_arg[2]);
1962 switch (tcp->u_arg[0]) {
1963 case PTRACE_PEEKDATA:
1964 case PTRACE_PEEKTEXT:
1965 case PTRACE_PEEKUSER:
1968 case PTRACE_SINGLESTEP:
1969 case PTRACE_SYSCALL:
1971 printsignal(tcp->u_arg[3]);
1974 tprintf("%#lx", tcp->u_arg[3]);
1978 switch (tcp->u_arg[0]) {
1979 case PTRACE_PEEKDATA:
1980 case PTRACE_PEEKTEXT:
1981 case PTRACE_PEEKUSER:
1982 printnum(tcp, tcp->u_arg[3], "%#x");
1988 if (tcp->u_arg[0] == PTRACE_WRITEDATA ||
1989 tcp->u_arg[0] == PTRACE_WRITETEXT) {
1990 tprintf("%lu, ", tcp->u_arg[3]);
1991 printstr(tcp, tcp->u_arg[4], tcp->u_arg[3]);
1992 } else if (tcp->u_arg[0] != PTRACE_READDATA &&
1993 tcp->u_arg[0] != PTRACE_READTEXT) {
1994 tprintf("%#lx", tcp->u_arg[3]);
1997 if (tcp->u_arg[0] == PTRACE_READDATA ||
1998 tcp->u_arg[0] == PTRACE_READTEXT) {
1999 tprintf("%lu, ", tcp->u_arg[3]);
2000 printstr(tcp, tcp->u_arg[4], tcp->u_arg[3]);