zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

ptrace.h (6602B) - Raw


      1 /* `ptrace' debugger support interface.  Linux/AArch64 version.
      2    Copyright (C) 1996-2025 Free Software Foundation, Inc.
      3 
      4    This file is part of the GNU C Library.
      5 
      6    The GNU C Library is free software; you can redistribute it and/or
      7    modify it under the terms of the GNU Lesser General Public
      8    License as published by the Free Software Foundation; either
      9    version 2.1 of the License, or (at your option) any later version.
     10 
     11    The GNU C Library is distributed in the hope that it will be useful,
     12    but WITHOUT ANY WARRANTY; without even the implied warranty of
     13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14    Lesser General Public License for more details.
     15 
     16    You should have received a copy of the GNU Lesser General Public
     17    License along with the GNU C Library; if not, see
     18    <https://www.gnu.org/licenses/>.  */
     19 
     20 #ifndef _SYS_PTRACE_H
     21 #define _SYS_PTRACE_H	1
     22 
     23 #include <features.h>
     24 #include <bits/types.h>
     25 
     26 __BEGIN_DECLS
     27 
     28 /* Avoid collision if the linux ptrace header is already included.  */
     29 #undef PTRACE_TRACEME
     30 #undef PTRACE_PEEKTEXT
     31 #undef PTRACE_PEEKDATA
     32 #undef PTRACE_PEEKUSER
     33 #undef PTRACE_POKETEXT
     34 #undef PTRACE_POKEDATA
     35 #undef PTRACE_POKEUSER
     36 #undef PTRACE_CONT
     37 #undef PTRACE_KILL
     38 #undef PTRACE_SINGLESTEP
     39 #undef PTRACE_ATTACH
     40 #undef PTRACE_DETACH
     41 #undef PTRACE_SYSCALL
     42 #undef PTRACE_SYSEMU
     43 #undef PTRACE_SYSEMU_SINGLESTEP
     44 #undef PTRACE_PEEKMTETAGS
     45 #undef PTRACE_POKEMTETAGS
     46 #undef PTRACE_SETOPTIONS
     47 #undef PTRACE_GETEVENTMSG
     48 #undef PTRACE_GETSIGINFO
     49 #undef PTRACE_SETSIGINFO
     50 #undef PTRACE_GETREGSET
     51 #undef PTRACE_SETREGSET
     52 #undef PTRACE_SEIZE
     53 #undef PTRACE_INTERRUPT
     54 #undef PTRACE_LISTEN
     55 #undef PTRACE_PEEKSIGINFO
     56 #undef PTRACE_GETSIGMASK
     57 #undef PTRACE_SETSIGMASK
     58 #undef PTRACE_SECCOMP_GET_FILTER
     59 #undef PTRACE_SECCOMP_GET_METADATA
     60 #undef PTRACE_GET_SYSCALL_INFO
     61 #undef PTRACE_GET_RSEQ_CONFIGURATION
     62 #undef PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG
     63 #undef PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG
     64 
     65 /* Type of the REQUEST argument to `ptrace.'  */
     66 enum __ptrace_request
     67 {
     68   /* Indicate that the process making this request should be traced.
     69      All signals received by this process can be intercepted by its
     70      parent, and its parent can use the other `ptrace' requests.  */
     71   PTRACE_TRACEME = 0,
     72 #define PT_TRACE_ME PTRACE_TRACEME
     73 
     74   /* Return the word in the process's text space at address ADDR.  */
     75   PTRACE_PEEKTEXT = 1,
     76 #define PT_READ_I PTRACE_PEEKTEXT
     77 
     78   /* Return the word in the process's data space at address ADDR.  */
     79   PTRACE_PEEKDATA = 2,
     80 #define PT_READ_D PTRACE_PEEKDATA
     81 
     82   /* Return the word in the process's user area at offset ADDR.  */
     83   PTRACE_PEEKUSER = 3,
     84 #define PT_READ_U PTRACE_PEEKUSER
     85 
     86   /* Write the word DATA into the process's text space at address ADDR.  */
     87   PTRACE_POKETEXT = 4,
     88 #define PT_WRITE_I PTRACE_POKETEXT
     89 
     90   /* Write the word DATA into the process's data space at address ADDR.  */
     91   PTRACE_POKEDATA = 5,
     92 #define PT_WRITE_D PTRACE_POKEDATA
     93 
     94   /* Write the word DATA into the process's user area at offset ADDR.  */
     95   PTRACE_POKEUSER = 6,
     96 #define PT_WRITE_U PTRACE_POKEUSER
     97 
     98   /* Continue the process.  */
     99   PTRACE_CONT = 7,
    100 #define PT_CONTINUE PTRACE_CONT
    101 
    102   /* Kill the process.  */
    103   PTRACE_KILL = 8,
    104 #define PT_KILL PTRACE_KILL
    105 
    106   /* Single step the process.  */
    107   PTRACE_SINGLESTEP = 9,
    108 #define PT_STEP PTRACE_SINGLESTEP
    109 
    110   /* Attach to a process that is already running. */
    111   PTRACE_ATTACH = 16,
    112 #define PT_ATTACH PTRACE_ATTACH
    113 
    114   /* Detach from a process attached to with PTRACE_ATTACH.  */
    115   PTRACE_DETACH = 17,
    116 #define PT_DETACH PTRACE_DETACH
    117 
    118   /* Continue and stop at the next entry to or return from syscall.  */
    119   PTRACE_SYSCALL = 24,
    120 #define PT_SYSCALL PTRACE_SYSCALL
    121 
    122   /* Continue and stop at the next syscall, it will not be executed.  */
    123   PTRACE_SYSEMU = 31,
    124 #define PT_SYSEMU PTRACE_SYSEMU
    125 
    126   /* Single step the process, the next syscall will not be executed.  */
    127   PTRACE_SYSEMU_SINGLESTEP = 32,
    128 #define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP
    129 
    130   /* Read MTE tags.  */
    131   PTRACE_PEEKMTETAGS = 33,
    132 #define PT_PEEKMTETAGS PTRACE_PEEKMTETAGS
    133 
    134   /* Write MTE tags.  */
    135   PTRACE_POKEMTETAGS = 34,
    136 #define PT_POKEMTETAGS PTRACE_POKEMTETAGS
    137 
    138   /* Set ptrace filter options.  */
    139   PTRACE_SETOPTIONS = 0x4200,
    140 #define PT_SETOPTIONS PTRACE_SETOPTIONS
    141 
    142   /* Get last ptrace message.  */
    143   PTRACE_GETEVENTMSG = 0x4201,
    144 #define PT_GETEVENTMSG PTRACE_GETEVENTMSG
    145 
    146   /* Get siginfo for process.  */
    147   PTRACE_GETSIGINFO = 0x4202,
    148 #define PT_GETSIGINFO PTRACE_GETSIGINFO
    149 
    150   /* Set new siginfo for process.  */
    151   PTRACE_SETSIGINFO = 0x4203,
    152 #define PT_SETSIGINFO PTRACE_SETSIGINFO
    153 
    154   /* Get register content.  */
    155   PTRACE_GETREGSET = 0x4204,
    156 #define PTRACE_GETREGSET PTRACE_GETREGSET
    157 
    158   /* Set register content.  */
    159   PTRACE_SETREGSET = 0x4205,
    160 #define PTRACE_SETREGSET PTRACE_SETREGSET
    161 
    162   /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect
    163      signal or group stop state.  */
    164   PTRACE_SEIZE = 0x4206,
    165 #define PTRACE_SEIZE PTRACE_SEIZE
    166 
    167   /* Trap seized tracee.  */
    168   PTRACE_INTERRUPT = 0x4207,
    169 #define PTRACE_INTERRUPT PTRACE_INTERRUPT
    170 
    171   /* Wait for next group event.  */
    172   PTRACE_LISTEN = 0x4208,
    173 #define PTRACE_LISTEN PTRACE_LISTEN
    174 
    175   /* Retrieve siginfo_t structures without removing signals from a queue.  */
    176   PTRACE_PEEKSIGINFO = 0x4209,
    177 #define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO
    178 
    179   /* Get the mask of blocked signals.  */
    180   PTRACE_GETSIGMASK = 0x420a,
    181 #define PTRACE_GETSIGMASK PTRACE_GETSIGMASK
    182 
    183   /* Change the mask of blocked signals.  */
    184   PTRACE_SETSIGMASK = 0x420b,
    185 #define PTRACE_SETSIGMASK PTRACE_SETSIGMASK
    186 
    187   /* Get seccomp BPF filters.  */
    188   PTRACE_SECCOMP_GET_FILTER = 0x420c,
    189 #define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER
    190 
    191   /* Get seccomp BPF filter metadata.  */
    192   PTRACE_SECCOMP_GET_METADATA = 0x420d,
    193 #define PTRACE_SECCOMP_GET_METADATA PTRACE_SECCOMP_GET_METADATA
    194 
    195   /* Get information about system call.  */
    196   PTRACE_GET_SYSCALL_INFO = 0x420e,
    197 #define PTRACE_GET_SYSCALL_INFO PTRACE_GET_SYSCALL_INFO
    198 
    199   /* Get rseq configuration information.  */
    200   PTRACE_GET_RSEQ_CONFIGURATION = 0x420f,
    201 #define PTRACE_GET_RSEQ_CONFIGURATION PTRACE_GET_RSEQ_CONFIGURATION
    202 
    203   /* Set configuration for syscall user dispatch.  */
    204   PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG = 0x4210,
    205 #define PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG \
    206   PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG
    207 
    208   /* Get configuration for syscall user dispatch.  */
    209   PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG = 0x4211
    210 #define PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG \
    211   PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG
    212 };
    213 
    214 
    215 #include <bits/ptrace-shared.h>
    216 
    217 __END_DECLS
    218 
    219 #endif /* _SYS_PTRACE_H */