| 1 |
# arch-specific requests of ptrace ___________________________ |
| 2 |
# |
| 3 |
%{ |
| 4 |
// Get _stp_val_array and _stp_lookup_* definitions. |
| 5 |
#include "linux/syscalls-common.h" |
| 6 |
|
| 7 |
#ifndef PTRACE_GETVSRREGS |
| 8 |
# define PTRACE_GETVSRREGS 27 |
| 9 |
#endif |
| 10 |
#ifndef PTRACE_SETVSRREGS |
| 11 |
# define PTRACE_SETVSRREGS 28 |
| 12 |
#endif |
| 13 |
#ifndef PTRACE_GETREGS |
| 14 |
# define PTRACE_GETREGS 12 |
| 15 |
#endif |
| 16 |
#ifndef PTRACE_SETREGS |
| 17 |
# define PTRACE_SETREGS 13 |
| 18 |
#endif |
| 19 |
#ifndef PTRACE_GETFPREGS |
| 20 |
# define PTRACE_GETFPREGS 14 |
| 21 |
#endif |
| 22 |
#ifndef PTRACE_SETFPREGS |
| 23 |
# define PTRACE_SETFPREGS 15 |
| 24 |
#endif |
| 25 |
#ifndef PTRACE_GETREGS64 |
| 26 |
# define PTRACE_GETREGS64 22 |
| 27 |
#endif |
| 28 |
#ifndef PTRACE_SETREGS64 |
| 29 |
# define PTRACE_SETREGS64 23 |
| 30 |
#endif |
| 31 |
|
| 32 |
/* (old) PTRACE requests with inverted arguments */ |
| 33 |
#ifndef PPC_PTRACE_GETREGS |
| 34 |
# define PPC_PTRACE_GETREGS 0x99 |
| 35 |
#endif |
| 36 |
#ifndef PPC_PTRACE_SETREGS |
| 37 |
# define PPC_PTRACE_SETREGS 0x98 |
| 38 |
#endif |
| 39 |
#ifndef PPC_PTRACE_GETFPREGS |
| 40 |
# define PPC_PTRACE_GETFPREGS 0x97 |
| 41 |
#endif |
| 42 |
#ifndef PPC_PTRACE_SETFPREGS |
| 43 |
# define PPC_PTRACE_SETFPREGS 0x96 |
| 44 |
#endif |
| 45 |
|
| 46 |
#ifndef PTRACE_SINGLEBLOCK |
| 47 |
# define PTRACE_SINGLEBLOCK 0x100 |
| 48 |
#endif |
| 49 |
|
| 50 |
#ifndef PPC_PTRACE_GETHWDBGINFO |
| 51 |
# define PPC_PTRACE_GETHWDBGINFO 0x89 |
| 52 |
#endif |
| 53 |
#ifndef PPC_PTRACE_SETHWDEBUG |
| 54 |
# define PPC_PTRACE_SETHWDEBUG 0x88 |
| 55 |
#endif |
| 56 |
#ifndef PPC_PTRACE_DELHWDEBUG |
| 57 |
# define PPC_PTRACE_DELHWDEBUG 0x87 |
| 58 |
#endif |
| 59 |
|
| 60 |
static const _stp_val_array _stp_arch_ptrace_request_list[] = { |
| 61 |
V(PTRACE_GETVRREGS), |
| 62 |
V(PTRACE_SETVRREGS), |
| 63 |
|
| 64 |
/* Get/set all the upper 32-bits of the SPE registers, |
| 65 |
* accumulator, and spefscr, in one go */ |
| 66 |
V(PTRACE_GETEVRREGS), |
| 67 |
V(PTRACE_SETEVRREGS), |
| 68 |
|
| 69 |
/* Get the first 32 128bit VSX registers */ |
| 70 |
V(PTRACE_GETVSRREGS), |
| 71 |
V(PTRACE_SETVSRREGS), |
| 72 |
|
| 73 |
/* |
| 74 |
* Get or set a debug register. The first 16 are DABR |
| 75 |
* registers and the second 16 are IABR registers. |
| 76 |
*/ |
| 77 |
V(PTRACE_GET_DEBUGREG), |
| 78 |
V(PTRACE_SET_DEBUGREG), |
| 79 |
|
| 80 |
/* (new) PTRACE requests using the same numbers as x86 and the |
| 81 |
* same argument ordering. Additionally, they support more |
| 82 |
* registers too |
| 83 |
*/ |
| 84 |
V(PTRACE_GETREGS), |
| 85 |
V(PTRACE_SETREGS), |
| 86 |
V(PTRACE_GETFPREGS), |
| 87 |
V(PTRACE_SETFPREGS), |
| 88 |
V(PTRACE_GETREGS64), |
| 89 |
V(PTRACE_SETREGS64), |
| 90 |
|
| 91 |
/* Calls to trace a 64bit program from a 32bit program */ |
| 92 |
V(PPC_PTRACE_PEEKTEXT_3264), |
| 93 |
V(PPC_PTRACE_PEEKDATA_3264), |
| 94 |
V(PPC_PTRACE_POKETEXT_3264), |
| 95 |
V(PPC_PTRACE_POKEDATA_3264), |
| 96 |
V(PPC_PTRACE_PEEKUSR_3264), |
| 97 |
V(PPC_PTRACE_POKEUSR_3264), |
| 98 |
|
| 99 |
/* (old) PTRACE requests with inverted arguments */ |
| 100 |
V(PPC_PTRACE_GETREGS), |
| 101 |
V(PPC_PTRACE_SETREGS), |
| 102 |
V(PPC_PTRACE_GETFPREGS), |
| 103 |
V(PPC_PTRACE_SETFPREGS), |
| 104 |
|
| 105 |
V(PTRACE_SINGLEBLOCK), |
| 106 |
|
| 107 |
V(PPC_PTRACE_GETHWDBGINFO), |
| 108 |
V(PPC_PTRACE_SETHWDEBUG), |
| 109 |
V(PPC_PTRACE_DELHWDEBUG), |
| 110 |
{0, NULL} |
| 111 |
}; |
| 112 |
%} |
| 113 |
|
| 114 |
function __arch_ptrace_request_str:string(request:long) |
| 115 |
%{ /* pure */ |
| 116 |
_stp_lookup_str(_stp_arch_ptrace_request_list, |
| 117 |
(unsigned long)STAP_ARG_request, STAP_RETVALUE, |
| 118 |
MAXSTRINGLEN); |
| 119 |
%} |
| 120 |
|
| 121 |
function _arch_ptrace_argstr(request, pid, addr, data) |
| 122 |
{ |
| 123 |
if (request == @const("PTRACE_GETVRREGS") |
| 124 |
|| request == @const("PTRACE_SETVRREGS") |
| 125 |
|| request == @const("PTRACE_GETEVRREGS") |
| 126 |
|| request == @const("PTRACE_SETEVRREGS") |
| 127 |
|| request == @const("PTRACE_GETVSRREGS") |
| 128 |
|| request == @const("PTRACE_SETVSRREGS") |
| 129 |
|| request == @const("PTRACE_GETREGS") |
| 130 |
|| request == @const("PTRACE_SETREGS") |
| 131 |
|| request == @const("PTRACE_GETFPREGS") |
| 132 |
|| request == @const("PTRACE_SETFPREGS") |
| 133 |
|| request == @const("PTRACE_GETREGS64") |
| 134 |
|| request == @const("PTRACE_SETREGS64") |
| 135 |
|| request == @const("PTRACE_GET_DEBUGREG")) |
| 136 |
return sprintf("%s, %d, %#x, %p", |
| 137 |
__arch_ptrace_request_str(request), pid, |
| 138 |
addr, data) |
| 139 |
if (request == @const("PTRACE_SET_DEBUGREG")) |
| 140 |
return sprintf("PTRACE_SET_DEBUGREG, %d, %#x, %#x", pid, |
| 141 |
addr, data) |
| 142 |
if (request == @const("PPC_PTRACE_GETREGS") |
| 143 |
|| request == @const("PPC_PTRACE_SETREGS") |
| 144 |
|| request == @const("PPC_PTRACE_GETFPREGS") |
| 145 |
|| request == @const("PPC_PTRACE_SETFPREGS")) |
| 146 |
return sprintf("%s, %d, %p, %#x", |
| 147 |
__arch_ptrace_request_str(request), pid, |
| 148 |
addr, data) |
| 149 |
if (request == @const("PTRACE_SINGLEBLOCK")) |
| 150 |
return sprintf("PTRACE_SINGLEBLOCK, %d, %#x, %s", pid, |
| 151 |
addr, _signal_name (data)) |
| 152 |
if (request == @const("PPC_PTRACE_PEEKTEXT_3264") |
| 153 |
|| request == @const("PPC_PTRACE_PEEKDATA_3264") |
| 154 |
|| request == @const("PPC_PTRACE_PEEKUSR_3264")) |
| 155 |
return sprintf("%s, %d, %p, [%p]", |
| 156 |
__arch_ptrace_request_str(request), pid, addr, |
| 157 |
data) |
| 158 |
if (request == @const("PPC_PTRACE_POKETEXT_3264") |
| 159 |
|| request == @const("PPC_PTRACE_POKEDATA_3264") |
| 160 |
|| request == @const("PPC_PTRACE_POKEUSR_3264") |
| 161 |
|| request == @const("PPC_PTRACE_GETHWDBGINFO") |
| 162 |
|| request == @const("PPC_PTRACE_SETHWDEBUG")) |
| 163 |
return sprintf("%s, %d, %p, %p", |
| 164 |
__arch_ptrace_request_str(request), pid, addr, |
| 165 |
data) |
| 166 |
if (request == @const("PPC_PTRACE_DELHWDEBUG")) |
| 167 |
return sprintf ("PPC_PTRACE_DELHWDEBUG, %d, %#x, %d", pid, |
| 168 |
addr, data) |
| 169 |
} |
| 170 |
|
| 171 |
function _ptrace_return_arch_prctl_addr:long(request:long, addr:long, data:long) |
| 172 |
{ |
| 173 |
return 0 |
| 174 |
} |