1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" Copyright (c) 1993 Michael Haardt
4 .\" (michael@moria.de),
5 .\" Fri Apr 2 11:32:09 MET DST 1993
7 .\" changes Copyright 1999 Mike Coleman (mkc@acm.org)
8 .\" -- major revision to fully document ptrace semantics per recent Linux
9 .\" kernel (2.2.10) and glibc (2.1.2)
10 .\" Sun Nov 7 03:18:35 CST 1999
12 .\" This is free documentation; you can redistribute it and/or
13 .\" modify it under the terms of the GNU General Public License as
14 .\" published by the Free Software Foundation; either version 2 of
15 .\" the License, or (at your option) any later version.
17 .\" The GNU General Public License's references to "object code"
18 .\" and "executables" are to be interpreted as the output of any
19 .\" document formatting or typesetting system, including
20 .\" intermediate and printed output.
22 .\" This manual is distributed in the hope that it will be useful,
23 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
24 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 .\" GNU General Public License for more details.
27 .\" You should have received a copy of the GNU General Public
28 .\" License along with this manual; if not, write to the Free
29 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
32 .\" Modified Fri Jul 23 23:47:18 1993 by Rik Faith <faith@cs.unc.edu>
33 .\" Modified Fri Jan 31 16:46:30 1997 by Eric S. Raymond <esr@thyrsus.com>
34 .\" Modified Thu Oct 7 17:28:49 1999 by Andries Brouwer <aeb@cwi.nl>
35 .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
36 .\" Added notes on capability requirements
38 .\" 2006-03-24, Chuck Ebbert <76306.1226@compuserve.com>
39 .\" Added PTRACE_SETOPTIONS, PTRACE_GETEVENTMSG, PTRACE_GETSIGINFO,
40 .\" PTRACE_SETSIGINFO, PTRACE_SYSEMU, PTRACE_SYSEMU_SINGLESTEP
41 .\" (Thanks to Blaisorblade, Daniel Jacobowitz and others who helped.)
43 .\" FIXME: Linux 3.1 adds PTRACE_SEIZE, PTRACE_INTERRUPT, and PTRACE_LISTEN.
45 .\" Japanese Version Copyright (c) 1997-1999 HANATAKA Shinya
46 .\" all rights reserved.
47 .\" Translated 1999-11-20, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
48 .\" Updated 2003-10-11, Kentaro Shirakata <argrath@ub32.org>
49 .\" Updated 2006-07-23, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.28
50 .\" Updated 2007-01-07, Akihiro MOTOKI, LDP v2.43
51 .\" Updated 2007-05-01, Akihiro MOTOKI, LDP v2.46
52 .\" Updated 2008-08-06, Akihiro MOTOKI, LDP v3.05
53 .\" Updated 2009-04-13, Akihiro MOTOKI, LDP v3.20
55 .\"WORD: child process 子プロセス
56 .\"WORD: parent process 親プロセス
57 .\"WORD: core image メモリ・イメージ
58 .\"WORD: break point ブレーク・ポイント
59 .\"WORD: single step シングル・ステップ実行
60 .\"WORD: trap flag トラップ・フラグ
63 .\"WORD: process ID プロセスID
65 .TH PTRACE 2 2009-03-30 "Linux" "Linux Programmer's Manual"
67 .\"O ptrace \- process trace
71 .B #include <sys/ptrace.h>
73 .BI "long ptrace(enum __ptrace_request " request ", pid_t " pid ", "
74 .BI " void *" addr ", void *" data );
79 .\"O system call provides a means by which a parent process may observe
80 .\"O and control the execution of another process,
81 .\"O and examine and change its core image and registers.
82 .\"O It is primarily used to implement breakpoint debugging and system
85 システムコールは、親プロセスが、別のプロセスの実行の監視/制御を
86 行ったり、コアイメージ (core image) やレジスタの調査/変更を
89 は、主にブレークポイントによるデバッグやシステムコールのトレースを
92 .\"O The parent can initiate a trace by calling
94 .\"O and having the resulting child do a
95 .\"O .BR PTRACE_TRACEME ,
96 .\"O followed (typically) by an
98 .\"O Alternatively, the parent may commence trace of an existing process using
99 .\"O .BR PTRACE_ATTACH .
112 .\"O While being traced, the child will stop each time a signal is delivered,
113 .\"O even if the signal is being ignored.
114 .\"O (The exception is
116 .\"O which has its usual effect.)
117 .\"O The parent will be notified at its next
119 .\"O and may inspect and modify the child process while it is stopped.
120 .\"O The parent then causes the child to continue,
121 .\"O optionally ignoring the delivered signal
122 .\"O (or even delivering a different signal instead).
123 トレースの実行中、子プロセスはシグナルが配送されるたびに、
124 たとえそのシグナルが無視すべきものであっても停止する
129 で通知され、停止している間に子プロセスを調べたり修正したりすることができる。
130 そして親プロセスは子プロセスの実行を再開させるが、配送された
131 シグナルを無視することもできる (あるいは代わりに別のシグナルを
134 .\"O When the parent is finished tracing, it can terminate the child with
136 .\"O or cause it to continue executing in a normal, untraced mode
138 .\"O .BR PTRACE_DETACH .
141 を使用して子プロセスを終了させることもできるし、
143 を用いて通常のトレースなしのモードにして、
146 .\"O The value of \fIrequest\fP determines the action to be performed:
147 \fIrequest\fP の値がこのシステムコールの動作を決定する:
150 .\"O Indicates that this process is to be traced by its parent.
154 .\"O delivered to this process will cause it to stop and its
155 .\"O parent to be notified via
157 .\"O Also, all subsequent calls to
159 .\"O by this process will cause a
161 .\"O to be sent to it,
162 .\"O giving the parent a chance to gain control before the new program
163 .\"O begins execution.
164 .\"O A process probably shouldn't make this request if its parent
165 .\"O isn't expecting to trace it.
166 .\"O (\fIpid\fP, \fIaddr\fP, and \fIdata\fP are ignored.)
167 このプロセスが親プロセスによってトレースされることを表す。
180 新しいプログラムが実行を開始する前に制御することができる。
181 親プロセスが自プロセスをトレースするつもりがない場合には、
182 おそらくこのプロセスは本要求を行うべきではないだろう。
183 (\fIpid\fP, \fIaddr\fP, \fIdata\fP は無視される。)
185 .\"O The above request is used only by the child process;
186 .\"O the rest are used only by the parent.
187 .\"O In the following requests, \fIpid\fP specifies the child process
189 .\"O For requests other than
190 .\"O .BR PTRACE_KILL ,
191 .\"O the child process must
193 上記の要求は子プロセスだけが行なうものである。
195 以下の要求では、\fIpid\fP で操作の対象となる
201 .BR PTRACE_PEEKTEXT ", " PTRACE_PEEKDATA
202 .\"O Reads a word at the location
204 .\"O in the child's memory, returning the word as the result of the
207 .\"O Linux does not have separate text and data address spaces, so the two
208 .\"O requests are currently equivalent.
209 .\"O (The argument \fIdata\fP is ignored.)
212 の位置から 1 ワードを読み出す。読み出したワードは
214 の返り値として返される。 Linux ではテキスト (text) とデータ (data) で
215 同じアドレス空間を使用するため、この 2 つの要求は現在のところ
216 同じものである。 (引き数 \fIdata\fP は無視される。)
219 .\" PTRACE_PEEKUSR in kernel source, but glibc uses PTRACE_PEEKUSER,
220 .\" and that is the name that seems common on other systems.
221 .\"O Reads a word at offset
223 .\"O in the child's USER area,
224 .\"O which holds the registers and other information about the process
225 .\"O (see \fI<sys/user.h>\fP).
226 .\"O The word is returned as the result of the
229 .\"O Typically the offset must be word-aligned, though this might vary by
232 .\"O (\fIdata\fP is ignored.)
235 の位置から 1 ワードを読み込む。USER 領域にはそのプロセスの
236 レジスタ (registers) などの情報が保持されている
237 (\fI<sys/user.h>\fP を参照)。読み込んだワードは
240 たいていはオフセットはワード境界になければならないが、
243 (\fIdata\fP は無視される。 )
245 .BR PTRACE_POKETEXT ", " PTRACE_POKEDATA
250 .\"O in the child's memory.
251 .\"O As above, the two requests are currently equivalent.
256 の位置へコピーする。上と同様に、現在のところ二つの
260 .\" PTRACE_POKEUSR in kernel source, but glibc uses PTRACE_POKEUSER,
261 .\" and that is the name that seems common on other systems.
266 .\"O in the child's USER area.
267 .\"O As above, the offset must typically be word-aligned.
268 .\"O In order to maintain the integrity of the kernel,
269 .\"O some modifications to the USER area are disallowed.
272 を子プロセスの USER 領域のオフセット
275 上と同様に、通常、オフセットはワード境界になければならない。
276 カーネルの完全性 (integrity) を維持するため、
277 変更内容によっては USER 領域の変更は禁止されている。
279 .BR PTRACE_GETREGS ", " PTRACE_GETFPREGS
280 .\"O Copies the child's general purpose or floating-point registers,
281 .\"O respectively, to location \fIdata\fP in the parent.
282 .\"O See \fI<sys/user.h>\fP for information on
283 .\"O the format of this data.
284 .\"O (\fIaddr\fP is ignored.)
285 それぞれ、子プロセスの汎用レジスタ、浮動小数点レジスタを親プロセスの
286 \fIdata\fP の位置にコピーする。この data の書式に関しては
287 \fI<sys/user.h>\fP を参照すること。(\fIaddr\fP は無視される。)
289 .\"O .BR PTRACE_GETSIGINFO " (since Linux 2.3.99-pre6)"
290 .BR PTRACE_GETSIGINFO " (Linux 2.3.99-pre6 以降)"
291 .\"O Retrieve information about the signal that caused the stop.
292 .\"O Copies a \fIsiginfo_t\fP structure (see
293 .\"O .BR sigaction (2))
294 .\"O from the child to location \fIdata\fP in the parent.
295 .\"O (\fIaddr\fP is ignored.)
296 停止の原因となったシグナルに関する情報を取得する。
299 参照) を子プロセスから親プロセスの \fIdata\fP の位置にコピーする。
302 .BR PTRACE_SETREGS ", " PTRACE_SETFPREGS
303 .\"O Copies the child's general purpose or floating-point registers,
304 .\"O respectively, from location \fIdata\fP in the parent.
306 .\"O .BR PTRACE_POKEUSER ,
308 .\"O purpose register modifications may be disallowed.
309 .\"O (\fIaddr\fP is ignored.)
310 それぞれ、子プロセスの汎用レジスタ、浮動小数点レジスタに
311 親プロセスの \fIdate\fP の位置からコピーする。
314 変更が禁止されている場合がある。 (\fIaddr\fP は無視される。)
316 .\"O .BR PTRACE_SETSIGINFO " (since Linux 2.3.99-pre6)"
317 .BR PTRACE_SETSIGINFO " (Linux 2.3.99-pre6 以降)"
318 .\"O Set signal information.
319 .\"O Copies a \fIsiginfo_t\fP structure from location \fIdata\fP in the
320 .\"O parent to the child.
321 .\"O This will only affect signals that would normally be delivered to
322 .\"O the child and were caught by the tracer.
323 .\"O It may be difficult to tell
324 .\"O these normal signals from synthetic signals generated by
327 .\"O (\fIaddr\fP is ignored.)
329 \fIsiginfo_t\fP 構造体を親プロセスのデータ \fIdata\fP の位置から
331 この処理を行うことができるのは、子プロセスに通常は配送されるはずで
332 トレーサに捕捉されたシグナルについてだけである。
335 自身が発生するシグナルを見分けるのは難しいかもしれない。
338 .\"O .BR PTRACE_SETOPTIONS " (since Linux 2.4.6; see BUGS for caveats)"
339 .BR PTRACE_SETOPTIONS " (Linux 2.4.6 以降; バグの章にある警告も参照)"
340 .\"O Sets ptrace options from \fIdata\fP in the parent.
341 .\"O (\fIaddr\fP is ignored.)
342 .\"O \fIdata\fP is interpreted
343 .\"O as a bit mask of options, which are specified by the following flags:
344 親プロセスの \fIdata\fP に基づいて ptrace のオプションを設定する
346 \fIdata\fP はオプションのビットマスクとして解釈され、
350 .\"O .BR PTRACE_O_TRACESYSGOOD " (since Linux 2.4.6)"
351 .BR PTRACE_O_TRACESYSGOOD " (Linux 2.4.6 以降)"
352 .\"O When delivering syscall traps, set bit 7 in the signal number
353 .\"O (i.e., deliver \fISIGTRAP | 0x80\fP).
354 .\"O This makes it easy for the tracer to tell the difference
355 .\"O between normal traps and those caused by a syscall.
356 .\"O .RB ( PTRACE_O_TRACESYSGOOD
357 .\"O may not work on all architectures.)
358 システムコールのトラップが配送されたときに、シグナル番号のビット 7
359 を設定する (すなわち、\fISIGTRAP | 0x80\fP を配送する)。
360 これにより、トレーサが通常のトラップとシステムコールによるトラップを
362 .RB ( PTRACE_O_TRACESYSGOOD
363 はどのアーキテクチャでも動作しない可能性がある。)
365 .\"O .BR PTRACE_O_TRACEFORK " (since Linux 2.5.46)"
366 .BR PTRACE_O_TRACEFORK " (Linux 2.5.46 以降)"
367 .\"O Stop the child at the next
369 .\"O call with \fISIGTRAP | PTRACE_EVENT_FORK\ <<\ 8\fP and automatically
370 .\"O start tracing the newly forked process,
371 .\"O which will start with a
373 .\"O The PID for the new process can be retrieved with
374 .\"O .BR PTRACE_GETEVENTMSG .
377 呼び出し時に \fISIGTRAP | PTRACE_EVENT_FORK\ <<\ 8\fP で
379 新たに fork されたプロセスのトレースを自動的に開始し、
383 .B PTRACE_GETEVENTMSG
386 .\"O .BR PTRACE_O_TRACEVFORK " (since Linux 2.5.46)"
387 .BR PTRACE_O_TRACEVFORK " (Linux 2.5.46 以降)"
388 .\"O Stop the child at the next
390 .\"O call with \fISIGTRAP | PTRACE_EVENT_VFORK\ <<\ 8\fP and automatically start
391 .\"O tracing the newly vforked process, which will start with a
393 .\"O The PID for the new process can be retrieved with
394 .\"O .BR PTRACE_GETEVENTMSG .
397 呼び出し時に \fISIGTRAP | PTRACE_EVENT_VFORK\ <<\ 8\fP で
399 新たに vfork されたプロセスのトレースを自動的に開始し、
403 .B PTRACE_GETEVENTMSG
406 .\"O .BR PTRACE_O_TRACECLONE " (since Linux 2.5.46)"
407 .BR PTRACE_O_TRACECLONE " (Linux 2.5.46 以降)"
408 .\"O Stop the child at the next
410 .\"O call with \fISIGTRAP | PTRACE_EVENT_CLONE\ <<\ 8\fP and automatically start
411 .\"O tracing the newly cloned process, which will start with a
413 .\"O The PID for the new process can be retrieved with
414 .\"O .BR PTRACE_GETEVENTMSG .
415 .\"O This option may not catch
417 .\"O calls in all cases.
418 .\"O If the child calls
423 .\"O .B PTRACE_EVENT_VFORK
424 .\"O will be delivered instead
426 .\"O .B PTRACE_O_TRACEVFORK
427 .\"O is set; otherwise if the child calls
429 .\"O with the exit signal set to
431 .\"O .B PTRACE_EVENT_FORK
432 .\"O will be delivered
434 .\"O .B PTRACE_O_TRACEFORK
438 呼び出し時に \fISIGTRAP | PTRACE_EVENT_CLONE\ << \8\fP で
440 新たに clone で作成されたプロセスのトレースを自動的に開始し、
444 .B PTRACE_GETEVENTMSG
454 .B PTRACE_O_TRACEVFORK
456 .B PTRACE_EVENT_VFORK
463 .B PTRACE_O_TRACEFORK
468 .\"O .BR PTRACE_O_TRACEEXEC " (since Linux 2.5.46)"
469 .BR PTRACE_O_TRACEEXEC " (Linux 2.5.46 以降)"
470 .\"O Stop the child at the next
472 .\"O call with \fISIGTRAP | PTRACE_EVENT_EXEC\ <<\ 8\fP.
476 \fISIGTRAP | PTRACE_EVENT_EXEC\ <<\ 8\fP
479 .\"O .BR PTRACE_O_TRACEVFORKDONE " (since Linux 2.5.60)"
480 .BR PTRACE_O_TRACEVFORKDONE " (Linux 2.5.60 以降)"
481 .\"O Stop the child at the completion of the next
483 .\"O call with \fISIGTRAP | PTRACE_EVENT_VFORK_DONE\ <<\ 8\fP.
487 \fISIGTRAP | PTRACE_EVENT_VFORK_DONE\ <<\ 8\fP
490 .\"O .BR PTRACE_O_TRACEEXIT " (since Linux 2.5.60)"
491 .BR PTRACE_O_TRACEEXIT " (Linux 2.5.60 以降)"
492 .\"O Stop the child at exit with \fISIGTRAP | PTRACE_EVENT_EXIT\ <<\ 8\fP.
493 .\"O The child's exit status can be retrieved with
494 .\"O .BR PTRACE_GETEVENTMSG .
495 .\"O This stop will be done early during process exit when registers
496 .\"O are still available, allowing the tracer to see where the exit occurred,
497 .\"O whereas the normal exit notification is done after the process
498 .\"O is finished exiting.
499 .\"O Even though context is available, the tracer cannot prevent the exit from
500 .\"O happening at this point.
501 終了 (exit) 時に \fISIGTRAP | PTRACE_EVENT_EXIT\ <<\ 8\fP
502 で子プロセスの動作を停止させる。子プロセスの終了ステータスは
503 .B PTRACE_GETEVENTMSG
505 この停止はレジスタがまだ参照可能であるプロセス終了処理の初期に行われ、
506 トレーサはどこで終了が発生したかを知ることができる。
507 通常の終了通知 (exit notification) はプロセスの終了処理が完了した後に
508 行われる。コンテキストを参照することはできるにも関わらず、
509 トレーサはこの時点から終了を止めることはできない。
512 .\"O .BR PTRACE_GETEVENTMSG " (since Linux 2.5.46)"
513 .BR PTRACE_GETEVENTMSG " (Linux 2.5.46 以降)"
514 .\"O Retrieve a message (as an
515 .\"O .IR "unsigned long" )
516 .\"O about the ptrace event
517 .\"O that just happened, placing it in the location \fIdata\fP in the parent.
519 .\"O .B PTRACE_EVENT_EXIT
520 .\"O this is the child's exit status.
522 .\"O .BR PTRACE_EVENT_FORK ,
523 .\"O .B PTRACE_EVENT_VFORK
525 .\"O .B PTRACE_EVENT_CLONE
527 .\"O is the PID of the new process.
528 .\"O Since Linux 2.6.18, the PID of the new process is also available
530 .\"O .BR PTRACE_EVENT_VFORK_DONE .
531 .\"O (\fIaddr\fP is ignored.)
532 発生したばかりの ptrace イベントに関するメッセージを
533 .RI ( "unsigned long"
535 取得したメッセージは親プロセスの \fIdata\fP の位置に格納される。
538 の場合は子プロセスの終了ステータスであり、
539 .BR PTRACE_EVENT_FORK ,
540 .BR PTRACE_EVENT_VFORK ,
541 .B PTRACE_EVENT_CLONE
542 の場合は新しいプロセスの PID である。
543 Linux 2.6.18 以降では、新しいプロセスの PID は
544 .B PTRACE_EVENT_VFORK_DONE
549 .\"O Restarts the stopped child process.
550 .\"O If \fIdata\fP is nonzero and not
552 .\"O it is interpreted as a signal to be delivered to the child;
553 .\"O otherwise, no signal is delivered.
554 .\"O Thus, for example, the parent can control
555 .\"O whether a signal sent to the child is delivered or not.
556 .\"O (\fIaddr\fP is ignored.)
561 子プロセスに配送されるシグナルと解釈される。
566 子プロセスに送られたシグナルを実際に配送するかどうかを
567 制御することができる。(\fIaddr\fP は無視される。)
569 .BR PTRACE_SYSCALL ", " PTRACE_SINGLESTEP
570 .\"O Restarts the stopped child as for
571 .\"O .BR PTRACE_CONT ,
572 .\"O but arranges for
573 .\"O the child to be stopped at the next entry to or exit from a system call,
574 .\"O or after execution of a single instruction, respectively.
575 .\"O (The child will also, as usual, be stopped upon receipt of a signal.)
576 .\"O From the parent's perspective, the child will appear to have been
577 .\"O stopped by receipt of a
580 .\"O .BR PTRACE_SYSCALL ,
581 .\"O for example, the idea is to inspect
582 .\"O the arguments to the system call at the first stop,
584 .\"O .B PTRACE_SYSCALL
585 .\"O and inspect the return value of
586 .\"O the system call at the second stop.
589 .\"O argument is treated as for
590 .\"O .BR PTRACE_CONT .
591 .\"O (\fIaddr\fP is ignored.)
593 と同様に停止した子プロセスを再開する。ただし、
596 次にシステムコールに入るかシステムコールから抜けるかする時に、
598 の場合は 1 命令 (instruction) 実行した後に停止させる
599 (通常どおり、子プロセスはシグナルを受け取った場合にも停止する)。
602 を受信して停止したように見える。そのため、例えば
606 を実行し、 2回目の停止でシステムコールの返り値を調べる、
615 .\"O .BR PTRACE_SYSEMU ", " PTRACE_SYSEMU_SINGLESTEP " (since Linux 2.6.14)"
616 .BR PTRACE_SYSEMU ", " PTRACE_SYSEMU_SINGLESTEP " (Linux 2.6.14 以降)"
618 .\"O .BR PTRACE_SYSEMU ,
619 .\"O continue and stop on entry to the next syscall,
620 .\"O which will not be executed.
622 .\"O .BR PTRACE_SYSEMU_SINGLESTEP ,
624 .\"O but also singlestep if not a syscall.
625 .\"O This call is used by programs like
626 .\"O User Mode Linux that want to emulate all the child's syscalls.
629 .\"O argument is treated as for
630 .\"O .BR PTRACE_CONT .
631 .\"O (\fIaddr\fP is ignored;
632 .\"O not supported on all architectures.)
634 は、実行を再開し、次のシステムコールに入る時に停止させる。
636 .B PTRACE_SYSEMU_SINGLESTEP
638 1 命令 (singlestep) だけ実行した時点でも停止させる。
639 このコールは User Mode Linux のように子プロセスのシステムコールを全て
640 エミュレートしようとするプログラムで使用される。
647 全てのアーキテクチャでサポートされているわけではない。)
650 .\"O Sends the child a
652 .\"O to terminate it.
653 .\"O (\fIaddr\fP and \fIdata\fP are ignored.)
656 を送り終了させる。(\fIaddr\fP と \fIdata\fP は無視される。)
659 .\"O Attaches to the process specified in
661 .\"O making it a traced "child" of the calling process;
662 .\"O the behavior of the child is as if it had done a
663 .\"O .BR PTRACE_TRACEME .
664 .\"O The calling process actually becomes the parent of the child
665 .\"O process for most purposes (e.g., it will receive
666 .\"O notification of child events and appears in
668 .\"O output as the child's parent), but a
670 .\"O by the child will still return the PID of the original parent.
671 .\"O The child is sent a
673 .\"O but will not necessarily have stopped
674 .\"O by the completion of this call; use
676 .\"O to wait for the child to stop.
677 .\"O (\fIaddr\fP and \fIdata\fP are ignored.)
679 で指定されたプロセスに接続 (attach) し、それを呼び出し元のプロセスの
680 子プロセスとしてトレースできるようにする。子プロセスは
682 したかのように振舞う。呼び出し元のプロセスはそのほとんどの目的において、
683 その子プロセスの実際の親になる (例えば、子プロセスのイベントの
686 で親として表示されたりする)。しかし、子プロセスで
688 を実行した場合には元の親プロセスの PID が返される。
691 が送られるが、この呼び出しが完了するまでに
692 必ずしも停止するとは限らない。子プロセスの停止を待つには
694 を使用すること。(\fIaddr\fP と \fIdata\fP は無視される。)
697 .\"O Restarts the stopped child as for
698 .\"O .BR PTRACE_CONT ,
699 .\"O but first detaches
700 .\"O from the process, undoing the reparenting effect of
701 .\"O .BR PTRACE_ATTACH ,
702 .\"O and the effects of
703 .\"O .BR PTRACE_TRACEME .
704 .\"O Although perhaps not intended, under Linux a traced child can be
705 .\"O detached in this way regardless of which method was used to initiate
707 .\"O (\fIaddr\fP is ignored.)
709 と同様に停止した子プロセスを再開する。ただし
710 まずそのプロセスからの分離 (detach) を行い、
714 の効果を取り消す。意図したものではないだろうが、
715 Linux では、トレースされている子プロセスはどのような方法でトレースを
716 開始されたとしても、この方法で分離 (detach) することができる。
718 .\"O .SH "RETURN VALUE"
722 .\"O requests return the requested data,
723 .\"O while other requests return zero.
724 .\"O On error, all requests return \-1, and
726 .\"O is set appropriately.
727 .\"O Since the value returned by a successful
729 .\"O request may be \-1, the caller must check
731 .\"O after such requests to determine whether or not an error occurred.
740 が成功して返す値も \-1 になることがあるため、
743 を調べ、エラーか発生したのかどうかを判断しなければならない。
748 .\"O (i386 only) There was an error with allocating or freeing a debug
750 (i386 のみ) デバッグレジスタの確保または解放でエラーが発生した。
753 .\"O There was an attempt to read from or write to an invalid area in
754 .\"O the parent's or child's memory,
755 .\"O probably because the area wasn't mapped or accessible.
756 .\"O Unfortunately, under Linux, different variations of this fault
761 .\"O more or less arbitrarily.
762 親プロセスまたは子プロセスのメモリの不正な領域に読み書きしようとした。
763 おそらくその領域がマッピングされていないか、
764 その領域へのアクセスが許されていないかである。
765 不運なことに、Linux ではこのようなエラーの場合、多かれ少なかれ
773 .\"O An attempt was made to set an invalid option.
777 .\"O \fIrequest\fP is invalid, or an attempt was made to read from or
778 .\"O write to an invalid area in the parent's or child's memory,
779 .\"O or there was a word-alignment violation,
780 .\"O or an invalid signal was specified during a restart request.
781 \fIrequest\fP が不正である。
782 または、親プロセスまたは子プロセスのメモリの
785 または、実行再開の要求で不正なシグナルを指定した。
788 .\"O The specified process cannot be traced.
789 .\"O This could be because the
790 .\"O parent has insufficient privileges (the required capability is
791 .\"O .BR CAP_SYS_PTRACE );
792 .\"O unprivileged processes cannot trace processes that they
793 .\"O cannot send signals to or those running
794 .\"O set-user-ID/set-group-ID programs, for obvious reasons.
795 .\"O Alternatively, the process may already be being traced, or be
798 指定したプロセスをトレースすることができない。これは親プロセスが
803 非特権プロセスはシグナルを送ることができないプロセスをトレースできないし、
804 set-user-ID/set-group-ID プログラムを実行しているプロセスはトレースできない。
805 または、プロセスはすでにトレース中である、
811 .\"O The specified process does not exist, or is not currently being traced
812 .\"O by the caller, or is not stopped (for requests that require that).
814 または、指定したプロセスは呼び出したプロセスが
816 または、指定したプロセスが停止していない (停止していることが必要な要求の場合)。
817 .\"O .SH "CONFORMING TO"
822 .\"O Although arguments to
824 .\"O are interpreted according to the prototype given,
825 .\"O glibc currently declares
827 .\"O as a variadic function with only the \fIrequest\fP argument fixed.
828 .\"O This means that unneeded trailing arguments may be omitted,
829 .\"O though doing so makes use of undocumented
833 の引き数は上のようなプロトタイプに基づいて解釈されるが、
836 は \fIrequest\fP 引き数だけが固定の可変長引き数関数として
838 これは必要なければ残りの引き数は省略可能であることを意味するが、
841 の明文化されていない動作を利用していることになる。
844 .\"O the process with pid 1, may not be traced.
846 すなわち PID が 1 のプロセスはトレースすることができない。
848 .\"O The layout of the contents of memory and the USER area are quite OS- and
849 .\"O architecture-specific.
850 メモリや USER 領域の内容や配置は OS ごと、アーキテクチャごとに
852 .\"O The offset supplied, and the data returned,
853 .\"O might not entirely match with the definition of
854 .\"O .IR "struct user" .
855 .\"O .\" See http://lkml.org/lkml/2008/5/8/375
856 オフセットが指定された場合、返されるデータは
859 .\" http://lkml.org/lkml/2008/5/8/375 参照。
861 .\"O The size of a "word" is determined by the OS variant
862 .\"O (e.g., for 32-bit Linux it is 32 bits, etc.).
863 「ワード (word) 」の大きさは OS によって決まる。
864 (例えば、32 ビットの Linux では 32 ビットである、など。)
866 .\"O Tracing causes a few subtle differences in the semantics of
867 .\"O traced processes.
868 .\"O For example, if a process is attached to with
869 .\"O .BR PTRACE_ATTACH ,
870 .\"O its original parent can no longer receive notification via
872 .\"O when it stops, and there is no way for the new parent to
873 .\"O effectively simulate this notification.
874 トレースすることによってトレースされるプロセスの動作に些細な違いが
877 によって接続された場合には、そのプロセスが停止した時でも本来の親は
879 を使って通知を受けることができず、新しい親が効率よく
882 .\"O When the parent receives an event with
883 .\"O .B PTRACE_EVENT_*
885 .\"O the child is not in the normal signal delivery path.
886 .\"O This means the parent cannot do
887 .\"O .BR ptrace (PTRACE_CONT)
888 .\"O with a signal or
889 .\"O .BR ptrace (PTRACE_KILL).
893 .\"O signal can be used instead to kill the child process
894 .\"O after receiving one of these messages.
898 子プロセスは通常通りのシグナル配送が行われる状態にない。
901 .BR ptrace (PTRACE_CONT)
903 .BR ptrace (PTRACE_KILL)
905 こららのメッセージの受信後は、子プロセスを終了 (kill) するのに、
912 .\"O This page documents the way the
914 .\"O call works currently in Linux.
915 .\"O Its behavior differs noticeably on other flavors of UNIX.
916 .\"O In any case, use of
918 .\"O is highly OS- and architecture-specific.
919 このマニュアルは現在の Linux における
921 コールの動作について記述している。他の UNIX では
925 を使うと OS やアーキテクチャに非常に依存したものになる。
927 .\"O The SunOS man page describes
929 .\"O as "unique and arcane", which it is.
930 .\"O The proc-based debugging interface
931 .\"O present in Solaris 2 implements a superset of
933 .\"O functionality in a more powerful and uniform way.
936 は「独特で不可解」と記述されており、まさしくそうである。
937 Solaris 2 では proc ベースの
940 の上位互換関数が実装され、より強力で一貫性のあるものとなっている。
943 .\"O On hosts with 2.6 kernel headers,
944 .\"O .B PTRACE_SETOPTIONS
946 .\"O with a different value than the one for 2.4.
947 .\"O This leads to applications compiled with such
948 .\"O headers failing when run on 2.4 kernels.
949 .\"O This can be worked around by redefining
950 .\"O .B PTRACE_SETOPTIONS
952 .\"O .BR PTRACE_OLDSETOPTIONS ,
953 .\"O if that is defined.
954 カーネル 2.6 のヘッダがインストールされたホストでは、
956 はカーネル 2.4 のヘッダとは異なる値で宣言される。
957 このため、カーネル 2.6 のヘッダでコンパイルされたアプリケーションは
964 .B PTRACE_OLDSETOPTIONS