]> CyberLeo.Net >> Repos - FreeBSD/releng/10.3.git/blob - lib/libc/sys/ptrace.2
- Copy stable/10@296371 to releng/10.3 in preparation for 10.3-RC1
[FreeBSD/releng/10.3.git] / lib / libc / sys / ptrace.2
1 .\" $FreeBSD$
2 .\"     $NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $
3 .\"
4 .\" This file is in the public domain.
5 .Dd October 20, 2015
6 .Dt PTRACE 2
7 .Os
8 .Sh NAME
9 .Nm ptrace
10 .Nd process tracing and debugging
11 .Sh LIBRARY
12 .Lb libc
13 .Sh SYNOPSIS
14 .In sys/types.h
15 .In sys/ptrace.h
16 .Ft int
17 .Fn ptrace "int request" "pid_t pid" "caddr_t addr" "int data"
18 .Sh DESCRIPTION
19 The
20 .Fn ptrace
21 system call
22 provides tracing and debugging facilities.
23 It allows one process
24 (the
25 .Em tracing
26 process)
27 to control another
28 (the
29 .Em traced
30 process).
31 The tracing process must first attach to the traced process, and then
32 issue a series of
33 .Fn ptrace
34 system calls to control the execution of the process, as well as access
35 process memory and register state.
36 For the duration of the tracing session, the traced process will be
37 .Dq re-parented ,
38 with its parent process ID (and resulting behavior)
39 changed to the tracing process.
40 It is permissible for a tracing process to attach to more than one
41 other process at a time.
42 When the tracing process has completed its work, it must detach the
43 traced process; if a tracing process exits without first detaching all
44 processes it has attached, those processes will be killed.
45 .Pp
46 Most of the time, the traced process runs normally, but when it
47 receives a signal
48 (see
49 .Xr sigaction 2 ) ,
50 it stops.
51 The tracing process is expected to notice this via
52 .Xr wait 2
53 or the delivery of a
54 .Dv SIGCHLD
55 signal, examine the state of the stopped process, and cause it to
56 terminate or continue as appropriate.
57 The signal may be a normal process signal, generated as a result of
58 traced process behavior, or use of the
59 .Xr kill 2
60 system call; alternatively, it may be generated by the tracing facility
61 as a result of attaching, system calls, or stepping by the tracing
62 process.
63 The tracing process may choose to intercept the signal, using it to
64 observe process behavior (such as
65 .Dv SIGTRAP ) ,
66 or forward the signal to the process if appropriate.
67 The
68 .Fn ptrace
69 system call
70 is the mechanism by which all this happens.
71 .Pp
72 The
73 .Fa request
74 argument specifies what operation is being performed; the meaning of
75 the rest of the arguments depends on the operation, but except for one
76 special case noted below, all
77 .Fn ptrace
78 calls are made by the tracing process, and the
79 .Fa pid
80 argument specifies the process ID of the traced process
81 or a corresponding thread ID.
82 The
83 .Fa request
84 argument
85 can be:
86 .Bl -tag -width 12n
87 .It Dv PT_TRACE_ME
88 This request is the only one used by the traced process; it declares
89 that the process expects to be traced by its parent.
90 All the other arguments are ignored.
91 (If the parent process does not expect to trace the child, it will
92 probably be rather confused by the results; once the traced process
93 stops, it cannot be made to continue except via
94 .Fn ptrace . )
95 When a process has used this request and calls
96 .Xr execve 2
97 or any of the routines built on it
98 (such as
99 .Xr execv 3 ) ,
100 it will stop before executing the first instruction of the new image.
101 Also, any setuid or setgid bits on the executable being executed will
102 be ignored.
103 If the child was created by
104 .Xr vfork 2
105 system call or
106 .Xr rfork(2)
107 call with the
108 .Dv RFMEM
109 flag specified, the debugging events are reported to the parent
110 only after the
111 .Xr execve 2
112 is executed.
113 .It Dv PT_READ_I , Dv PT_READ_D
114 These requests read a single
115 .Vt int
116 of data from the traced process's address space.
117 Traditionally,
118 .Fn ptrace
119 has allowed for machines with distinct address spaces for instruction
120 and data, which is why there are two requests: conceptually,
121 .Dv PT_READ_I
122 reads from the instruction space and
123 .Dv PT_READ_D
124 reads from the data space.
125 In the current
126 .Fx
127 implementation, these two requests are completely identical.
128 The
129 .Fa addr
130 argument specifies the address
131 (in the traced process's virtual address space)
132 at which the read is to be done.
133 This address does not have to meet any alignment constraints.
134 The value read is returned as the return value from
135 .Fn ptrace .
136 .It Dv PT_WRITE_I , Dv PT_WRITE_D
137 These requests parallel
138 .Dv PT_READ_I
139 and
140 .Dv PT_READ_D ,
141 except that they write rather than read.
142 The
143 .Fa data
144 argument supplies the value to be written.
145 .It Dv PT_IO
146 This request allows reading and writing arbitrary amounts of data in
147 the traced process's address space.
148 The
149 .Fa addr
150 argument specifies a pointer to a
151 .Vt "struct ptrace_io_desc" ,
152 which is defined as follows:
153 .Bd -literal
154 struct ptrace_io_desc {
155         int     piod_op;        /* I/O operation */
156         void    *piod_offs;     /* child offset */
157         void    *piod_addr;     /* parent offset */
158         size_t  piod_len;       /* request length */
159 };
160
161 /*
162  * Operations in piod_op.
163  */
164 #define PIOD_READ_D     1       /* Read from D space */
165 #define PIOD_WRITE_D    2       /* Write to D space */
166 #define PIOD_READ_I     3       /* Read from I space */
167 #define PIOD_WRITE_I    4       /* Write to I space */
168 .Ed
169 .Pp
170 The
171 .Fa data
172 argument is ignored.
173 The actual number of bytes read or written is stored in
174 .Va piod_len
175 upon return.
176 .It Dv PT_CONTINUE
177 The traced process continues execution.
178 The
179 .Fa addr
180 argument
181 is an address specifying the place where execution is to be resumed
182 (a new value for the program counter),
183 or
184 .Po Vt caddr_t Pc Ns 1
185 to indicate that execution is to pick up where it left off.
186 The
187 .Fa data
188 argument
189 provides a signal number to be delivered to the traced process as it
190 resumes execution, or 0 if no signal is to be sent.
191 .It Dv PT_STEP
192 The traced process is single stepped one instruction.
193 The
194 .Fa addr
195 argument
196 should be passed
197 .Po Vt caddr_t Pc Ns 1 .
198 The
199 .Fa data
200 argument
201 provides a signal number to be delivered to the traced process as it
202 resumes execution, or 0 if no signal is to be sent.
203 .It Dv PT_KILL
204 The traced process terminates, as if
205 .Dv PT_CONTINUE
206 had been used with
207 .Dv SIGKILL
208 given as the signal to be delivered.
209 .It Dv PT_ATTACH
210 This request allows a process to gain control of an otherwise
211 unrelated process and begin tracing it.
212 It does not need any cooperation from the to-be-traced process.
213 In
214 this case,
215 .Fa pid
216 specifies the process ID of the to-be-traced process, and the other
217 two arguments are ignored.
218 This request requires that the target process must have the same real
219 UID as the tracing process, and that it must not be executing a setuid
220 or setgid executable.
221 (If the tracing process is running as root, these restrictions do not
222 apply.)
223 The tracing process will see the newly-traced process stop and may
224 then control it as if it had been traced all along.
225 .It Dv PT_DETACH
226 This request is like PT_CONTINUE, except that it does not allow
227 specifying an alternate place to continue execution, and after it
228 succeeds, the traced process is no longer traced and continues
229 execution normally.
230 .It Dv PT_GETREGS
231 This request reads the traced process's machine registers into the
232 .Do
233 .Vt "struct reg"
234 .Dc
235 (defined in
236 .In machine/reg.h )
237 pointed to by
238 .Fa addr .
239 .It Dv PT_SETREGS
240 This request is the converse of
241 .Dv PT_GETREGS ;
242 it loads the traced process's machine registers from the
243 .Do
244 .Vt "struct reg"
245 .Dc
246 (defined in
247 .In machine/reg.h )
248 pointed to by
249 .Fa addr .
250 .It Dv PT_GETFPREGS
251 This request reads the traced process's floating-point registers into
252 the
253 .Do
254 .Vt "struct fpreg"
255 .Dc
256 (defined in
257 .In machine/reg.h )
258 pointed to by
259 .Fa addr .
260 .It Dv PT_SETFPREGS
261 This request is the converse of
262 .Dv PT_GETFPREGS ;
263 it loads the traced process's floating-point registers from the
264 .Do
265 .Vt "struct fpreg"
266 .Dc
267 (defined in
268 .In machine/reg.h )
269 pointed to by
270 .Fa addr .
271 .It Dv PT_GETDBREGS
272 This request reads the traced process's debug registers into
273 the
274 .Do
275 .Vt "struct dbreg"
276 .Dc
277 (defined in
278 .In machine/reg.h )
279 pointed to by
280 .Fa addr .
281 .It Dv PT_SETDBREGS
282 This request is the converse of
283 .Dv PT_GETDBREGS ;
284 it loads the traced process's debug registers from the
285 .Do
286 .Vt "struct dbreg"
287 .Dc
288 (defined in
289 .In machine/reg.h )
290 pointed to by
291 .Fa addr .
292 .It Dv PT_LWPINFO
293 This request can be used to obtain information about the kernel thread,
294 also known as light-weight process, that caused the traced process to stop.
295 The
296 .Fa addr
297 argument specifies a pointer to a
298 .Vt "struct ptrace_lwpinfo" ,
299 which is defined as follows:
300 .Bd -literal
301 struct ptrace_lwpinfo {
302         lwpid_t pl_lwpid;
303         int     pl_event;
304         int     pl_flags;
305         sigset_t pl_sigmask;
306         sigset_t pl_siglist;
307         siginfo_t pl_siginfo;
308         char    pl_tdname[MAXCOMLEN + 1];
309         pid_t   pl_child_pid;
310         u_int   pl_syscall_code;
311         u_int   pl_syscall_narg;
312 };
313 .Ed
314 .Pp
315 The
316 .Fa data
317 argument is to be set to the size of the structure known to the caller.
318 This allows the structure to grow without affecting older programs.
319 .Pp
320 The fields in the
321 .Vt "struct ptrace_lwpinfo"
322 have the following meaning:
323 .Bl -tag -width indent -compact
324 .It pl_lwpid
325 LWP id of the thread
326 .It pl_event
327 Event that caused the stop.
328 Currently defined events are
329 .Bl -tag -width indent -compact
330 .It PL_EVENT_NONE
331 No reason given
332 .It PL_EVENT_SIGNAL
333 Thread stopped due to the pending signal
334 .El
335 .It pl_flags
336 Flags that specify additional details about observed stop.
337 Currently defined flags are:
338 .Bl -tag -width indent -compact
339 .It PL_FLAG_SCE
340 The thread stopped due to system call entry, right after the kernel is entered.
341 The debugger may examine syscall arguments that are stored in memory and
342 registers according to the ABI of the current process, and modify them,
343 if needed.
344 .It PL_FLAG_SCX
345 The thread is stopped immediately before syscall is returning to the usermode.
346 The debugger may examine system call return values in the ABI-defined registers
347 and/or memory.
348 .It PL_FLAG_EXEC
349 When
350 .Dv PL_FLAG_SCX
351 is set, this flag may be additionally specified to inform that the
352 program being executed by debuggee process has been changed by successful
353 execution of a system call from the
354 .Fn execve 2
355 family.
356 .It PL_FLAG_SI
357 Indicates that
358 .Va pl_siginfo
359 member of
360 .Vt "struct ptrace_lwpinfo"
361 contains valid information.
362 .It PL_FLAG_FORKED
363 Indicates that the process is returning from a call to
364 .Fn fork 2
365 that created a new child process.
366 The process identifier of the new process is available in the
367 .Va pl_child_pid
368 member of
369 .Vt "struct ptrace_lwpinfo" .
370 .It PL_FLAG_CHILD
371 The flag is set for first event reported from a new child, which is
372 automatically attached due to
373 .Dv PT_FOLLOW_FORK
374 enabled.
375 .El
376 .It pl_sigmask
377 The current signal mask of the LWP
378 .It pl_siglist
379 The current pending set of signals for the LWP.
380 Note that signals that are delivered to the process would not appear
381 on an LWP siglist until the thread is selected for delivery.
382 .It pl_siginfo
383 The siginfo that accompanies the signal pending.
384 Only valid for
385 .Dv PL_EVENT_SIGNAL
386 stop when
387 .Dv PL_FLAG_SI
388 is set in
389 .Va pl_flags .
390 .It pl_tdname
391 The name of the thread.
392 .It pl_child_pid
393 The process identifier of the new child process.
394 Only valid for a
395 .Dv PL_EVENT_SIGNAL
396 stop when
397 .Dv PL_FLAG_FORKED
398 is set in
399 .Va pl_flags .
400 .It pl_syscall_code
401 The ABI-specific identifier of the current system call.
402 Note that for indirect system calls this field reports the indirected
403 system call.
404 Only valid when
405 .Dv PL_FLAG_SCE
406 or
407 .Dv PL_FLAG_SCX
408 is set in
409 .Va pl_flags.
410 .It pl_syscall_narg
411 The number of arguments passed to the current system call not counting
412 the system call identifier.
413 Note that for indirect system calls this field reports the arguments
414 passed to the indirected system call.
415 Only valid when
416 .Dv PL_FLAG_SCE
417 or
418 .Dv PL_FLAG_SCX
419 is set in
420 .Va pl_flags.
421 .El
422 .It PT_GETNUMLWPS
423 This request returns the number of kernel threads associated with the
424 traced process.
425 .It PT_GETLWPLIST
426 This request can be used to get the current thread list.
427 A pointer to an array of type
428 .Vt lwpid_t
429 should be passed in
430 .Fa addr ,
431 with the array size specified by
432 .Fa data .
433 The return value from
434 .Fn ptrace
435 is the count of array entries filled in.
436 .It PT_SETSTEP
437 This request will turn on single stepping of the specified process.
438 .It PT_CLEARSTEP
439 This request will turn off single stepping of the specified process.
440 .It PT_SUSPEND
441 This request will suspend the specified thread.
442 .It PT_RESUME
443 This request will resume the specified thread.
444 .It PT_TO_SCE
445 This request will trace the specified process on each system call entry.
446 .It PT_TO_SCX
447 This request will trace the specified process on each system call exit.
448 .It PT_SYSCALL
449 This request will trace the specified process
450 on each system call entry and exit.
451 .It PT_FOLLOW_FORK
452 This request controls tracing for new child processes of a traced process.
453 If
454 .Fa data
455 is non-zero,
456 then new child processes will enable tracing and stop before executing their
457 first instruction.
458 If
459 .Fa data
460 is zero, then new child processes will execute without tracing enabled.
461 By default, tracing is not enabled for new child processes.
462 Child processes do not inherit this property.
463 The traced process will set the
464 .Dv PL_FLAG_FORKED
465 flag upon exit from a system call that creates a new process.
466 .It PT_VM_TIMESTAMP
467 This request returns the generation number or timestamp of the memory map of
468 the traced process as the return value from
469 .Fn ptrace .
470 This provides a low-cost way for the tracing process to determine if the
471 VM map changed since the last time this request was made.
472 .It PT_VM_ENTRY
473 This request is used to iterate over the entries of the VM map of the traced
474 process.
475 The
476 .Fa addr
477 argument specifies a pointer to a
478 .Vt "struct ptrace_vm_entry" ,
479 which is defined as follows:
480 .Bd -literal
481 struct ptrace_vm_entry {
482         int             pve_entry;
483         int             pve_timestamp;
484         u_long          pve_start;
485         u_long          pve_end;
486         u_long          pve_offset;
487         u_int           pve_prot;
488         u_int           pve_pathlen;
489         long            pve_fileid;
490         uint32_t        pve_fsid;
491         char            *pve_path;
492 };
493 .Ed
494 .Pp
495 The first entry is returned by setting
496 .Va pve_entry
497 to zero.
498 Subsequent entries are returned by leaving
499 .Va pve_entry
500 unmodified from the value returned by previous requests.
501 The
502 .Va pve_timestamp
503 field can be used to detect changes to the VM map while iterating over the
504 entries.
505 The tracing process can then take appropriate action, such as restarting.
506 By setting
507 .Va pve_pathlen
508 to a non-zero value on entry, the pathname of the backing object is returned
509 in the buffer pointed to by
510 .Va pve_path ,
511 provided the entry is backed by a vnode.
512 The
513 .Va pve_pathlen
514 field is updated with the actual length of the pathname (including the
515 terminating null character).
516 The
517 .Va pve_offset
518 field is the offset within the backing object at which the range starts.
519 The range is located in the VM space at
520 .Va pve_start
521 and extends up to
522 .Va pve_end
523 (inclusive).
524 .Pp
525 The
526 .Fa data
527 argument is ignored.
528 .El
529 .Sh x86 MACHINE-SPECIFIC REQUESTS
530 .Bl -tag -width "Dv PT_GETXSTATE_INFO"
531 .It Dv PT_GETXMMREGS
532 Copy the XMM FPU state into the buffer pointed to by the
533 argument
534 .Fa addr .
535 The buffer has the same layout as the 32-bit save buffer for the
536 machine instruction
537 .Dv FXSAVE .
538 .Pp
539 This request is only valid for i386 programs, both on native 32-bit
540 systems and on amd64 kernels.
541 For 64-bit amd64 programs, the XMM state is reported as part of
542 the FPU state returned by the
543 .Dv PT_GETFPREGS
544 request.
545 .Pp
546 The
547 .Fa data
548 argument is ignored.
549 .It Dv PT_SETXMMREGS
550 Load the XMM FPU state for the thread from the buffer pointed to
551 by the argument
552 .Fa addr .
553 The buffer has the same layout as the 32-bit load buffer for the
554 machine instruction
555 .Dv FXRSTOR .
556 .Pp
557 As with
558 .Dv PT_GETXMMREGS,
559 this request is only valid for i386 programs.
560 .Pp
561 The
562 .Fa data
563 argument is ignored.
564 .It Dv PT_GETXSTATE_INFO
565 Report which XSAVE FPU extensions are supported by the CPU
566 and allowed in userspace programs.
567 The
568 .Fa addr
569 argument must point to a variable of type
570 .Vt struct ptrace_xstate_info ,
571 which contains the information on the request return.
572 .Vt struct ptrace_xstate_info
573 is defined as follows:
574 .Bd -literal
575 struct ptrace_xstate_info {
576         uint64_t        xsave_mask;
577         uint32_t        xsave_len;
578 };
579 .Ed
580 The
581 .Dv xsave_mask
582 field is a bitmask of the currently enabled extensions.
583 The meaning of the bits is defined in the Intel and AMD
584 processor documentation.
585 The
586 .Dv xsave_len
587 field reports the length of the XSAVE area for storing the hardware
588 state for currently enabled extensions in the format defined by the x86
589 .Dv XSAVE
590 machine instruction.
591 .Pp
592 The
593 .Fa data
594 argument value must be equal to the size of the
595 .Vt struct ptrace_xstate_info .
596 .It Dv PT_GETXSTATE
597 Return the content of the XSAVE area for the thread.
598 The
599 .Fa addr
600 argument points to the buffer where the content is copied, and the
601 .Fa data
602 argument specifies the size of the buffer.
603 The kernel copies out as much content as allowed by the buffer size.
604 The buffer layout is specified by the layout of the save area for the
605 .Dv XSAVE
606 machine instruction.
607 .It Dv PT_SETXSTATE
608 Load the XSAVE state for the thread from the buffer specified by the
609 .Fa addr
610 pointer.
611 The buffer size is passed in the
612 .Fa data
613 argument.
614 The buffer must be at least as large as the
615 .Vt struct savefpu
616 (defined in
617 .Pa x86/fpu.h )
618 to allow the complete x87 FPU and XMM state load.
619 It must not be larger than the XSAVE state length, as reported by the
620 .Dv xsave_len
621 field from the
622 .Vt struct ptrace_xstate_info
623 of the
624 .Dv PT_GETXSTATE_INFO
625 request.
626 Layout of the buffer is identical to the layout of the load area for the
627 .Dv XRSTOR
628 machine instruction.
629 .It Dv PT_GETFSBASE
630 Return the value of the base used when doing segmented
631 memory addressing using the %fs segment register.
632 The
633 .Fa addr
634 argument points to an
635 .Vt unsigned long
636 variable where the base value is stored.
637 .Pp
638 The
639 .Fa data
640 argument is ignored.
641 .It Dv PT_GETGSBASE
642 Like the
643 .Dv PT_GETFSBASE
644 request, but returns the base for the %gs segment register.
645 .It Dv PT_SETFSBASE
646 Set the base for the %fs segment register to the value pointed to
647 by the
648 .Fa addr
649 argument.
650 .Fa addr
651 must point to the
652 .Vt unsigned long
653 variable containing the new base.
654 .Pp
655 The
656 .Fa data
657 argument is ignored.
658 .It Dv PT_SETGSBASE
659 Like the
660 .Dv PT_SETFSBASE
661 request, but sets the base for the %gs segment register.
662 .El
663 .Sh PowerPC MACHINE-SPECIFIC REQUESTS
664 .Bl -tag -width "Dv PT_SETVRREGS"
665 .It Dv PT_GETVRREGS
666 Return the thread's
667 .Dv ALTIVEC
668 machine state in the buffer pointed to by
669 .Fa addr .
670 .Pp
671 The
672 .Fa data
673 argument is ignored.
674 .It Dv PT_SETVRREGS
675 Set the thread's
676 .Dv ALTIVEC
677 machine state from the buffer pointed to by
678 .Fa addr .
679 .Pp
680 The
681 .Fa data
682 argument is ignored.
683 .El
684 .Pp
685 Additionally, other machine-specific requests can exist.
686 .Sh RETURN VALUES
687 Some requests can cause
688 .Fn ptrace
689 to return
690 \-1
691 as a non-error value; to disambiguate,
692 .Va errno
693 can be set to 0 before the call and checked afterwards.
694 .Sh ERRORS
695 The
696 .Fn ptrace
697 system call may fail if:
698 .Bl -tag -width Er
699 .It Bq Er ESRCH
700 .Bl -bullet -compact
701 .It
702 No process having the specified process ID exists.
703 .El
704 .It Bq Er EINVAL
705 .Bl -bullet -compact
706 .It
707 A process attempted to use
708 .Dv PT_ATTACH
709 on itself.
710 .It
711 The
712 .Fa request
713 argument
714 was not one of the legal requests.
715 .It
716 The signal number
717 (in
718 .Fa data )
719 to
720 .Dv PT_CONTINUE
721 was neither 0 nor a legal signal number.
722 .It
723 .Dv PT_GETREGS ,
724 .Dv PT_SETREGS ,
725 .Dv PT_GETFPREGS ,
726 .Dv PT_SETFPREGS ,
727 .Dv PT_GETDBREGS ,
728 or
729 .Dv PT_SETDBREGS
730 was attempted on a process with no valid register set.
731 (This is normally true only of system processes.)
732 .It
733 .Dv PT_VM_ENTRY
734 was given an invalid value for
735 .Fa pve_entry .
736 This can also be caused by changes to the VM map of the process.
737 .It
738 The size (in
739 .Fa data )
740 provided to
741 .Dv PT_LWPINFO
742 was less than or equal to zero, or larger than the
743 .Vt ptrace_lwpinfo
744 structure known to the kernel.
745 .It
746 The size (in
747 .Fa data )
748 provided to the x86-specific
749 .Dv PT_GETXSTATE_INFO
750 request was not equal to the size of the
751 .Vt struct ptrace_xstate_info .
752 .It
753 The size (in
754 .Fa data )
755 provided to the x86-specific
756 .Dv PT_SETXSTATE
757 request was less than the size of the x87 plus the XMM save area.
758 .It
759 The size (in
760 .Fa data )
761 provided to the x86-specific
762 .Dv PT_SETXSTATE
763 request was larger than returned in the
764 .Dv xsave_len
765 member of the
766 .Vt struct ptrace_xstate_info
767 from the
768 .Dv PT_GETXSTATE_INFO
769 request.
770 .It
771 The base value, provided to the amd64-specific requests
772 .Dv PT_SETFSBASE
773 or
774 .Dv PT_SETGSBASE ,
775 pointed outside of the valid user address space.
776 This error will not occur in 32-bit programs.
777 .El
778 .It Bq Er EBUSY
779 .Bl -bullet -compact
780 .It
781 .Dv PT_ATTACH
782 was attempted on a process that was already being traced.
783 .It
784 A request attempted to manipulate a process that was being traced by
785 some process other than the one making the request.
786 .It
787 A request
788 (other than
789 .Dv PT_ATTACH )
790 specified a process that was not stopped.
791 .El
792 .It Bq Er EPERM
793 .Bl -bullet -compact
794 .It
795 A request
796 (other than
797 .Dv PT_ATTACH )
798 attempted to manipulate a process that was not being traced at all.
799 .It
800 An attempt was made to use
801 .Dv PT_ATTACH
802 on a process in violation of the requirements listed under
803 .Dv PT_ATTACH
804 above.
805 .El
806 .It Bq Er ENOENT
807 .Bl -bullet -compact
808 .It
809 .Dv PT_VM_ENTRY
810 previously returned the last entry of the memory map.
811 No more entries exist.
812 .El
813 .It Bq Er ENAMETOOLONG
814 .Bl -bullet -compact
815 .It
816 .Dv PT_VM_ENTRY
817 cannot return the pathname of the backing object because the buffer is not big
818 enough.
819 .Fa pve_pathlen
820 holds the minimum buffer size required on return.
821 .El
822 .El
823 .Sh SEE ALSO
824 .Xr execve 2 ,
825 .Xr sigaction 2 ,
826 .Xr wait 2 ,
827 .Xr execv 3 ,
828 .Xr i386_clr_watch 3 ,
829 .Xr i386_set_watch 3
830 .Sh HISTORY
831 The
832 .Fn ptrace
833 function appeared in
834 .At v7 .