(root)/
glibc-2.38/
sysdeps/
generic/
sys/
ptrace.h
       1  /* `ptrace' debugger support interface.  Generic version; constants are common.
       2     Copyright (C) 1991-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	_PTRACE_H
      20  
      21  #define	_PTRACE_H	1
      22  #include <features.h>
      23  
      24  __BEGIN_DECLS
      25  
      26  
      27  /* Type of the REQUEST argument to `ptrace.'  */
      28  enum __ptrace_request
      29  {
      30    /* Indicate that the process making this request should be traced.
      31       All signals received by this process can be intercepted by its
      32       parent, and its parent can use the other `ptrace' requests.  */
      33    PTRACE_TRACEME = 0,
      34  #define PT_TRACE_ME PTRACE_TRACEME
      35  
      36    /* Return the word in the process's text space at address ADDR.  */
      37    PTRACE_PEEKTEXT,
      38  #define PT_READ_I PTRACE_PEEKTEXT
      39  
      40    /* Return the word in the process's data space at address ADDR.  */
      41    PTRACE_PEEKDATA,
      42  #define PT_READ_D PTRACE_PEEKDATA
      43  
      44    /* Return the word in the process's user area at offset ADDR.  */
      45    PTRACE_PEEKUSER,
      46  #define PT_READ_U PTRACE_PEEKUSER
      47  
      48    /* Write the word DATA into the process's text space at address ADDR.  */
      49    PTRACE_POKETEXT,
      50  #define PT_WRITE_I PTRACE_POKETEXT
      51  
      52    /* Write the word DATA into the process's data space at address ADDR.  */
      53    PTRACE_POKEDATA,
      54  #define PT_WRITE_D PTRACE_POKEDATA
      55  
      56    /* Write the word DATA into the process's user space at offset ADDR.  */
      57    PTRACE_POKEUSER,
      58  #define PT_WRITE_U PTRACE_POKEUSER
      59  
      60    /* Continue the process.  */
      61    PTRACE_CONT,
      62  #define PT_CONTINUE PTRACE_CONT
      63  
      64    /* Kill the process.  */
      65    PTRACE_KILL,
      66  #define PT_KILL PTRACE_KILL
      67  
      68    /* Single step the process.
      69       This is not supported on all machines.  */
      70    PTRACE_SINGLESTEP,
      71  #define PT_STEP PTRACE_SINGLESTEP
      72  
      73    /* Attach to a process that is already running. */
      74    PTRACE_ATTACH,
      75  #define PT_ATTACH PTRACE_ATTACH
      76  
      77    /* Detach from a process attached to with PTRACE_ATTACH.  */
      78    PTRACE_DETACH,
      79  #define PT_DETACH PTRACE_DETACH
      80  
      81    /* Get the process's registers (not including floating-point registers)
      82       and put them in the `struct regs' (see <machine/regs.h>) at ADDR.  */
      83    PTRACE_GETREGS = 12,
      84  
      85    /* Set the process's registers (not including floating-point registers)
      86       to the contents of the `struct regs' (see <machine/regs.h>) at ADDR.  */
      87    PTRACE_SETREGS,
      88  
      89    /* Get the process's floating point registers and put them
      90       in the `struct fp_status' (see <machine/regs.h>) at ADDR.  */
      91    PTRACE_GETFPREGS = 14,
      92  
      93    /* Set the process's floating point registers to the contents
      94       of the `struct fp_status' (see <machine/regs.h>) at ADDR.  */
      95    PTRACE_SETFPREGS,
      96  
      97    /* Read DATA bytes from the process's data space at address ADDR.
      98       Put the result starting at address ADDR2 in the caller's
      99       address space.  */
     100    PTRACE_READDATA = 16,
     101  
     102    /* Write DATA bytes from ADDR2 in the caller's address space into
     103       the process's data space at address ADDR.  */
     104    PTRACE_WRITEDATA,
     105  
     106    /* Read DATA bytes from the process's text space at address ADDR.
     107       Put the result starting at address ADDR2 in the caller's
     108       address space.  */
     109    PTRACE_READTEXT = 18,
     110  
     111    /* Write DATA bytes from ADDR2 in the caller's address space into
     112       the process's text space at address ADDR.  */
     113    PTRACE_WRITETEXT,
     114  
     115    /* Read the floating-point accelerator unit registers and
     116       put them into the `struct fpa_regs' (see <machine/regs.h>) at ADDR.  */
     117    PTRACE_GETFPAREGS = 20,
     118  
     119    /* Write the floating-point accelerator unit registers from
     120       the contents of the `struct fpa_regs' at ADDR.  */
     121    PTRACE_SETFPAREGS
     122  };
     123  
     124  /* Perform process tracing functions.  REQUEST is one of the values
     125     above, and determines the action to be taken.
     126     For all requests except PTRACE_TRACEME, PID specifies the process to be
     127     traced.
     128  
     129     PID and the other arguments described above for the various requests should
     130     appear (those that are used for the particular request) as:
     131       pid_t PID, void *ADDR, int DATA, void *ADDR2
     132     after REQUEST.  */
     133  extern int ptrace (enum __ptrace_request __request, ...);
     134  
     135  __END_DECLS
     136  
     137  #endif /* ptrace.h */