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 print_user_offset_addr(const unsigned long addr)
63 for (x = struct_user_offsets; x->str; ++x) {
70 } else if (x->val > addr) {
71 if (x == struct_user_offsets) {
76 x->str, addr - (unsigned long) x->val);
85 const unsigned long request = tcp->u_arg[0];
86 const int pid = tcp->u_arg[1];
87 const unsigned long addr = tcp->u_arg[2];
88 const unsigned long data = tcp->u_arg[3];
92 printxval64(ptrace_cmds, request, "PTRACE_???");
94 if (request == PTRACE_TRACEME) {
95 /* pid, addr, and data are ignored. */
100 tprintf(", %d", pid);
105 case PTRACE_INTERRUPT:
108 /* addr and data are ignored */
110 case PTRACE_PEEKUSER:
111 case PTRACE_POKEUSER:
113 print_user_offset_addr(addr);
115 case PTRACE_GETREGSET:
116 case PTRACE_SETREGSET:
118 printxval(nt_descriptor_types, addr, "NT_???");
120 #if defined SPARC || defined SPARC64
123 case PTRACE_GETFPREGS:
124 case PTRACE_SETFPREGS:
127 /* data is ignored */
140 case PTRACE_PEEKDATA:
141 case PTRACE_PEEKTEXT:
142 case PTRACE_PEEKUSER:
146 case PTRACE_SINGLESTEP:
151 case PTRACE_SETOPTIONS:
152 printflags(ptrace_setoptions_flags, data, "PTRACE_O_???");
154 case PTRACE_SETSIGINFO:
155 printsiginfo_at(tcp, data);
157 case PTRACE_SETREGSET:
158 tprint_iov(tcp, /*len:*/ 1, data, /*as string:*/ 0);
160 case PTRACE_GETSIGINFO:
161 case PTRACE_GETREGSET:
162 /* Don't print anything, do it at syscall return. */
170 case PTRACE_PEEKDATA:
171 case PTRACE_PEEKTEXT:
172 case PTRACE_PEEKUSER:
176 printnum_ptr(tcp, data);
179 case PTRACE_GETSIGINFO:
180 printsiginfo_at(tcp, data);
182 case PTRACE_GETREGSET:
183 tprint_iov(tcp, /*len:*/ 1, data, /*as string:*/ 0);