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"
49 #include "xlat/ptrace_peeksiginfo_flags.h"
51 #define uoff(member) offsetof(struct user, member)
52 #define XLAT_UOFF(member) { uoff(member), "offsetof(struct user, " #member ")" }
54 static const struct xlat struct_user_offsets[] = {
60 print_user_offset_addr(const kernel_ulong_t addr)
64 for (x = struct_user_offsets; x->str; ++x) {
71 } else if (x->val > addr) {
72 if (x == struct_user_offsets) {
76 tprintf("%s + %" PRI_kru,
77 x->str, addr - (kernel_ulong_t) x->val);
86 const kernel_ulong_t request = tcp->u_arg[0];
87 const int pid = tcp->u_arg[1];
88 const kernel_ulong_t addr = tcp->u_arg[2];
89 const kernel_ulong_t data = tcp->u_arg[3];
93 printxval64(ptrace_cmds, request, "PTRACE_???");
95 if (request == PTRACE_TRACEME) {
96 /* pid, addr, and data are ignored. */
101 tprintf(", %d", pid);
106 case PTRACE_INTERRUPT:
109 /* addr and data are ignored */
111 case PTRACE_PEEKUSER:
112 case PTRACE_POKEUSER:
114 print_user_offset_addr(addr);
116 case PTRACE_GETREGSET:
117 case PTRACE_SETREGSET:
119 printxval(nt_descriptor_types, addr, "NT_???");
121 case PTRACE_GETSIGMASK:
122 case PTRACE_SETSIGMASK:
123 case PTRACE_SECCOMP_GET_FILTER:
124 tprintf(", %" PRI_kru, addr);
126 case PTRACE_PEEKSIGINFO: {
133 if (umove_or_printaddr(tcp, addr, &psi)) {
138 tprintf("{off=%" PRIu64 ", flags=", psi.off);
139 printflags(ptrace_peeksiginfo_flags, psi.flags,
140 "PTRACE_PEEKSIGINFO_???");
141 tprintf(", nr=%u}", psi.nr);
149 # if defined IA64 || defined SPARC || defined SPARC64
152 case PTRACE_PEEKDATA:
153 case PTRACE_PEEKTEXT:
154 case PTRACE_PEEKUSER:
155 /* data is ignored */
156 return RVAL_DECODED | RVAL_HEX;
158 # if defined SPARC || defined SPARC64
161 case PTRACE_GETFPREGS:
162 case PTRACE_SETFPREGS:
163 /* data is ignored */
165 # endif /* SPARC || SPARC64 */
167 # endif /* IA64 || SPARC || SPARC64 */
176 #ifdef PTRACE_SINGLESTEP
177 case PTRACE_SINGLESTEP:
179 #ifdef PTRACE_SINGLEBLOCK
180 case PTRACE_SINGLEBLOCK:
185 #ifdef PTRACE_SYSEMU_SINGLESTEP
186 case PTRACE_SYSEMU_SINGLESTEP:
191 case PTRACE_SETOPTIONS:
192 #ifdef PTRACE_OLDSETOPTIONS
193 case PTRACE_OLDSETOPTIONS:
195 printflags64(ptrace_setoptions_flags, data, "PTRACE_O_???");
197 case PTRACE_SETSIGINFO:
198 printsiginfo_at(tcp, data);
200 case PTRACE_SETSIGMASK:
201 print_sigset_addr_len(tcp, data, addr);
203 case PTRACE_SETREGSET:
204 tprint_iov(tcp, /*len:*/ 1, data, IOV_DECODE_ADDR);
207 case PTRACE_PEEKDATA:
208 case PTRACE_PEEKTEXT:
209 case PTRACE_PEEKUSER:
211 case PTRACE_GETEVENTMSG:
212 case PTRACE_GETREGSET:
213 case PTRACE_GETSIGINFO:
214 case PTRACE_GETSIGMASK:
215 case PTRACE_PEEKSIGINFO:
216 case PTRACE_SECCOMP_GET_FILTER:
218 /* print data on exiting syscall */
231 case PTRACE_PEEKDATA:
232 case PTRACE_PEEKTEXT:
233 case PTRACE_PEEKUSER:
234 printnum_ptr(tcp, data);
237 case PTRACE_GETEVENTMSG:
238 printnum_ulong(tcp, data);
240 case PTRACE_GETREGSET:
241 tprint_iov(tcp, /*len:*/ 1, data, IOV_DECODE_ADDR);
243 case PTRACE_GETSIGINFO:
244 printsiginfo_at(tcp, data);
246 case PTRACE_GETSIGMASK:
247 print_sigset_addr_len(tcp, data, addr);
249 case PTRACE_PEEKSIGINFO:
250 print_siginfo_array(tcp, data, tcp->u_rval);
252 case PTRACE_SECCOMP_GET_FILTER:
253 print_seccomp_fprog(tcp, data, tcp->u_rval);