root/sys/ptrace.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. ptrace_event_t
  2. ptrace_state_t

    1 /*      $OpenBSD: ptrace.h,v 1.10 2005/12/11 21:30:31 miod Exp $        */
    2 /*      $NetBSD: ptrace.h,v 1.21 1996/02/09 18:25:26 christos Exp $     */
    3 
    4 /*-
    5  * Copyright (c) 1984, 1993
    6  *      The Regents of the University of California.  All rights reserved.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  * 3. Neither the name of the University nor the names of its contributors
   17  *    may be used to endorse or promote products derived from this software
   18  *    without specific prior written permission.
   19  *
   20  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   30  * SUCH DAMAGE.
   31  *
   32  *      @(#)ptrace.h    8.2 (Berkeley) 1/4/94
   33  */
   34 
   35 #ifndef _SYS_PTRACE_H_
   36 #define _SYS_PTRACE_H_
   37 
   38 #define PT_TRACE_ME     0       /* child declares it's being traced */
   39 #define PT_READ_I       1       /* read word in child's I space */
   40 #define PT_READ_D       2       /* read word in child's D space */
   41 #define PT_WRITE_I      4       /* write word in child's I space */
   42 #define PT_WRITE_D      5       /* write word in child's D space */
   43 #define PT_CONTINUE     7       /* continue the child */
   44 #define PT_KILL         8       /* kill the child process */
   45 #define PT_ATTACH       9       /* attach to running process */
   46 #define PT_DETACH       10      /* detach from running process */
   47 #define PT_IO           11      /* do I/O to/from the stopped process. */
   48 
   49 struct ptrace_io_desc {
   50         int     piod_op;        /* I/O operation */
   51         void    *piod_offs;     /* child offset */
   52         void    *piod_addr;     /* parent offset */
   53         size_t  piod_len;       /* request length */
   54 };
   55 
   56 /*
   57  * Operations in piod_op.
   58  */
   59 #define PIOD_READ_D     1       /* Read from D space */
   60 #define PIOD_WRITE_D    2       /* Write to D space */
   61 #define PIOD_READ_I     3       /* Read from I space */
   62 #define PIOD_WRITE_I    4       /* Write to I space */
   63 
   64 #define PT_SET_EVENT_MASK       12
   65 #define PT_GET_EVENT_MASK       13
   66 
   67 typedef struct ptrace_event {
   68         int     pe_set_event;
   69 } ptrace_event_t;
   70 
   71 #define PTRACE_FORK     0x0002  /* Report forks */
   72 
   73 #define PT_GET_PROCESS_STATE    14
   74 
   75 typedef struct ptrace_state {
   76         int     pe_report_event;
   77         pid_t   pe_other_pid;
   78 } ptrace_state_t;
   79 
   80 #define PT_FIRSTMACH    32      /* for machine-specific requests */
   81 #include <machine/ptrace.h>     /* machine-specific requests, if any */
   82 
   83 #ifdef _KERNEL
   84 
   85 /*
   86  * There is a bunch of PT_ requests that are machine dependent, but not
   87  * optional. Check if they were defined by MD code here.
   88  */
   89 #if !defined(PT_GETREGS) || !defined(PT_SETREGS)
   90 #error Machine dependent ptrace not complete.
   91 #endif
   92 
   93 struct reg;
   94 #if defined(PT_GETFPREGS) || defined(PT_SETFPREGS)
   95 struct fpreg;
   96 #endif
   97 
   98 void    proc_reparent(struct proc *child, struct proc *newparent);
   99 #ifdef PT_GETFPREGS
  100 int     process_read_fpregs(struct proc *p, struct fpreg *regs);
  101 #endif
  102 int     process_read_regs(struct proc *p, struct reg *regs);
  103 int     process_set_pc(struct proc *p, caddr_t addr);
  104 int     process_sstep(struct proc *p, int sstep);
  105 #ifdef PT_SETFPREGS
  106 int     process_write_fpregs(struct proc *p, struct fpreg *regs);
  107 #endif
  108 int     process_write_regs(struct proc *p, struct reg *regs);
  109 int     process_checkioperm(struct proc *, struct proc *);
  110 int     process_domem(struct proc *, struct proc *, struct uio *, int);
  111 
  112 #ifndef FIX_SSTEP
  113 #define FIX_SSTEP(p)
  114 #endif
  115 
  116 #else /* !_KERNEL */
  117 
  118 #include <sys/cdefs.h>
  119 
  120 __BEGIN_DECLS
  121 int     ptrace(int _request, pid_t _pid, caddr_t _addr, int _data);
  122 __END_DECLS
  123 
  124 #endif /* !_KERNEL */
  125 
  126 #endif  /* !_SYS_PTRACE_H_ */

/* [<][>][^][v][top][bottom][index][help] */