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[] = {
64 printxval(ptrace_cmds, tcp->u_arg[0], "PTRACE_???");
65 tprintf(", %lu, ", tcp->u_arg[1]);
68 if (tcp->u_arg[0] == PTRACE_PEEKUSER
69 || tcp->u_arg[0] == PTRACE_POKEUSER
71 for (x = struct_user_offsets; x->str; x++) {
76 tprintf("%#lx, ", addr);
77 else if (x->val > addr && x != struct_user_offsets) {
79 tprintf("%s + %ld, ", x->str, addr - x->val);
82 tprintf("%s, ", x->str);
84 if (tcp->u_arg[0] == PTRACE_GETREGSET
85 || tcp->u_arg[0] == PTRACE_SETREGSET
87 printxval(nt_descriptor_types, tcp->u_arg[2], "NT_???");
90 tprintf("%#lx, ", addr);
93 switch (tcp->u_arg[0]) {
101 case PTRACE_SINGLESTEP:
104 printsignal(tcp->u_arg[3]);
106 case PTRACE_SETOPTIONS:
107 printflags(ptrace_setoptions_flags, tcp->u_arg[3], "PTRACE_O_???");
109 case PTRACE_SETSIGINFO: {
110 printsiginfo_at(tcp, tcp->u_arg[3]);
113 case PTRACE_SETREGSET:
114 tprint_iov(tcp, /*len:*/ 1, tcp->u_arg[3], /*as string:*/ 0);
116 case PTRACE_GETSIGINFO:
117 case PTRACE_GETREGSET:
118 /* Don't print anything, do it at syscall return. */
121 tprintf("%#lx", tcp->u_arg[3]);
125 switch (tcp->u_arg[0]) {
126 case PTRACE_PEEKDATA:
127 case PTRACE_PEEKTEXT:
128 case PTRACE_PEEKUSER:
132 printnum_long(tcp, tcp->u_arg[3], "%#lx");
135 case PTRACE_GETSIGINFO: {
136 printsiginfo_at(tcp, tcp->u_arg[3]);
139 case PTRACE_GETREGSET:
140 tprint_iov(tcp, /*len:*/ 1, tcp->u_arg[3], /*as string:*/ 0);