Blame sysdeps/generic/sys/ptrace.h

Packit 6c4009
/* `ptrace' debugger support interface.  Generic version; constants are common.
Packit 6c4009
   Copyright (C) 1991-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef	_PTRACE_H
Packit 6c4009
Packit 6c4009
#define	_PTRACE_H	1
Packit 6c4009
#include <features.h>
Packit 6c4009
Packit 6c4009
__BEGIN_DECLS
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Type of the REQUEST argument to `ptrace.'  */
Packit 6c4009
enum __ptrace_request
Packit 6c4009
{
Packit 6c4009
  /* Indicate that the process making this request should be traced.
Packit 6c4009
     All signals received by this process can be intercepted by its
Packit 6c4009
     parent, and its parent can use the other `ptrace' requests.  */
Packit 6c4009
  PTRACE_TRACEME = 0,
Packit 6c4009
#define PT_TRACE_ME PTRACE_TRACEME
Packit 6c4009
Packit 6c4009
  /* Return the word in the process's text space at address ADDR.  */
Packit 6c4009
  PTRACE_PEEKTEXT,
Packit 6c4009
#define PT_READ_I PTRACE_PEEKTEXT
Packit 6c4009
Packit 6c4009
  /* Return the word in the process's data space at address ADDR.  */
Packit 6c4009
  PTRACE_PEEKDATA,
Packit 6c4009
#define PT_READ_D PTRACE_PEEKDATA
Packit 6c4009
Packit 6c4009
  /* Return the word in the process's user area at offset ADDR.  */
Packit 6c4009
  PTRACE_PEEKUSER,
Packit 6c4009
#define PT_READ_U PTRACE_PEEKUSER
Packit 6c4009
Packit 6c4009
  /* Write the word DATA into the process's text space at address ADDR.  */
Packit 6c4009
  PTRACE_POKETEXT,
Packit 6c4009
#define PT_WRITE_I PTRACE_POKETEXT
Packit 6c4009
Packit 6c4009
  /* Write the word DATA into the process's data space at address ADDR.  */
Packit 6c4009
  PTRACE_POKEDATA,
Packit 6c4009
#define PT_WRITE_D PTRACE_POKEDATA
Packit 6c4009
Packit 6c4009
  /* Write the word DATA into the process's user space at offset ADDR.  */
Packit 6c4009
  PTRACE_POKEUSER,
Packit 6c4009
#define PT_WRITE_U PTRACE_POKEUSER
Packit 6c4009
Packit 6c4009
  /* Continue the process.  */
Packit 6c4009
  PTRACE_CONT,
Packit 6c4009
#define PT_CONTINUE PTRACE_CONT
Packit 6c4009
Packit 6c4009
  /* Kill the process.  */
Packit 6c4009
  PTRACE_KILL,
Packit 6c4009
#define PT_KILL PTRACE_KILL
Packit 6c4009
Packit 6c4009
  /* Single step the process.
Packit 6c4009
     This is not supported on all machines.  */
Packit 6c4009
  PTRACE_SINGLESTEP,
Packit 6c4009
#define PT_STEP PTRACE_SINGLESTEP
Packit 6c4009
Packit 6c4009
  /* Attach to a process that is already running. */
Packit 6c4009
  PTRACE_ATTACH,
Packit 6c4009
#define PT_ATTACH PTRACE_ATTACH
Packit 6c4009
Packit 6c4009
  /* Detach from a process attached to with PTRACE_ATTACH.  */
Packit 6c4009
  PTRACE_DETACH,
Packit 6c4009
#define PT_DETACH PTRACE_DETACH
Packit 6c4009
Packit 6c4009
  /* Get the process's registers (not including floating-point registers)
Packit 6c4009
     and put them in the `struct regs' (see <machine/regs.h>) at ADDR.  */
Packit 6c4009
  PTRACE_GETREGS = 12,
Packit 6c4009
Packit 6c4009
  /* Set the process's registers (not including floating-point registers)
Packit 6c4009
     to the contents of the `struct regs' (see <machine/regs.h>) at ADDR.  */
Packit 6c4009
  PTRACE_SETREGS,
Packit 6c4009
Packit 6c4009
  /* Get the process's floating point registers and put them
Packit 6c4009
     in the `struct fp_status' (see <machine/regs.h>) at ADDR.  */
Packit 6c4009
  PTRACE_GETFPREGS = 14,
Packit 6c4009
Packit 6c4009
  /* Set the process's floating point registers to the contents
Packit 6c4009
     of the `struct fp_status' (see <machine/regs.h>) at ADDR.  */
Packit 6c4009
  PTRACE_SETFPREGS,
Packit 6c4009
Packit 6c4009
  /* Read DATA bytes from the process's data space at address ADDR.
Packit 6c4009
     Put the result starting at address ADDR2 in the caller's
Packit 6c4009
     address space.  */
Packit 6c4009
  PTRACE_READDATA = 16,
Packit 6c4009
Packit 6c4009
  /* Write DATA bytes from ADDR2 in the caller's address space into
Packit 6c4009
     the process's data space at address ADDR.  */
Packit 6c4009
  PTRACE_WRITEDATA,
Packit 6c4009
Packit 6c4009
  /* Read DATA bytes from the process's text space at address ADDR.
Packit 6c4009
     Put the result starting at address ADDR2 in the caller's
Packit 6c4009
     address space.  */
Packit 6c4009
  PTRACE_READTEXT = 18,
Packit 6c4009
Packit 6c4009
  /* Write DATA bytes from ADDR2 in the caller's address space into
Packit 6c4009
     the process's text space at address ADDR.  */
Packit 6c4009
  PTRACE_WRITETEXT,
Packit 6c4009
Packit 6c4009
  /* Read the floating-point accelerator unit registers and
Packit 6c4009
     put them into the `struct fpa_regs' (see <machine/regs.h>) at ADDR.  */
Packit 6c4009
  PTRACE_GETFPAREGS = 20,
Packit 6c4009
Packit 6c4009
  /* Write the floating-point accelerator unit registers from
Packit 6c4009
     the contents of the `struct fpa_regs' at ADDR.  */
Packit 6c4009
  PTRACE_SETFPAREGS
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/* Perform process tracing functions.  REQUEST is one of the values
Packit 6c4009
   above, and determines the action to be taken.
Packit 6c4009
   For all requests except PTRACE_TRACEME, PID specifies the process to be
Packit 6c4009
   traced.
Packit 6c4009
Packit 6c4009
   PID and the other arguments described above for the various requests should
Packit 6c4009
   appear (those that are used for the particular request) as:
Packit 6c4009
     pid_t PID, void *ADDR, int DATA, void *ADDR2
Packit 6c4009
   after REQUEST.  */
Packit 6c4009
extern int ptrace (enum __ptrace_request __request, ...);
Packit 6c4009
Packit 6c4009
__END_DECLS
Packit 6c4009
Packit 6c4009
#endif /* ptrace.h */