The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/ptrace.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 1984, 1993
    3  *      The Regents of the University of California.  All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  * 4. Neither the name of the University nor the names of its contributors
   14  *    may be used to endorse or promote products derived from this software
   15  *    without specific prior written permission.
   16  *
   17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   27  * SUCH DAMAGE.
   28  *
   29  *      @(#)ptrace.h    8.2 (Berkeley) 1/4/94
   30  * $FreeBSD: releng/8.2/sys/sys/ptrace.h 214756 2010-11-03 21:24:21Z kib $
   31  */
   32 
   33 #ifndef _SYS_PTRACE_H_
   34 #define _SYS_PTRACE_H_
   35 
   36 #include <sys/signal.h>
   37 #include <machine/reg.h>
   38 
   39 #define PT_TRACE_ME     0       /* child declares it's being traced */
   40 #define PT_READ_I       1       /* read word in child's I space */
   41 #define PT_READ_D       2       /* read word in child's D space */
   42 /* was  PT_READ_U       3        * read word in child's user structure */
   43 #define PT_WRITE_I      4       /* write word in child's I space */
   44 #define PT_WRITE_D      5       /* write word in child's D space */
   45 /* was  PT_WRITE_U      6        * write word in child's user structure */
   46 #define PT_CONTINUE     7       /* continue the child */
   47 #define PT_KILL         8       /* kill the child process */
   48 #define PT_STEP         9       /* single step the child */
   49 
   50 #define PT_ATTACH       10      /* trace some running process */
   51 #define PT_DETACH       11      /* stop tracing a process */
   52 #define PT_IO           12      /* do I/O to/from stopped process. */
   53 #define PT_LWPINFO      13      /* Info about the LWP that stopped. */
   54 #define PT_GETNUMLWPS   14      /* get total number of threads */
   55 #define PT_GETLWPLIST   15      /* get thread list */
   56 #define PT_CLEARSTEP    16      /* turn off single step */
   57 #define PT_SETSTEP      17      /* turn on single step */
   58 #define PT_SUSPEND      18      /* suspend a thread */
   59 #define PT_RESUME       19      /* resume a thread */
   60 
   61 #define PT_TO_SCE       20
   62 #define PT_TO_SCX       21
   63 #define PT_SYSCALL      22
   64 
   65 #define PT_GETREGS      33      /* get general-purpose registers */
   66 #define PT_SETREGS      34      /* set general-purpose registers */
   67 #define PT_GETFPREGS    35      /* get floating-point registers */
   68 #define PT_SETFPREGS    36      /* set floating-point registers */
   69 #define PT_GETDBREGS    37      /* get debugging registers */
   70 #define PT_SETDBREGS    38      /* set debugging registers */
   71 
   72 #define PT_VM_TIMESTAMP 40      /* Get VM version (timestamp) */
   73 #define PT_VM_ENTRY     41      /* Get VM map (entry) */
   74 
   75 #define PT_FIRSTMACH    64      /* for machine-specific requests */
   76 #include <machine/ptrace.h>     /* machine-specific requests, if any */
   77 
   78 struct ptrace_io_desc {
   79         int     piod_op;        /* I/O operation */
   80         void    *piod_offs;     /* child offset */
   81         void    *piod_addr;     /* parent offset */
   82         size_t  piod_len;       /* request length */
   83 };
   84 
   85 /*
   86  * Operations in piod_op.
   87  */
   88 #define PIOD_READ_D     1       /* Read from D space */
   89 #define PIOD_WRITE_D    2       /* Write to D space */
   90 #define PIOD_READ_I     3       /* Read from I space */
   91 #define PIOD_WRITE_I    4       /* Write to I space */
   92 
   93 /* Argument structure for PT_LWPINFO. */
   94 struct ptrace_lwpinfo {
   95         lwpid_t pl_lwpid;       /* LWP described. */
   96         int     pl_event;       /* Event that stopped the LWP. */
   97 #define PL_EVENT_NONE   0
   98 #define PL_EVENT_SIGNAL 1
   99         int     pl_flags;       /* LWP flags. */
  100 #define PL_FLAG_SA      0x01    /* M:N thread */
  101 #define PL_FLAG_BOUND   0x02    /* M:N bound thread */
  102 #define PL_FLAG_SCE     0x04    /* syscall enter point */
  103 #define PL_FLAG_SCX     0x08    /* syscall leave point */
  104 #define PL_FLAG_EXEC    0x10    /* exec(2) succeeded */
  105 #define PL_FLAG_SI      0x20    /* siginfo is valid */
  106         sigset_t        pl_sigmask;     /* LWP signal mask */
  107         sigset_t        pl_siglist;     /* LWP pending signal */
  108         struct __siginfo pl_siginfo;    /* siginfo for signal */
  109 };
  110 
  111 /* Argument structure for PT_VM_ENTRY. */
  112 struct ptrace_vm_entry {
  113         int             pve_entry;      /* Entry number used for iteration. */
  114         int             pve_timestamp;  /* Generation number of VM map. */
  115         u_long          pve_start;      /* Start VA of range. */
  116         u_long          pve_end;        /* End VA of range (incl). */
  117         u_long          pve_offset;     /* Offset in backing object. */
  118         u_int           pve_prot;       /* Protection of memory range. */
  119         u_int           pve_pathlen;    /* Size of path. */
  120         long            pve_fileid;     /* File ID. */
  121         uint32_t        pve_fsid;       /* File system ID. */
  122         char            *pve_path;      /* Path name of object. */
  123 };
  124 
  125 #ifdef _KERNEL
  126 
  127 #define PTRACESTOP_SC(p, td, flag)                              \
  128         if ((p)->p_flag & P_TRACED && (p)->p_stops & (flag)) {  \
  129                 PROC_LOCK(p);                                   \
  130                 ptracestop((td), SIGTRAP);                      \
  131                 PROC_UNLOCK(p);                                 \
  132         }
  133 /*
  134  * The flags below are used for ptrace(2) tracing and have no relation
  135  * to procfs.  They are stored in struct proc's p_stops member.
  136  */
  137 #define S_PT_SCE        0x000010000
  138 #define S_PT_SCX        0x000020000
  139 
  140 int     ptrace_set_pc(struct thread *_td, unsigned long _addr);
  141 int     ptrace_single_step(struct thread *_td);
  142 int     ptrace_clear_single_step(struct thread *_td);
  143 
  144 #ifdef __HAVE_PTRACE_MACHDEP
  145 int     cpu_ptrace(struct thread *_td, int _req, void *_addr, int _data);
  146 #endif
  147 
  148 /*
  149  * These are prototypes for functions that implement some of the
  150  * debugging functionality exported by procfs / linprocfs and by the
  151  * ptrace(2) syscall.  They used to be part of procfs, but they don't
  152  * really belong there.
  153  */
  154 struct reg;
  155 struct fpreg;
  156 struct dbreg;
  157 struct uio;
  158 int     proc_read_regs(struct thread *_td, struct reg *_reg);
  159 int     proc_write_regs(struct thread *_td, struct reg *_reg);
  160 int     proc_read_fpregs(struct thread *_td, struct fpreg *_fpreg);
  161 int     proc_write_fpregs(struct thread *_td, struct fpreg *_fpreg);
  162 int     proc_read_dbregs(struct thread *_td, struct dbreg *_dbreg);
  163 int     proc_write_dbregs(struct thread *_td, struct dbreg *_dbreg);
  164 int     proc_sstep(struct thread *_td);
  165 int     proc_rwmem(struct proc *_p, struct uio *_uio);
  166 #ifdef COMPAT_FREEBSD32
  167 struct reg32;
  168 struct fpreg32;
  169 struct dbreg32;
  170 int     proc_read_regs32(struct thread *_td, struct reg32 *_reg32);
  171 int     proc_write_regs32(struct thread *_td, struct reg32 *_reg32);
  172 int     proc_read_fpregs32(struct thread *_td, struct fpreg32 *_fpreg32);
  173 int     proc_write_fpregs32(struct thread *_td, struct fpreg32 *_fpreg32);
  174 int     proc_read_dbregs32(struct thread *_td, struct dbreg32 *_dbreg32);
  175 int     proc_write_dbregs32(struct thread *_td, struct dbreg32 *_dbreg32);
  176 #endif
  177 #else /* !_KERNEL */
  178 
  179 #include <sys/cdefs.h>
  180 
  181 __BEGIN_DECLS
  182 int     ptrace(int _request, pid_t _pid, caddr_t _addr, int _data);
  183 __END_DECLS
  184 
  185 #endif /* !_KERNEL */
  186 
  187 #endif  /* !_SYS_PTRACE_H_ */

Cache object: 6b938c8823493712ea67f83f137844e5


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.