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