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>
9 * Copyright (c) 2000 PocketPenguins Inc. Linux for Hitachi SuperH
10 * port by Greg Banks <gbanks@pocketpenguins.com>
12 * All rights reserved.
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 * 3. The name of the author may not be used to endorse or promote products
23 * derived from this software without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
26 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
29 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 #include "xlat/nt_descriptor_types.h"
47 #include "xlat/ptrace_cmds.h"
48 #include "xlat/ptrace_setoptions_flags.h"
50 #define uoff(member) offsetof(struct user, member)
51 #define XLAT_UOFF(member) { uoff(member), "offsetof(struct user, " #member ")" }
53 static const struct xlat struct_user_offsets[] = {
59 sys_ptrace(struct tcb *tcp)
65 printxval(ptrace_cmds, tcp->u_arg[0], "PTRACE_???");
66 tprintf(", %lu, ", tcp->u_arg[1]);
69 if (tcp->u_arg[0] == PTRACE_PEEKUSER
70 || tcp->u_arg[0] == PTRACE_POKEUSER
72 for (x = struct_user_offsets; x->str; x++) {
77 tprintf("%#lx, ", addr);
78 else if (x->val > addr && x != struct_user_offsets) {
80 tprintf("%s + %ld, ", x->str, addr - x->val);
83 tprintf("%s, ", x->str);
85 if (tcp->u_arg[0] == PTRACE_GETREGSET
86 || tcp->u_arg[0] == PTRACE_SETREGSET
88 printxval(nt_descriptor_types, tcp->u_arg[2], "NT_???");
91 tprintf("%#lx, ", addr);
94 switch (tcp->u_arg[0]) {
102 case PTRACE_SINGLESTEP:
105 printsignal(tcp->u_arg[3]);
107 case PTRACE_SETOPTIONS:
108 printflags(ptrace_setoptions_flags, tcp->u_arg[3], "PTRACE_O_???");
110 case PTRACE_SETSIGINFO: {
111 printsiginfo_at(tcp, tcp->u_arg[3]);
114 case PTRACE_SETREGSET:
115 tprint_iov(tcp, /*len:*/ 1, tcp->u_arg[3], /*as string:*/ 0);
117 case PTRACE_GETSIGINFO:
118 case PTRACE_GETREGSET:
119 /* Don't print anything, do it at syscall return. */
122 tprintf("%#lx", tcp->u_arg[3]);
126 switch (tcp->u_arg[0]) {
127 case PTRACE_PEEKDATA:
128 case PTRACE_PEEKTEXT:
129 case PTRACE_PEEKUSER:
133 printnum_long(tcp, tcp->u_arg[3], "%#lx");
136 case PTRACE_GETSIGINFO: {
137 printsiginfo_at(tcp, tcp->u_arg[3]);
140 case PTRACE_GETREGSET:
141 tprint_iov(tcp, /*len:*/ 1, tcp->u_arg[3], /*as string:*/ 0);