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.
49 #ifdef HAVE_LINUX_PTRACE_H
50 # undef PTRACE_SYSCALL
51 # ifdef HAVE_STRUCT_IA64_FPREG
52 # define ia64_fpreg XXX_ia64_fpreg
54 # ifdef HAVE_STRUCT_PT_ALL_USER_REGS
55 # define pt_all_user_regs XXX_pt_all_user_regs
57 # ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
58 # define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
60 # include <linux/ptrace.h>
61 # undef ptrace_peeksiginfo_args
63 # undef pt_all_user_regs
68 # undef PTRACE_GETREGS
69 # define PTRACE_GETREGS PTRACE_GETREGS64
70 # undef PTRACE_SETREGS
71 # define PTRACE_SETREGS PTRACE_SETREGS64
75 # include <asm/ptrace_offsets.h>
80 sys_sethostname(struct tcb *tcp)
83 printstr(tcp, tcp->u_arg[0], tcp->u_arg[1]);
84 tprintf(", %lu", tcp->u_arg[1]);
91 sys_gethostname(struct tcb *tcp)
95 tprintf("%#lx", tcp->u_arg[0]);
97 printstr(tcp, tcp->u_arg[0], -1);
98 tprintf(", %lu", tcp->u_arg[1]);
105 sys_exit(struct tcb *tcp)
108 fprintf(stderr, "_exit returned!\n");
111 /* special case: we stop tracing this process, finish line now */
112 tprintf("%ld) ", tcp->u_arg[0]);
119 #include "xlat/ptrace_cmds.h"
120 #include "xlat/ptrace_setoptions_flags.h"
121 #include "xlat/nt_descriptor_types.h"
123 #define uoff(member) offsetof(struct user, member)
125 const struct xlat struct_user_offsets[] = {
126 #if defined(S390) || defined(S390X)
127 { PT_PSWMASK, "psw_mask" },
128 { PT_PSWADDR, "psw_addr" },
139 { PT_GPR10, "gpr10" },
140 { PT_GPR11, "gpr11" },
141 { PT_GPR12, "gpr12" },
142 { PT_GPR13, "gpr13" },
143 { PT_GPR14, "gpr14" },
144 { PT_GPR15, "gpr15" },
155 { PT_ACR10, "acr10" },
156 { PT_ACR11, "acr11" },
157 { PT_ACR12, "acr12" },
158 { PT_ACR13, "acr13" },
159 { PT_ACR14, "acr14" },
160 { PT_ACR15, "acr15" },
161 { PT_ORIGGPR2, "orig_gpr2" },
164 { PT_FPR0_HI, "fpr0.hi" },
165 { PT_FPR0_LO, "fpr0.lo" },
166 { PT_FPR1_HI, "fpr1.hi" },
167 { PT_FPR1_LO, "fpr1.lo" },
168 { PT_FPR2_HI, "fpr2.hi" },
169 { PT_FPR2_LO, "fpr2.lo" },
170 { PT_FPR3_HI, "fpr3.hi" },
171 { PT_FPR3_LO, "fpr3.lo" },
172 { PT_FPR4_HI, "fpr4.hi" },
173 { PT_FPR4_LO, "fpr4.lo" },
174 { PT_FPR5_HI, "fpr5.hi" },
175 { PT_FPR5_LO, "fpr5.lo" },
176 { PT_FPR6_HI, "fpr6.hi" },
177 { PT_FPR6_LO, "fpr6.lo" },
178 { PT_FPR7_HI, "fpr7.hi" },
179 { PT_FPR7_LO, "fpr7.lo" },
180 { PT_FPR8_HI, "fpr8.hi" },
181 { PT_FPR8_LO, "fpr8.lo" },
182 { PT_FPR9_HI, "fpr9.hi" },
183 { PT_FPR9_LO, "fpr9.lo" },
184 { PT_FPR10_HI, "fpr10.hi" },
185 { PT_FPR10_LO, "fpr10.lo" },
186 { PT_FPR11_HI, "fpr11.hi" },
187 { PT_FPR11_LO, "fpr11.lo" },
188 { PT_FPR12_HI, "fpr12.hi" },
189 { PT_FPR12_LO, "fpr12.lo" },
190 { PT_FPR13_HI, "fpr13.hi" },
191 { PT_FPR13_LO, "fpr13.lo" },
192 { PT_FPR14_HI, "fpr14.hi" },
193 { PT_FPR14_LO, "fpr14.lo" },
194 { PT_FPR15_HI, "fpr15.hi" },
195 { PT_FPR15_LO, "fpr15.lo" },
208 { PT_FPR10, "fpr10" },
209 { PT_FPR11, "fpr11" },
210 { PT_FPR12, "fpr12" },
211 { PT_FPR13, "fpr13" },
212 { PT_FPR14, "fpr14" },
213 { PT_FPR15, "fpr15" },
216 { PT_CR_10, "cr10" },
217 { PT_CR_11, "cr11" },
218 { PT_IEEE_IP, "ieee_exception_ip" },
220 /* XXX No support for these offsets yet. */
222 /* XXX No support for these offsets yet. */
223 #elif defined(POWERPC)
225 # define PT_ORIG_R3 34
227 # define REGSIZE (sizeof(unsigned long))
228 { REGSIZE*PT_R0, "r0" },
229 { REGSIZE*PT_R1, "r1" },
230 { REGSIZE*PT_R2, "r2" },
231 { REGSIZE*PT_R3, "r3" },
232 { REGSIZE*PT_R4, "r4" },
233 { REGSIZE*PT_R5, "r5" },
234 { REGSIZE*PT_R6, "r6" },
235 { REGSIZE*PT_R7, "r7" },
236 { REGSIZE*PT_R8, "r8" },
237 { REGSIZE*PT_R9, "r9" },
238 { REGSIZE*PT_R10, "r10" },
239 { REGSIZE*PT_R11, "r11" },
240 { REGSIZE*PT_R12, "r12" },
241 { REGSIZE*PT_R13, "r13" },
242 { REGSIZE*PT_R14, "r14" },
243 { REGSIZE*PT_R15, "r15" },
244 { REGSIZE*PT_R16, "r16" },
245 { REGSIZE*PT_R17, "r17" },
246 { REGSIZE*PT_R18, "r18" },
247 { REGSIZE*PT_R19, "r19" },
248 { REGSIZE*PT_R20, "r20" },
249 { REGSIZE*PT_R21, "r21" },
250 { REGSIZE*PT_R22, "r22" },
251 { REGSIZE*PT_R23, "r23" },
252 { REGSIZE*PT_R24, "r24" },
253 { REGSIZE*PT_R25, "r25" },
254 { REGSIZE*PT_R26, "r26" },
255 { REGSIZE*PT_R27, "r27" },
256 { REGSIZE*PT_R28, "r28" },
257 { REGSIZE*PT_R29, "r29" },
258 { REGSIZE*PT_R30, "r30" },
259 { REGSIZE*PT_R31, "r31" },
260 { REGSIZE*PT_NIP, "NIP" },
261 { REGSIZE*PT_MSR, "MSR" },
262 { REGSIZE*PT_ORIG_R3, "ORIG_R3" },
263 { REGSIZE*PT_CTR, "CTR" },
264 { REGSIZE*PT_LNK, "LNK" },
265 { REGSIZE*PT_XER, "XER" },
266 { REGSIZE*PT_CCR, "CCR" },
267 { REGSIZE*PT_FPR0, "FPR0" },
336 { PT_F32, "f32" }, { PT_F33, "f33" }, { PT_F34, "f34" },
337 { PT_F35, "f35" }, { PT_F36, "f36" }, { PT_F37, "f37" },
338 { PT_F38, "f38" }, { PT_F39, "f39" }, { PT_F40, "f40" },
339 { PT_F41, "f41" }, { PT_F42, "f42" }, { PT_F43, "f43" },
340 { PT_F44, "f44" }, { PT_F45, "f45" }, { PT_F46, "f46" },
341 { PT_F47, "f47" }, { PT_F48, "f48" }, { PT_F49, "f49" },
342 { PT_F50, "f50" }, { PT_F51, "f51" }, { PT_F52, "f52" },
343 { PT_F53, "f53" }, { PT_F54, "f54" }, { PT_F55, "f55" },
344 { PT_F56, "f56" }, { PT_F57, "f57" }, { PT_F58, "f58" },
345 { PT_F59, "f59" }, { PT_F60, "f60" }, { PT_F61, "f61" },
346 { PT_F62, "f62" }, { PT_F63, "f63" }, { PT_F64, "f64" },
347 { PT_F65, "f65" }, { PT_F66, "f66" }, { PT_F67, "f67" },
348 { PT_F68, "f68" }, { PT_F69, "f69" }, { PT_F70, "f70" },
349 { PT_F71, "f71" }, { PT_F72, "f72" }, { PT_F73, "f73" },
350 { PT_F74, "f74" }, { PT_F75, "f75" }, { PT_F76, "f76" },
351 { PT_F77, "f77" }, { PT_F78, "f78" }, { PT_F79, "f79" },
352 { PT_F80, "f80" }, { PT_F81, "f81" }, { PT_F82, "f82" },
353 { PT_F83, "f83" }, { PT_F84, "f84" }, { PT_F85, "f85" },
354 { PT_F86, "f86" }, { PT_F87, "f87" }, { PT_F88, "f88" },
355 { PT_F89, "f89" }, { PT_F90, "f90" }, { PT_F91, "f91" },
356 { PT_F92, "f92" }, { PT_F93, "f93" }, { PT_F94, "f94" },
357 { PT_F95, "f95" }, { PT_F96, "f96" }, { PT_F97, "f97" },
358 { PT_F98, "f98" }, { PT_F99, "f99" }, { PT_F100, "f100" },
359 { PT_F101, "f101" }, { PT_F102, "f102" }, { PT_F103, "f103" },
360 { PT_F104, "f104" }, { PT_F105, "f105" }, { PT_F106, "f106" },
361 { PT_F107, "f107" }, { PT_F108, "f108" }, { PT_F109, "f109" },
362 { PT_F110, "f110" }, { PT_F111, "f111" }, { PT_F112, "f112" },
363 { PT_F113, "f113" }, { PT_F114, "f114" }, { PT_F115, "f115" },
364 { PT_F116, "f116" }, { PT_F117, "f117" }, { PT_F118, "f118" },
365 { PT_F119, "f119" }, { PT_F120, "f120" }, { PT_F121, "f121" },
366 { PT_F122, "f122" }, { PT_F123, "f123" }, { PT_F124, "f124" },
367 { PT_F125, "f125" }, { PT_F126, "f126" }, { PT_F127, "f127" },
369 { PT_F2, "f2" }, { PT_F3, "f3" }, { PT_F4, "f4" },
370 { PT_F5, "f5" }, { PT_F10, "f10" }, { PT_F11, "f11" },
371 { PT_F12, "f12" }, { PT_F13, "f13" }, { PT_F14, "f14" },
372 { PT_F15, "f15" }, { PT_F16, "f16" }, { PT_F17, "f17" },
373 { PT_F18, "f18" }, { PT_F19, "f19" }, { PT_F20, "f20" },
374 { PT_F21, "f21" }, { PT_F22, "f22" }, { PT_F23, "f23" },
375 { PT_F24, "f24" }, { PT_F25, "f25" }, { PT_F26, "f26" },
376 { PT_F27, "f27" }, { PT_F28, "f28" }, { PT_F29, "f29" },
377 { PT_F30, "f30" }, { PT_F31, "f31" }, { PT_R4, "r4" },
378 { PT_R5, "r5" }, { PT_R6, "r6" }, { PT_R7, "r7" },
379 { PT_B1, "b1" }, { PT_B2, "b2" }, { PT_B3, "b3" },
380 { PT_B4, "b4" }, { PT_B5, "b5" },
381 { PT_AR_EC, "ar.ec" }, { PT_AR_LC, "ar.lc" },
383 { PT_CR_IPSR, "psr" }, { PT_CR_IIP, "ip" },
384 { PT_CFM, "cfm" }, { PT_AR_UNAT, "ar.unat" },
385 { PT_AR_PFS, "ar.pfs" }, { PT_AR_RSC, "ar.rsc" },
386 { PT_AR_RNAT, "ar.rnat" }, { PT_AR_BSPSTORE, "ar.bspstore" },
387 { PT_PR, "pr" }, { PT_B6, "b6" }, { PT_AR_BSP, "ar.bsp" },
388 { PT_R1, "r1" }, { PT_R2, "r2" }, { PT_R3, "r3" },
389 { PT_R12, "r12" }, { PT_R13, "r13" }, { PT_R14, "r14" },
390 { PT_R15, "r15" }, { PT_R8, "r8" }, { PT_R9, "r9" },
391 { PT_R10, "r10" }, { PT_R11, "r11" }, { PT_R16, "r16" },
392 { PT_R17, "r17" }, { PT_R18, "r18" }, { PT_R19, "r19" },
393 { PT_R20, "r20" }, { PT_R21, "r21" }, { PT_R22, "r22" },
394 { PT_R23, "r23" }, { PT_R24, "r24" }, { PT_R25, "r25" },
395 { PT_R26, "r26" }, { PT_R27, "r27" }, { PT_R28, "r28" },
396 { PT_R29, "r29" }, { PT_R30, "r30" }, { PT_R31, "r31" },
397 { PT_AR_CCV, "ar.ccv" }, { PT_AR_FPSR, "ar.fpsr" },
398 { PT_B0, "b0" }, { PT_B7, "b7" }, { PT_F6, "f6" },
399 { PT_F7, "f7" }, { PT_F8, "f8" }, { PT_F9, "f9" },
401 { PT_AR_CSD, "ar.csd" },
404 { PT_AR_SSD, "ar.ssd" },
406 { PT_DBR, "dbr" }, { PT_IBR, "ibr" }, { PT_PMD, "pmd" },
425 #elif defined(X86_64) || defined(X32)
444 { 8*EFLAGS, "8*EFL" },
469 { 4*(REG_REG0+1), "4*REG_REG1" },
470 { 4*(REG_REG0+2), "4*REG_REG2" },
471 { 4*(REG_REG0+3), "4*REG_REG3" },
472 { 4*(REG_REG0+4), "4*REG_REG4" },
473 { 4*(REG_REG0+5), "4*REG_REG5" },
474 { 4*(REG_REG0+6), "4*REG_REG6" },
475 { 4*(REG_REG0+7), "4*REG_REG7" },
476 { 4*(REG_REG0+8), "4*REG_REG8" },
477 { 4*(REG_REG0+9), "4*REG_REG9" },
478 { 4*(REG_REG0+10), "4*REG_REG10" },
479 { 4*(REG_REG0+11), "4*REG_REG11" },
480 { 4*(REG_REG0+12), "4*REG_REG12" },
481 { 4*(REG_REG0+13), "4*REG_REG13" },
482 { 4*(REG_REG0+14), "4*REG_REG14" },
493 { 4*(REG_FPREG0+1), "4*REG_FPREG1" },
494 { 4*(REG_FPREG0+2), "4*REG_FPREG2" },
495 { 4*(REG_FPREG0+3), "4*REG_FPREG3" },
496 { 4*(REG_FPREG0+4), "4*REG_FPREG4" },
497 { 4*(REG_FPREG0+5), "4*REG_FPREG5" },
498 { 4*(REG_FPREG0+6), "4*REG_FPREG6" },
499 { 4*(REG_FPREG0+7), "4*REG_FPREG7" },
500 { 4*(REG_FPREG0+8), "4*REG_FPREG8" },
501 { 4*(REG_FPREG0+9), "4*REG_FPREG9" },
502 { 4*(REG_FPREG0+10), "4*REG_FPREG10" },
503 { 4*(REG_FPREG0+11), "4*REG_FPREG11" },
504 { 4*(REG_FPREG0+12), "4*REG_FPREG12" },
505 { 4*(REG_FPREG0+13), "4*REG_FPREG13" },
506 { 4*(REG_FPREG0+14), "4*REG_FPREG14" },
510 { 4*(REG_XDREG0+2), "4*REG_XDREG2" },
511 { 4*(REG_XDREG0+4), "4*REG_XDREG4" },
512 { 4*(REG_XDREG0+6), "4*REG_XDREG6" },
513 { 4*(REG_XDREG0+8), "4*REG_XDREG8" },
514 { 4*(REG_XDREG0+10), "4*REG_XDREG10" },
515 { 4*(REG_XDREG0+12), "4*REG_XDREG12" },
524 { 16, "syscall no.(L)" },
525 { 20, "syscall_no.(U)" },
668 /* This entry is in case pt_regs contains dregs (depends on
669 the kernel build options). */
670 { uoff(regs), "offsetof(struct user, regs)" },
671 { uoff(fpu), "offsetof(struct user, fpu)" },
673 { uoff(regs.ARM_r0), "r0" },
674 { uoff(regs.ARM_r1), "r1" },
675 { uoff(regs.ARM_r2), "r2" },
676 { uoff(regs.ARM_r3), "r3" },
677 { uoff(regs.ARM_r4), "r4" },
678 { uoff(regs.ARM_r5), "r5" },
679 { uoff(regs.ARM_r6), "r6" },
680 { uoff(regs.ARM_r7), "r7" },
681 { uoff(regs.ARM_r8), "r8" },
682 { uoff(regs.ARM_r9), "r9" },
683 { uoff(regs.ARM_r10), "r10" },
684 { uoff(regs.ARM_fp), "fp" },
685 { uoff(regs.ARM_ip), "ip" },
686 { uoff(regs.ARM_sp), "sp" },
687 { uoff(regs.ARM_lr), "lr" },
688 { uoff(regs.ARM_pc), "pc" },
689 { uoff(regs.ARM_cpsr), "cpsr" },
691 { uoff(regs.sr), "sr" },
692 { uoff(regs.pc), "pc" },
693 { uoff(regs.lr), "lr" },
694 { uoff(regs.sp), "sp" },
695 { uoff(regs.r12), "r12" },
696 { uoff(regs.r11), "r11" },
697 { uoff(regs.r10), "r10" },
698 { uoff(regs.r9), "r9" },
699 { uoff(regs.r8), "r8" },
700 { uoff(regs.r7), "r7" },
701 { uoff(regs.r6), "r6" },
702 { uoff(regs.r5), "r5" },
703 { uoff(regs.r4), "r4" },
704 { uoff(regs.r3), "r3" },
705 { uoff(regs.r2), "r2" },
706 { uoff(regs.r1), "r1" },
707 { uoff(regs.r0), "r0" },
708 { uoff(regs.r12_orig), "orig_r12" },
782 { PTREGS_OFFSET_REG(0), "r0" },
783 { PTREGS_OFFSET_REG(1), "r1" },
784 { PTREGS_OFFSET_REG(2), "r2" },
785 { PTREGS_OFFSET_REG(3), "r3" },
786 { PTREGS_OFFSET_REG(4), "r4" },
787 { PTREGS_OFFSET_REG(5), "r5" },
788 { PTREGS_OFFSET_REG(6), "r6" },
789 { PTREGS_OFFSET_REG(7), "r7" },
790 { PTREGS_OFFSET_REG(8), "r8" },
791 { PTREGS_OFFSET_REG(9), "r9" },
792 { PTREGS_OFFSET_REG(10), "r10" },
793 { PTREGS_OFFSET_REG(11), "r11" },
794 { PTREGS_OFFSET_REG(12), "r12" },
795 { PTREGS_OFFSET_REG(13), "r13" },
796 { PTREGS_OFFSET_REG(14), "r14" },
797 { PTREGS_OFFSET_REG(15), "r15" },
798 { PTREGS_OFFSET_REG(16), "r16" },
799 { PTREGS_OFFSET_REG(17), "r17" },
800 { PTREGS_OFFSET_REG(18), "r18" },
801 { PTREGS_OFFSET_REG(19), "r19" },
802 { PTREGS_OFFSET_REG(20), "r20" },
803 { PTREGS_OFFSET_REG(21), "r21" },
804 { PTREGS_OFFSET_REG(22), "r22" },
805 { PTREGS_OFFSET_REG(23), "r23" },
806 { PTREGS_OFFSET_REG(24), "r24" },
807 { PTREGS_OFFSET_REG(25), "r25" },
808 { PTREGS_OFFSET_REG(26), "r26" },
809 { PTREGS_OFFSET_REG(27), "r27" },
810 { PTREGS_OFFSET_REG(28), "r28" },
811 { PTREGS_OFFSET_REG(29), "r29" },
812 { PTREGS_OFFSET_REG(30), "r30" },
813 { PTREGS_OFFSET_REG(31), "r31" },
814 { PTREGS_OFFSET_REG(32), "r32" },
815 { PTREGS_OFFSET_REG(33), "r33" },
816 { PTREGS_OFFSET_REG(34), "r34" },
817 { PTREGS_OFFSET_REG(35), "r35" },
818 { PTREGS_OFFSET_REG(36), "r36" },
819 { PTREGS_OFFSET_REG(37), "r37" },
820 { PTREGS_OFFSET_REG(38), "r38" },
821 { PTREGS_OFFSET_REG(39), "r39" },
822 { PTREGS_OFFSET_REG(40), "r40" },
823 { PTREGS_OFFSET_REG(41), "r41" },
824 { PTREGS_OFFSET_REG(42), "r42" },
825 { PTREGS_OFFSET_REG(43), "r43" },
826 { PTREGS_OFFSET_REG(44), "r44" },
827 { PTREGS_OFFSET_REG(45), "r45" },
828 { PTREGS_OFFSET_REG(46), "r46" },
829 { PTREGS_OFFSET_REG(47), "r47" },
830 { PTREGS_OFFSET_REG(48), "r48" },
831 { PTREGS_OFFSET_REG(49), "r49" },
832 { PTREGS_OFFSET_REG(50), "r50" },
833 { PTREGS_OFFSET_REG(51), "r51" },
834 { PTREGS_OFFSET_REG(52), "r52" },
835 { PTREGS_OFFSET_TP, "tp" },
836 { PTREGS_OFFSET_SP, "sp" },
837 { PTREGS_OFFSET_LR, "lr" },
838 { PTREGS_OFFSET_PC, "pc" },
839 { PTREGS_OFFSET_EX1, "ex1" },
840 { PTREGS_OFFSET_FAULTNUM, "faultnum" },
841 { PTREGS_OFFSET_ORIG_R0, "orig_r0" },
842 { PTREGS_OFFSET_FLAGS, "flags" },
845 XLAT(4*PT_FRAMETYPE),
924 { PT_GPR(10), "r10" },
925 { PT_GPR(11), "r11" },
926 { PT_GPR(12), "r12" },
927 { PT_GPR(13), "r13" },
928 { PT_GPR(14), "r14" },
929 { PT_GPR(15), "r15" },
930 { PT_GPR(16), "r16" },
931 { PT_GPR(17), "r17" },
932 { PT_GPR(18), "r18" },
933 { PT_GPR(19), "r19" },
934 { PT_GPR(20), "r20" },
935 { PT_GPR(21), "r21" },
936 { PT_GPR(22), "r22" },
937 { PT_GPR(23), "r23" },
938 { PT_GPR(24), "r24" },
939 { PT_GPR(25), "r25" },
940 { PT_GPR(26), "r26" },
941 { PT_GPR(27), "r27" },
942 { PT_GPR(28), "r28" },
943 { PT_GPR(29), "r29" },
944 { PT_GPR(30), "r30" },
945 { PT_GPR(31), "r31" },
951 { PT_KERNEL_MODE, "kernel_mode", },
990 { REG_A_BASE, "a0" },
991 { REG_A_BASE+1, "a1" },
992 { REG_A_BASE+2, "a2" },
993 { REG_A_BASE+3, "a3" },
994 { REG_A_BASE+4, "a4" },
995 { REG_A_BASE+5, "a5" },
996 { REG_A_BASE+6, "a6" },
997 { REG_A_BASE+7, "a7" },
998 { REG_A_BASE+8, "a8" },
999 { REG_A_BASE+9, "a9" },
1000 { REG_A_BASE+10, "a10" },
1001 { REG_A_BASE+11, "a11" },
1002 { REG_A_BASE+12, "a12" },
1003 { REG_A_BASE+13, "a13" },
1004 { REG_A_BASE+14, "a14" },
1005 { REG_A_BASE+15, "a15" },
1007 { SYSCALL_NR, "syscall_nr" },
1008 { REG_AR_BASE, "ar0" },
1009 { REG_AR_BASE+1, "ar1" },
1010 { REG_AR_BASE+2, "ar2" },
1011 { REG_AR_BASE+3, "ar3" },
1012 { REG_AR_BASE+4, "ar4" },
1013 { REG_AR_BASE+5, "ar5" },
1014 { REG_AR_BASE+6, "ar6" },
1015 { REG_AR_BASE+7, "ar7" },
1016 { REG_AR_BASE+8, "ar8" },
1017 { REG_AR_BASE+9, "ar9" },
1018 { REG_AR_BASE+10, "ar10" },
1019 { REG_AR_BASE+11, "ar11" },
1020 { REG_AR_BASE+12, "ar12" },
1021 { REG_AR_BASE+13, "ar13" },
1022 { REG_AR_BASE+14, "ar14" },
1023 { REG_AR_BASE+15, "ar15" },
1024 { REG_AR_BASE+16, "ar16" },
1025 { REG_AR_BASE+17, "ar17" },
1026 { REG_AR_BASE+18, "ar18" },
1027 { REG_AR_BASE+19, "ar19" },
1028 { REG_AR_BASE+20, "ar20" },
1029 { REG_AR_BASE+21, "ar21" },
1030 { REG_AR_BASE+22, "ar22" },
1031 { REG_AR_BASE+23, "ar23" },
1032 { REG_AR_BASE+24, "ar24" },
1033 { REG_AR_BASE+25, "ar25" },
1034 { REG_AR_BASE+26, "ar26" },
1035 { REG_AR_BASE+27, "ar27" },
1036 { REG_AR_BASE+28, "ar28" },
1037 { REG_AR_BASE+29, "ar29" },
1038 { REG_AR_BASE+30, "ar30" },
1039 { REG_AR_BASE+31, "ar31" },
1040 { REG_AR_BASE+32, "ar32" },
1041 { REG_AR_BASE+33, "ar33" },
1042 { REG_AR_BASE+34, "ar34" },
1043 { REG_AR_BASE+35, "ar35" },
1044 { REG_AR_BASE+36, "ar36" },
1045 { REG_AR_BASE+37, "ar37" },
1046 { REG_AR_BASE+38, "ar38" },
1047 { REG_AR_BASE+39, "ar39" },
1048 { REG_AR_BASE+40, "ar40" },
1049 { REG_AR_BASE+41, "ar41" },
1050 { REG_AR_BASE+42, "ar42" },
1051 { REG_AR_BASE+43, "ar43" },
1052 { REG_AR_BASE+44, "ar44" },
1053 { REG_AR_BASE+45, "ar45" },
1054 { REG_AR_BASE+46, "ar46" },
1055 { REG_AR_BASE+47, "ar47" },
1056 { REG_AR_BASE+48, "ar48" },
1057 { REG_AR_BASE+49, "ar49" },
1058 { REG_AR_BASE+50, "ar50" },
1059 { REG_AR_BASE+51, "ar51" },
1060 { REG_AR_BASE+52, "ar52" },
1061 { REG_AR_BASE+53, "ar53" },
1062 { REG_AR_BASE+54, "ar54" },
1063 { REG_AR_BASE+55, "ar55" },
1064 { REG_AR_BASE+56, "ar56" },
1065 { REG_AR_BASE+57, "ar57" },
1066 { REG_AR_BASE+58, "ar58" },
1067 { REG_AR_BASE+59, "ar59" },
1068 { REG_AR_BASE+60, "ar60" },
1069 { REG_AR_BASE+61, "ar61" },
1070 { REG_AR_BASE+62, "ar62" },
1071 { REG_AR_BASE+63, "ar63" },
1072 { REG_LBEG, "lbeg" },
1073 { REG_LEND, "lend" },
1074 { REG_LCOUNT, "lcount" },
1081 /* Other fields in "struct user" */
1082 #if defined(S390) || defined(S390X)
1083 { uoff(u_tsize), "offsetof(struct user, u_tsize)" },
1084 { uoff(u_dsize), "offsetof(struct user, u_dsize)" },
1085 { uoff(u_ssize), "offsetof(struct user, u_ssize)" },
1086 { uoff(start_code), "offsetof(struct user, start_code)" },
1087 /* S390[X] has no start_data */
1088 { uoff(start_stack), "offsetof(struct user, start_stack)" },
1089 { uoff(signal), "offsetof(struct user, signal)" },
1090 { uoff(u_ar0), "offsetof(struct user, u_ar0)" },
1091 { uoff(magic), "offsetof(struct user, magic)" },
1092 { uoff(u_comm), "offsetof(struct user, u_comm)" },
1093 { sizeof(struct user), "sizeof(struct user)" },
1094 #elif defined(POWERPC)
1095 { sizeof(struct user), "sizeof(struct user)" },
1096 #elif defined(I386) || defined(X86_64) || defined(X32)
1097 { uoff(u_fpvalid), "offsetof(struct user, u_fpvalid)" },
1098 { uoff(i387), "offsetof(struct user, i387)" },
1099 { uoff(u_tsize), "offsetof(struct user, u_tsize)" },
1100 { uoff(u_dsize), "offsetof(struct user, u_dsize)" },
1101 { uoff(u_ssize), "offsetof(struct user, u_ssize)" },
1102 { uoff(start_code), "offsetof(struct user, start_code)" },
1103 { uoff(start_stack), "offsetof(struct user, start_stack)" },
1104 { uoff(signal), "offsetof(struct user, signal)" },
1105 { uoff(reserved), "offsetof(struct user, reserved)" },
1106 { uoff(u_ar0), "offsetof(struct user, u_ar0)" },
1107 { uoff(u_fpstate), "offsetof(struct user, u_fpstate)" },
1108 { uoff(magic), "offsetof(struct user, magic)" },
1109 { uoff(u_comm), "offsetof(struct user, u_comm)" },
1110 { uoff(u_debugreg), "offsetof(struct user, u_debugreg)" },
1111 { sizeof(struct user), "sizeof(struct user)" },
1113 { sizeof(struct user), "sizeof(struct user)" },
1115 { uoff(u_fpvalid), "offsetof(struct user, u_fpvalid)" },
1116 { uoff(u_tsize), "offsetof(struct user, u_tsize)" },
1117 { uoff(u_dsize), "offsetof(struct user, u_dsize)" },
1118 { uoff(u_ssize), "offsetof(struct user, u_ssize)" },
1119 { uoff(start_code), "offsetof(struct user, start_code)" },
1120 { uoff(start_stack), "offsetof(struct user, start_stack)" },
1121 { uoff(signal), "offsetof(struct user, signal)" },
1122 { uoff(reserved), "offsetof(struct user, reserved)" },
1123 { uoff(u_ar0), "offsetof(struct user, u_ar0)" },
1124 { uoff(magic), "offsetof(struct user, magic)" },
1125 { uoff(u_comm), "offsetof(struct user, u_comm)" },
1126 { sizeof(struct user), "sizeof(struct user)" },
1127 #elif defined(AARCH64)
1130 { uoff(u_fpvalid), "offsetof(struct user, u_fpvalid)" },
1131 { uoff(m68kfp), "offsetof(struct user, m68kfp)" },
1132 { uoff(u_tsize), "offsetof(struct user, u_tsize)" },
1133 { uoff(u_dsize), "offsetof(struct user, u_dsize)" },
1134 { uoff(u_ssize), "offsetof(struct user, u_ssize)" },
1135 { uoff(start_code), "offsetof(struct user, start_code)" },
1136 { uoff(start_stack), "offsetof(struct user, start_stack)" },
1137 { uoff(signal), "offsetof(struct user, signal)" },
1138 { uoff(reserved), "offsetof(struct user, reserved)" },
1139 { uoff(u_ar0), "offsetof(struct user, u_ar0)" },
1140 { uoff(u_fpstate), "offsetof(struct user, u_fpstate)" },
1141 { uoff(magic), "offsetof(struct user, magic)" },
1142 { uoff(u_comm), "offsetof(struct user, u_comm)" },
1143 { sizeof(struct user), "sizeof(struct user)" },
1144 #elif defined(MIPS) || defined(LINUX_MIPSN32)
1145 { uoff(u_tsize), "offsetof(struct user, u_tsize)" },
1146 { uoff(u_dsize), "offsetof(struct user, u_dsize)" },
1147 { uoff(u_ssize), "offsetof(struct user, u_ssize)" },
1148 { uoff(start_code), "offsetof(struct user, start_code)" },
1149 { uoff(start_data), "offsetof(struct user, start_data)" },
1150 { uoff(start_stack), "offsetof(struct user, start_stack)" },
1151 { uoff(signal), "offsetof(struct user, signal)" },
1152 { uoff(u_ar0), "offsetof(struct user, u_ar0)" },
1153 { uoff(magic), "offsetof(struct user, magic)" },
1154 { uoff(u_comm), "offsetof(struct user, u_comm)" },
1155 { sizeof(struct user), "sizeof(struct user)" },
1156 #elif defined(ALPHA)
1157 { sizeof(struct user), "sizeof(struct user)" },
1158 #elif defined(SPARC)
1159 { sizeof(struct user), "sizeof(struct user)" },
1160 #elif defined(SPARC64)
1161 { uoff(u_tsize), "offsetof(struct user, u_tsize)" },
1162 { uoff(u_dsize), "offsetof(struct user, u_dsize)" },
1163 { uoff(u_ssize), "offsetof(struct user, u_ssize)" },
1164 { uoff(signal), "offsetof(struct user, signal)" },
1165 { uoff(magic), "offsetof(struct user, magic)" },
1166 { uoff(u_comm), "offsetof(struct user, u_comm)" },
1167 { sizeof(struct user), "sizeof(struct user)" },
1170 #elif defined(SH) || defined(SH64)
1171 { uoff(u_fpvalid), "offsetof(struct user, u_fpvalid)" },
1172 { uoff(u_tsize), "offsetof(struct user, u_tsize)" },
1173 { uoff(u_dsize), "offsetof(struct user, u_dsize)" },
1174 { uoff(u_ssize), "offsetof(struct user, u_ssize)" },
1175 { uoff(start_code), "offsetof(struct user, start_code)" },
1176 { uoff(start_data), "offsetof(struct user, start_data)" },
1177 { uoff(start_stack), "offsetof(struct user, start_stack)" },
1178 { uoff(signal), "offsetof(struct user, signal)" },
1179 { uoff(u_ar0), "offsetof(struct user, u_ar0)" },
1180 { uoff(u_fpstate), "offsetof(struct user, u_fpstate)" },
1181 { uoff(magic), "offsetof(struct user, magic)" },
1182 { uoff(u_comm), "offsetof(struct user, u_comm)" },
1183 { sizeof(struct user), "sizeof(struct user)" },
1184 #elif defined(CRISV10) || defined(CRISV32)
1185 { sizeof(struct user), "sizeof(struct user)" },
1188 #elif defined(MICROBLAZE)
1189 { sizeof(struct user), "sizeof(struct user)" },
1190 #elif defined(AVR32)
1191 { uoff(u_tsize), "offsetof(struct user, u_tsize)" },
1192 { uoff(u_dsize), "offsetof(struct user, u_dsize)" },
1193 { uoff(u_ssize), "offsetof(struct user, u_ssize)" },
1194 { uoff(start_code), "offsetof(struct user, start_code)" },
1195 { uoff(start_data), "offsetof(struct user, start_data)" },
1196 { uoff(start_stack), "offsetof(struct user, start_stack)" },
1197 { uoff(signal), "offsetof(struct user, signal)" },
1198 { uoff(u_ar0), "offsetof(struct user, u_ar0)" },
1199 { uoff(magic), "offsetof(struct user, magic)" },
1200 { uoff(u_comm), "offsetof(struct user, u_comm)" },
1201 { sizeof(struct user), "sizeof(struct user)" },
1203 { uoff(u_tsize), "offsetof(struct user, u_tsize)" },
1204 { uoff(u_dsize), "offsetof(struct user, u_dsize)" },
1205 { uoff(u_ssize), "offsetof(struct user, u_ssize)" },
1206 { uoff(start_code), "offsetof(struct user, start_code)" },
1207 { uoff(signal), "offsetof(struct user, signal)" },
1208 { uoff(u_ar0), "offsetof(struct user, u_ar0)" },
1209 { uoff(magic), "offsetof(struct user, magic)" },
1210 { uoff(u_comm), "offsetof(struct user, u_comm)" },
1211 { sizeof(struct user), "sizeof(struct user)" },
1214 #elif defined(METAG)
1216 #elif defined(XTENSA)
1225 sys_ptrace(struct tcb *tcp)
1227 const struct xlat *x;
1230 if (entering(tcp)) {
1231 printxval(ptrace_cmds, tcp->u_arg[0], "PTRACE_???");
1232 tprintf(", %lu, ", tcp->u_arg[1]);
1234 addr = tcp->u_arg[2];
1235 if (tcp->u_arg[0] == PTRACE_PEEKUSER
1236 || tcp->u_arg[0] == PTRACE_POKEUSER
1238 for (x = struct_user_offsets; x->str; x++) {
1243 tprintf("%#lx, ", addr);
1244 else if (x->val > addr && x != struct_user_offsets) {
1246 tprintf("%s + %ld, ", x->str, addr - x->val);
1249 tprintf("%s, ", x->str);
1251 #ifdef PTRACE_GETREGSET
1252 if (tcp->u_arg[0] == PTRACE_GETREGSET
1253 || tcp->u_arg[0] == PTRACE_SETREGSET
1255 printxval(nt_descriptor_types, tcp->u_arg[2], "NT_???");
1259 tprintf("%#lx, ", addr);
1262 switch (tcp->u_arg[0]) {
1264 case PTRACE_PEEKDATA:
1265 case PTRACE_PEEKTEXT:
1266 case PTRACE_PEEKUSER:
1270 case PTRACE_SINGLESTEP:
1271 case PTRACE_SYSCALL:
1273 printsignal(tcp->u_arg[3]);
1275 #ifdef PTRACE_SETOPTIONS
1276 case PTRACE_SETOPTIONS:
1277 printflags(ptrace_setoptions_flags, tcp->u_arg[3], "PTRACE_O_???");
1280 #ifdef PTRACE_SETSIGINFO
1281 case PTRACE_SETSIGINFO: {
1282 printsiginfo_at(tcp, tcp->u_arg[3]);
1286 #ifdef PTRACE_GETSIGINFO
1287 case PTRACE_GETSIGINFO:
1288 /* Don't print anything, do it at syscall return. */
1291 #ifdef PTRACE_GETREGSET
1292 case PTRACE_GETREGSET:
1294 case PTRACE_SETREGSET:
1295 tprint_iov(tcp, /*len:*/ 1, tcp->u_arg[3], /*as string:*/ 0);
1299 tprintf("%#lx", tcp->u_arg[3]);
1303 switch (tcp->u_arg[0]) {
1304 case PTRACE_PEEKDATA:
1305 case PTRACE_PEEKTEXT:
1306 case PTRACE_PEEKUSER:
1310 printnum(tcp, tcp->u_arg[3], "%#lx");
1313 #ifdef PTRACE_GETSIGINFO
1314 case PTRACE_GETSIGINFO: {
1315 printsiginfo_at(tcp, tcp->u_arg[3]);
1319 #ifdef PTRACE_GETREGSET
1320 case PTRACE_GETREGSET:
1321 tprint_iov(tcp, /*len:*/ 1, tcp->u_arg[3], /*as string:*/ 0);