OSDN Git Service

(split) LDP v3.24 -> v3.29 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / draft / man2 / ptrace.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (c) 1993 Michael Haardt
4 .\" (michael@moria.de),
5 .\" Fri Apr  2 11:32:09 MET DST 1993
6 .\"
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
11 .\"
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.
16 .\"
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.
21 .\"
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.
26 .\"
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,
30 .\" USA.
31 .\"
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
37 .\"
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.)
42 .\"
43 .\" Japanese Version Copyright (c) 1997-1999 HANATAKA Shinya
44 .\"         all rights reserved.
45 .\" Translated 1999-11-20, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
46 .\" Updated 2003-10-11, Kentaro Shirakata <argrath@ub32.org>
47 .\" Updated 2006-07-23, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.28
48 .\" Updated 2007-01-07, Akihiro MOTOKI, LDP v2.43
49 .\" Updated 2007-05-01, Akihiro MOTOKI, LDP v2.46
50 .\" Updated 2008-08-06, Akihiro MOTOKI, LDP v3.05
51 .\" Updated 2009-04-13, Akihiro MOTOKI, LDP v3.20
52 .\"
53 .\"WORD:        child process           »Ò¥×¥í¥»¥¹
54 .\"WORD:        parent process          ¿Æ¥×¥í¥»¥¹
55 .\"WORD:        core image              ¥á¥â¥ê¡¦¥¤¥á¡¼¥¸
56 .\"WORD:        break point             ¥Ö¥ì¡¼¥¯¡¦¥Ý¥¤¥ó¥È
57 .\"WORD:        single step             ¥·¥ó¥°¥ë¡¦¥¹¥Æ¥Ã¥×¼Â¹Ô
58 .\"WORD:        trap flag               ¥È¥é¥Ã¥×¡¦¥Õ¥é¥°
59 .\"WORD:        attach                  Àܳ
60 .\"WORD:        detach                  ʬΥ
61 .\"WORD:        process ID              ¥×¥í¥»¥¹ID
62 .\"
63 .TH PTRACE 2 2009-03-30 "Linux" "Linux Programmer's Manual"
64 .SH Ì¾Á°
65 .\"O ptrace \- process trace
66 ptrace \- ¥×¥í¥»¥¹¤Î¥È¥ì¡¼¥¹
67 .SH ½ñ¼°
68 .nf
69 .B #include <sys/ptrace.h>
70 .sp
71 .BI "long ptrace(enum __ptrace_request " request ", pid_t " pid ", "
72 .BI "            void *" addr ", void *" data );
73 .fi
74 .SH ÀâÌÀ
75 .\"O The
76 .\"O .BR ptrace ()
77 .\"O system call provides a means by which a parent process may observe
78 .\"O and control the execution of another process,
79 .\"O and examine and change its core image and registers.
80 .\"O It is primarily used to implement breakpoint debugging and system
81 .\"O call tracing.
82 .BR ptrace ()
83 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢¿Æ¥×¥í¥»¥¹¤¬¡¢ÊÌ¤Î¥×¥í¥»¥¹¤Î¼Â¹Ô¤Î´Æ»ë/À©¸æ¤ò
84 ¹Ô¤Ã¤¿¤ê¡¢¥³¥¢¥¤¥á¡¼¥¸ (core image) ¤ä¥ì¥¸¥¹¥¿¤ÎÄ´ºº/Êѹ¹¤ò
85 ¹Ô¤Ã¤¿¤ê¤¹¤ë¼êÃʤòÄ󶡤¹¤ë¡£
86 .BR ptrace ()
87 ¤Ï¡¢¼ç¤Ë¥Ö¥ì¡¼¥¯¥Ý¥¤¥ó¥È¤Ë¤è¤ë¥Ç¥Ð¥Ã¥°¤ä¥·¥¹¥Æ¥à¥³¡¼¥ë¤Î¥È¥ì¡¼¥¹¤ò
88 ¼ÂÁõ¤¹¤ë¤Î¤ËÍѤ¤¤é¤ì¤ë¡£
89 .LP
90 .\"O The parent can initiate a trace by calling
91 .\"O .BR fork (2)
92 .\"O and having the resulting child do a
93 .\"O .BR PTRACE_TRACEME ,
94 .\"O followed (typically) by an
95 .\"O .BR exec (3).
96 .\"O Alternatively, the parent may commence trace of an existing process using
97 .\"O .BR PTRACE_ATTACH .
98 ¥È¥ì¡¼¥¹¤ò³«»Ï¤¹¤ë¤Ë¤Ï¡¢¤Þ¤º¿Æ¥×¥í¥»¥¹¤Ç
99 .BR fork (2)
100 ¤ò¸Æ¤Ó½Ð¤¹¡£À¸À®¤µ¤ì¤¿»Ò¥×¥í¥»¥¹¤Ç
101 .B PTRACE_TRACEME
102 ¤ò¹Ô¤¤¡¢Â³¤¤¤Æ (ŵ·¿Åª¤Ë¤Ï)
103 .BR exec (3)
104 ¤ò¹Ô¤Ê¤¦¡£
105 Ê̤ÎÊýË¡¤È¤·¤Æ¤Ï¡¢
106 ¿Æ¥×¥í¥»¥¹¤¬´û¸¤Î¥×¥í¥»¥¹¤ËÂФ·¤Æ
107 .B PTRACE_ATTACH
108 ¤ò»ÈÍѤ·¡¢¥È¥ì¡¼¥¹¤ò³«»Ï¤¹¤ë¡£
109 .LP
110 .\"O While being traced, the child will stop each time a signal is delivered,
111 .\"O even if the signal is being ignored.
112 .\"O (The exception is
113 .\"O .BR SIGKILL ,
114 .\"O which has its usual effect.)
115 .\"O The parent will be notified at its next
116 .\"O .BR wait (2)
117 .\"O and may inspect and modify the child process while it is stopped.
118 .\"O The parent then causes the child to continue,
119 .\"O optionally ignoring the delivered signal
120 .\"O (or even delivering a different signal instead).
121 ¥È¥ì¡¼¥¹¤Î¼Â¹ÔÃæ¡¢»Ò¥×¥í¥»¥¹¤Ï¥·¥°¥Ê¥ë¤¬ÇÛÁ÷¤µ¤ì¤ë¤¿¤Ó¤Ë¡¢
122 ¤¿¤È¤¨¤½¤Î¥·¥°¥Ê¥ë¤¬Ìµ»ë¤¹¤Ù¤­¤â¤Î¤Ç¤¢¤Ã¤Æ¤âÄä»ß¤¹¤ë
123 .RB ( SIGKILL
124 ¤ÏÎã³°¤Ç¡¢Ä̾ï¤É¤ª¤ê¤Î¸ú²Ì¤ò¤â¤¿¤é¤¹)¡£
125 ¿Æ¥×¥í¥»¥¹¤Ë¤Ï¼¡¤Î
126 .BR wait (2)
127 ¤ÇÄÌÃΤµ¤ì¡¢Ää»ß¤·¤Æ¤¤¤ë´Ö¤Ë»Ò¥×¥í¥»¥¹¤òÄ´¤Ù¤¿¤ê½¤Àµ¤·¤¿¤ê¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
128 ¤½¤·¤Æ¿Æ¥×¥í¥»¥¹¤Ï»Ò¥×¥í¥»¥¹¤Î¼Â¹Ô¤òºÆ³«¤µ¤»¤ë¤¬¡¢ÇÛÁ÷¤µ¤ì¤¿
129 ¥·¥°¥Ê¥ë¤ò̵»ë¤¹¤ë¤³¤È¤â¤Ç¤­¤ë (¤¢¤ë¤¤¤ÏÂå¤ï¤ê¤ËÊ̤Υ·¥°¥Ê¥ë¤ò
130 ÇÛÁ÷¤¹¤ë¤³¤È¤â¤Ç¤­¤ë) ¡£
131 .LP
132 .\"O When the parent is finished tracing, it can terminate the child with
133 .\"O .B PTRACE_KILL
134 .\"O or cause it to continue executing in a normal, untraced mode
135 .\"O via
136 .\"O .BR PTRACE_DETACH .
137 ¿Æ¥×¥í¥»¥¹¤¬¥È¥ì¡¼¥¹¤ò½ªÎ»¤¹¤ëºÝ¤Ë¤Ï¡¢
138 .B PTRACE_KILL
139 ¤ò»ÈÍѤ·¤Æ»Ò¥×¥í¥»¥¹¤ò½ªÎ»¤µ¤»¤ë¤³¤È¤â¤Ç¤­¤ë¤·¡¢
140 .B PTRACE_DETACH
141 ¤òÍѤ¤¤ÆÄ̾ï¤Î¥È¥ì¡¼¥¹¤Ê¤·¤Î¥â¡¼¥É¤Ë¤·¤Æ¡¢
142 ¼Â¹Ô¤ò·Ñ³¤µ¤»¤ë¤³¤È¤â¤Ç¤­¤ë¡£
143 .LP
144 .\"O The value of \fIrequest\fP determines the action to be performed:
145 \fIrequest\fP ¤ÎÃͤ¬¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤ÎÆ°ºî¤ò·èÄꤹ¤ë:
146 .TP
147 .B PTRACE_TRACEME
148 .\"O Indicates that this process is to be traced by its parent.
149 .\"O Any signal
150 .\"O (except
151 .\"O .BR SIGKILL )
152 .\"O delivered to this process will cause it to stop and its
153 .\"O parent to be notified via
154 .\"O .BR wait (2).
155 .\"O Also, all subsequent calls to
156 .\"O .BR execve (2)
157 .\"O by this process will cause a
158 .\"O .B SIGTRAP
159 .\"O to be sent to it,
160 .\"O giving the parent a chance to gain control before the new program
161 .\"O begins execution.
162 .\"O A process probably shouldn't make this request if its parent
163 .\"O isn't expecting to trace it.
164 .\"O (\fIpid\fP, \fIaddr\fP, and \fIdata\fP are ignored.)
165 ¤³¤Î¥×¥í¥»¥¹¤¬¿Æ¥×¥í¥»¥¹¤Ë¤è¤Ã¤Æ¥È¥ì¡¼¥¹¤µ¤ì¤ë¤³¤È¤òɽ¤¹¡£
166 ¤³¤Î¥×¥í¥»¥¹¤Ë
167 .RB ( SIGKILL
168 °Ê³°¤Î) ¥·¥°¥Ê¥ë¤¬ÇÛÁ÷¤µ¤ì¤ë¤È¡¢
169 ¥×¥í¥»¥¹¤ÏÄä»ß¤·¡¢¿Æ¥×¥í¥»¥¹¤Ë
170 .BR wait (2)
171 ¤òÄ̤¸¤ÆÄÌÃΤµ¤ì¤ë¡£
172 ¤Þ¤¿¡¢¤³¤ì°Ê¹ß¤Ï¤³¤Î¥×¥í¥»¥¹¤¬
173 .BR execve (2)
174 ¤ò¸Æ¤Ó½Ð¤¹ÅÙ¤Ë
175 .B SIGTRAP
176 ¤¬Á÷¿®¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤ë¡£
177 ¤³¤ì¤Ë¤è¤Ã¤Æ¡¢¿Æ¥×¥í¥»¥¹¤Ï
178 ¿·¤·¤¤¥×¥í¥°¥é¥à¤¬¼Â¹Ô¤ò³«»Ï¤¹¤ëÁ°¤ËÀ©¸æ¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
179 ¿Æ¥×¥í¥»¥¹¤¬¼«¥×¥í¥»¥¹¤ò¥È¥ì¡¼¥¹¤¹¤ë¤Ä¤â¤ê¤¬¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢
180 ¤ª¤½¤é¤¯¤³¤Î¥×¥í¥»¥¹¤ÏËÜÍ×µá¤ò¹Ô¤¦¤Ù¤­¤Ç¤Ï¤Ê¤¤¤À¤í¤¦¡£
181 (\fIpid\fP, \fIaddr\fP, \fIdata\fP ¤Ï̵»ë¤µ¤ì¤ë¡£)
182 .LP
183 .\"O The above request is used only by the child process;
184 .\"O the rest are used only by the parent.
185 .\"O In the following requests, \fIpid\fP specifies the child process
186 .\"O to be acted on.
187 .\"O For requests other than
188 .\"O .BR PTRACE_KILL ,
189 .\"O the child process must
190 .\"O be stopped.
191 ¾åµ­¤ÎÍ×µá¤Ï»Ò¥×¥í¥»¥¹¤À¤±¤¬¹Ô¤Ê¤¦¤â¤Î¤Ç¤¢¤ë¡£
192 »Ä¤ê¤Ï¿Æ¥×¥í¥»¥¹¤À¤±¤¬¹Ô¤Ê¤¦¤â¤Î¤Ç¤¢¤ë¡£
193 °Ê²¼¤ÎÍ×µá¤Ç¤Ï¡¢\fIpid\fP ¤ÇÁàºî¤ÎÂоݤȤʤë
194 »Ò¥×¥í¥»¥¹¤ò»ØÄꤹ¤ë¡£
195 .B PTRACE_KILL
196 ¤ò½ü¤­¡¢Í×µá¤ò¹Ô¤Ê¤¦¤¿¤á¤Ë¤Ï
197 »Ò¥×¥í¥»¥¹¤ÏÄä»ß¤·¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
198 .TP
199 .BR PTRACE_PEEKTEXT ", " PTRACE_PEEKDATA
200 .\"O Reads a word at the location
201 .\"O .I addr
202 .\"O in the child's memory, returning the word as the result of the
203 .\"O .BR ptrace ()
204 .\"O call.
205 .\"O Linux does not have separate text and data address spaces, so the two
206 .\"O requests are currently equivalent.
207 .\"O (The argument \fIdata\fP is ignored.)
208 »Ò¥×¥í¥»¥¹¤Î¥á¥â¥ê¤Î
209 .I addr
210 ¤Î°ÌÃÖ¤«¤é 1 ¥ï¡¼¥É¤òÆɤ߽Ф¹¡£Æɤ߽Ф·¤¿¥ï¡¼¥É¤Ï
211 .BR ptrace ()
212 ¤ÎÊÖ¤êÃͤȤ·¤ÆÊÖ¤µ¤ì¤ë¡£ Linux ¤Ç¤Ï¥Æ¥­¥¹¥È (text) ¤È¥Ç¡¼¥¿ (data) ¤Ç
213 Ʊ¤¸¥¢¥É¥ì¥¹¶õ´Ö¤ò»ÈÍѤ¹¤ë¤¿¤á¡¢¤³¤Î 2 ¤Ä¤ÎÍ×µá¤Ï¸½ºß¤Î¤È¤³¤í
214 Ʊ¤¸¤â¤Î¤Ç¤¢¤ë¡£ (°ú¤­¿ô \fIdata\fP ¤Ï̵»ë¤µ¤ì¤ë¡£)
215 .TP
216 .B PTRACE_PEEKUSER
217 .\" PTRACE_PEEKUSR in kernel source, but glibc uses PTRACE_PEEKUSER,
218 .\" and that is the name that seems common on other systems.
219 .\"O Reads a word at offset
220 .\"O .I addr
221 .\"O in the child's USER area,
222 .\"O which holds the registers and other information about the process
223 .\"O (see \fI<sys/user.h>\fP).
224 .\"O The word is returned as the result of the
225 .\"O .BR ptrace ()
226 .\"O call.
227 .\"O Typically the offset must be word-aligned, though this might vary by
228 .\"O architecture.
229 .\"O See NOTES.
230 .\"O (\fIdata\fP is ignored.)
231 »Ò¥×¥í¥»¥¹¤Î USER Îΰè¤Î¥ª¥Õ¥»¥Ã¥È
232 .I addr
233 ¤Î°ÌÃÖ¤«¤é 1 ¥ï¡¼¥É¤òÆɤ߹þ¤à¡£USER Îΰè¤Ë¤Ï¤½¤Î¥×¥í¥»¥¹¤Î
234 ¥ì¥¸¥¹¥¿ (registers) ¤Ê¤É¤Î¾ðÊó¤¬ÊÝ»ý¤µ¤ì¤Æ¤¤¤ë
235 (\fI<sys/user.h>\fP ¤ò»²¾È)¡£Æɤ߹þ¤ó¤À¥ï¡¼¥É¤Ï
236 .BR ptrace ()
237 ¥³¡¼¥ë¤Î·ë²Ì¤È¤·¤ÆÊÖ¤µ¤ì¤ë¡£
238 ¤¿¤¤¤Æ¤¤¤Ï¥ª¥Õ¥»¥Ã¥È¤Ï¥ï¡¼¥É¶­³¦¤Ë¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤¬¡¢
239 ¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤Ë¤è¤Ã¤Æ¤Ï¤½¤ÎɬÍפϤʤ¤¡£
240 ¡ÖÃí°Õ¡×¤ÎÀá¤ò»²¾È¡£
241 (\fIdata\fP ¤Ï̵»ë¤µ¤ì¤ë¡£ )
242 .TP
243 .BR PTRACE_POKETEXT ", " PTRACE_POKEDATA
244 .\"O Copies the word
245 .\"O .I data
246 .\"O to location
247 .\"O .I addr
248 .\"O in the child's memory.
249 .\"O As above, the two requests are currently equivalent.
250 ¥ï¡¼¥É
251 .I data
252 ¤ò»Ò¥×¥í¥»¥¹¤Î¥á¥â¥ê¤Î
253 .I addr
254 ¤Î°ÌÃ֤إ³¥Ô¡¼¤¹¤ë¡£¾å¤ÈƱÍͤˡ¢¸½ºß¤Î¤È¤³¤íÆó¤Ä¤Î
255 Í×µá¤ÏƱ¤¸¤â¤Î¤Ç¤¢¤ë¡£
256 .TP
257 .B PTRACE_POKEUSER
258 .\" PTRACE_POKEUSR in kernel source, but glibc uses PTRACE_POKEUSER,
259 .\" and that is the name that seems common on other systems.
260 .\"O Copies the word
261 .\"O .I data
262 .\"O to offset
263 .\"O .I addr
264 .\"O in the child's USER area.
265 .\"O As above, the offset must typically be word-aligned.
266 .\"O In order to maintain the integrity of the kernel,
267 .\"O some modifications to the USER area are disallowed.
268 ¥ï¡¼¥É
269 .I data
270 ¤ò»Ò¥×¥í¥»¥¹¤Î USER Îΰè¤Î¥ª¥Õ¥»¥Ã¥È
271 .I addr
272 ¤Î°ÌÃ֤˥³¥Ô¡¼¤¹¤ë¡£
273 ¾å¤ÈƱÍͤˡ¢Ä̾¥ª¥Õ¥»¥Ã¥È¤Ï¥ï¡¼¥É¶­³¦¤Ë¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
274 ¥«¡¼¥Í¥ë¤Î´°Á´À­ (integrity) ¤ò°Ý»ý¤¹¤ë¤¿¤á¡¢
275 Êѹ¹ÆâÍƤˤè¤Ã¤Æ¤Ï USER Îΰè¤ÎÊѹ¹¤Ï¶Ø»ß¤µ¤ì¤Æ¤¤¤ë¡£
276 .TP
277 .BR PTRACE_GETREGS ", " PTRACE_GETFPREGS
278 .\"O Copies the child's general purpose or floating-point registers,
279 .\"O respectively, to location \fIdata\fP in the parent.
280 .\"O See \fI<sys/user.h>\fP for information on
281 .\"O the format of this data.
282 .\"O (\fIaddr\fP is ignored.)
283 ¤½¤ì¤¾¤ì¡¢»Ò¥×¥í¥»¥¹¤ÎÈÆÍѥ쥸¥¹¥¿¡¢ÉâÆ°¾®¿ôÅÀ¥ì¥¸¥¹¥¿¤ò¿Æ¥×¥í¥»¥¹¤Î
284 \fIdata\fP ¤Î°ÌÃ֤˥³¥Ô¡¼¤¹¤ë¡£¤³¤Î data ¤Î½ñ¼°¤Ë´Ø¤·¤Æ¤Ï
285 \fI<sys/user.h>\fP ¤ò»²¾È¤¹¤ë¤³¤È¡£(\fIaddr\fP ¤Ï̵»ë¤µ¤ì¤ë¡£)
286 .TP
287 .\"O .BR PTRACE_GETSIGINFO " (since Linux 2.3.99-pre6)"
288 .BR PTRACE_GETSIGINFO " (Linux 2.3.99-pre6 °Ê¹ß)"
289 .\"O Retrieve information about the signal that caused the stop.
290 .\"O Copies a \fIsiginfo_t\fP structure (see
291 .\"O .BR sigaction (2))
292 .\"O from the child to location \fIdata\fP in the parent.
293 .\"O (\fIaddr\fP is ignored.)
294 Ää»ß¤Î¸¶°ø¤È¤Ê¤Ã¤¿¥·¥°¥Ê¥ë¤Ë´Ø¤¹¤ë¾ðÊó¤ò¼èÆÀ¤¹¤ë¡£
295 \fIsiginfo_t\fP ¹½Â¤ÂÎ
296 .RB ( sigaction (2)
297 »²¾È) ¤ò»Ò¥×¥í¥»¥¹¤«¤é¿Æ¥×¥í¥»¥¹¤Î \fIdata\fP ¤Î°ÌÃ֤˥³¥Ô¡¼¤¹¤ë¡£
298 (\fIaddr\fP ¤Ï̵»ë¤µ¤ì¤ë¡£)
299 .TP
300 .BR PTRACE_SETREGS ", " PTRACE_SETFPREGS
301 .\"O Copies the child's general purpose or floating-point registers,
302 .\"O respectively, from location \fIdata\fP in the parent.
303 .\"O As for
304 .\"O .BR PTRACE_POKEUSER ,
305 .\"O some general
306 .\"O purpose register modifications may be disallowed.
307 .\"O (\fIaddr\fP is ignored.)
308 ¤½¤ì¤¾¤ì¡¢»Ò¥×¥í¥»¥¹¤ÎÈÆÍѥ쥸¥¹¥¿¡¢ÉâÆ°¾®¿ôÅÀ¥ì¥¸¥¹¥¿¤Ë
309 ¿Æ¥×¥í¥»¥¹¤Î \fIdate\fP ¤Î°ÌÃÖ¤«¤é¥³¥Ô¡¼¤¹¤ë¡£
310 .B PTRACE_POKEUSER
311 ¤ÈƱÍͤˡ¢ÈÆÍѥ쥸¥¹¥¿¤Ë¤è¤Ã¤Æ¤Ï
312 Êѹ¹¤¬¶Ø»ß¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤¬¤¢¤ë¡£ (\fIaddr\fP ¤Ï̵»ë¤µ¤ì¤ë¡£)
313 .TP
314 .\"O .BR PTRACE_SETSIGINFO " (since Linux 2.3.99-pre6)"
315 .BR PTRACE_SETSIGINFO " (Linux 2.3.99-pre6 °Ê¹ß)"
316 .\"O Set signal information.
317 .\"O Copies a \fIsiginfo_t\fP structure from location \fIdata\fP in the
318 .\"O parent to the child.
319 .\"O This will only affect signals that would normally be delivered to
320 .\"O the child and were caught by the tracer.
321 .\"O It may be difficult to tell
322 .\"O these normal signals from synthetic signals generated by
323 .\"O .BR ptrace ()
324 .\"O itself.
325 .\"O (\fIaddr\fP is ignored.)
326 ¥·¥°¥Ê¥ë¾ðÊó¤òÀßÄꤹ¤ë¡£
327 \fIsiginfo_t\fP ¹½Â¤ÂΤò¿Æ¥×¥í¥»¥¹¤Î¥Ç¡¼¥¿ \fIdata\fP ¤Î°ÌÃÖ¤«¤é
328 »Ò¥×¥í¥»¥¹¤Ë¥³¥Ô¡¼¤¹¤ë¡£
329 ¤³¤Î½èÍý¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤­¤ë¤Î¤Ï¡¢»Ò¥×¥í¥»¥¹¤ËÄ̾ï¤ÏÇÛÁ÷¤µ¤ì¤ë¤Ï¤º¤Ç
330 ¥È¥ì¡¼¥µ¤ËÊ᪤µ¤ì¤¿¥·¥°¥Ê¥ë¤Ë¤Ä¤¤¤Æ¤À¤±¤Ç¤¢¤ë¡£
331 ¤³¤ì¤é¤ÎÄ̾ï¤Î¥·¥°¥Ê¥ë¤È
332 .BR ptrace ()
333 ¼«¿È¤¬È¯À¸¤¹¤ë¥·¥°¥Ê¥ë¤ò¸«Ê¬¤±¤ë¤Î¤ÏÆñ¤·¤¤¤«¤â¤·¤ì¤Ê¤¤¡£
334 (\fIaddr\fP ¤Ï̵»ë¤µ¤ì¤ë¡£)
335 .TP
336 .\"O .BR PTRACE_SETOPTIONS " (since Linux 2.4.6; see BUGS for caveats)"
337 .BR PTRACE_SETOPTIONS " (Linux 2.4.6 °Ê¹ß; ¥Ð¥°¤Î¾Ï¤Ë¤¢¤ë·Ù¹ð¤â»²¾È)"
338 .\"O Sets ptrace options from \fIdata\fP in the parent.
339 .\"O (\fIaddr\fP is ignored.)
340 .\"O \fIdata\fP is interpreted
341 .\"O as a bit mask of options, which are specified by the following flags:
342 ¿Æ¥×¥í¥»¥¹¤Î \fIdata\fP ¤Ë´ð¤Å¤¤¤Æ ptrace ¤Î¥ª¥×¥·¥ç¥ó¤òÀßÄꤹ¤ë
343 (\fIaddr\fP ¤Ï̵»ë¤µ¤ì¤ë)¡£
344 \fIdata\fP ¤Ï¥ª¥×¥·¥ç¥ó¤Î¥Ó¥Ã¥È¥Þ¥¹¥¯¤È¤·¤Æ²ò¼á¤µ¤ì¡¢
345 ¥ª¥×¥·¥ç¥ó¤Ë¤Ï°Ê²¼¤Î¥Õ¥é¥°¤ò»ØÄê¤Ç¤­¤ë:
346 .RS
347 .TP
348 .\"O .BR PTRACE_O_TRACESYSGOOD " (since Linux 2.4.6)"
349 .BR PTRACE_O_TRACESYSGOOD " (Linux 2.4.6 °Ê¹ß)"
350 .\"O When delivering syscall traps, set bit 7 in the signal number
351 .\"O (i.e., deliver \fI(SIGTRAP | 0x80)\fP
352 .\"O This makes it easy for the tracer to tell the difference
353 .\"O between normal traps and those caused by a syscall.
354 .\"O .RB ( PTRACE_O_TRACESYSGOOD
355 .\"O may not work on all architectures.)
356 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤Î¥È¥é¥Ã¥×¤¬ÇÛÁ÷¤µ¤ì¤¿¤È¤­¤Ë¡¢¥·¥°¥Ê¥ëÈÖ¹æ¤Î¥Ó¥Ã¥È 7
357 ¤òÀßÄꤹ¤ë (¤¹¤Ê¤ï¤Á¡¢\fI(SIGTRAP | 0x80)\fP ¤òÇÛÁ÷¤¹¤ë)¡£
358 ¤³¤ì¤Ë¤è¤ê¡¢¥È¥ì¡¼¥µ¤¬Ä̾ï¤Î¥È¥é¥Ã¥×¤È¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ë¤è¤ë¥È¥é¥Ã¥×¤ò
359 ¶èÊ̤·¤ä¤¹¤¯¤Ê¤ë¡£
360 .RB ( PTRACE_O_TRACESYSGOOD
361 ¤Ï¤É¤Î¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤Ç¤âÆ°ºî¤·¤Ê¤¤²ÄǽÀ­¤¬¤¢¤ë¡£)
362 .TP
363 .\"O .BR PTRACE_O_TRACEFORK " (since Linux 2.5.46)"
364 .BR PTRACE_O_TRACEFORK " (Linux 2.5.46 °Ê¹ß)"
365 .\"O Stop the child at the next
366 .\"O .BR fork (2)
367 .\"O call with \fISIGTRAP | PTRACE_EVENT_FORK\ <<\ 8\fP and automatically
368 .\"O start tracing the newly forked process,
369 .\"O which will start with a
370 .\"O .BR SIGSTOP .
371 .\"O The PID for the new process can be retrieved with
372 .\"O .BR PTRACE_GETEVENTMSG .
373 ¼¡¤Î
374 .BR fork (2)
375 ¸Æ¤Ó½Ð¤·»þ¤Ë \fISIGTRAP | PTRACE_EVENT_FORK\ <<\ 8\fP ¤Ç
376 »Ò¥×¥í¥»¥¹¤ÎÆ°ºî¤òÄä»ß¤µ¤»¡¢
377 ¿·¤¿¤Ë fork ¤µ¤ì¤¿¥×¥í¥»¥¹¤Î¥È¥ì¡¼¥¹¤ò¼«Æ°Åª¤Ë³«»Ï¤·¡¢
378 .B SIGSTOP
379 ¤Ç¤½¤Î¥×¥í¥»¥¹¤Î¼Â¹Ô¤ò³«»Ï¤¹¤ë¡£
380 ¿·¤·¤¤¥×¥í¥»¥¹¤Î PID ¤Ï
381 .B PTRACE_GETEVENTMSG
382 ¤Ç¼èÆÀ¤Ç¤­¤ë¡£
383 .TP
384 .\"O .BR PTRACE_O_TRACEVFORK " (since Linux 2.5.46)"
385 .BR PTRACE_O_TRACEVFORK " (Linux 2.5.46 °Ê¹ß)"
386 .\"O Stop the child at the next
387 .\"O .BR vfork (2)
388 .\"O call with \fISIGTRAP | PTRACE_EVENT_VFORK\ <<\ 8\fP and automatically start
389 .\"O tracing the newly vforked process, which will start with a
390 .\"O .BR SIGSTOP .
391 .\"O The PID for the new process can be retrieved with
392 .\"O .BR PTRACE_GETEVENTMSG .
393 ¼¡¤Î
394 .BR vfork (2)
395 ¸Æ¤Ó½Ð¤·»þ¤Ë \fISIGTRAP | PTRACE_EVENT_VFORK\ <<\ 8\fP ¤Ç
396 »Ò¥×¥í¥»¥¹¤ÎÆ°ºî¤òÄä»ß¤µ¤»¡¢
397 ¿·¤¿¤Ë vfork ¤µ¤ì¤¿¥×¥í¥»¥¹¤Î¥È¥ì¡¼¥¹¤ò¼«Æ°Åª¤Ë³«»Ï¤·¡¢
398 .B SIGSTOP
399 ¤Ç¤½¤Î¥×¥í¥»¥¹¤Î¼Â¹Ô¤ò³«»Ï¤¹¤ë¡£
400 ¿·¤·¤¤¥×¥í¥»¥¹¤Î PID ¤Ï
401 .B PTRACE_GETEVENTMSG
402 ¤Ç¼èÆÀ¤Ç¤­¤ë¡£
403 .TP
404 .\"O .BR PTRACE_O_TRACECLONE " (since Linux 2.5.46)"
405 .BR PTRACE_O_TRACECLONE " (Linux 2.5.46 °Ê¹ß)"
406 .\"O Stop the child at the next
407 .\"O .BR clone (2)
408 .\"O call with \fISIGTRAP | PTRACE_EVENT_CLONE\ <<\ 8\fP and automatically start
409 .\"O tracing the newly cloned process, which will start with a
410 .\"O .BR SIGSTOP .
411 .\"O The PID for the new process can be retrieved with
412 .\"O .BR PTRACE_GETEVENTMSG .
413 .\"O This option may not catch
414 .\"O .BR clone (2)
415 .\"O calls in all cases.
416 .\"O If the child calls
417 .\"O .BR clone (2)
418 .\"O with the
419 .\"O .B CLONE_VFORK
420 .\"O flag,
421 .\"O .B PTRACE_EVENT_VFORK
422 .\"O will be delivered instead
423 .\"O if
424 .\"O .B PTRACE_O_TRACEVFORK
425 .\"O is set; otherwise if the child calls
426 .\"O .BR clone (2)
427 .\"O with the exit signal set to
428 .\"O .BR SIGCHLD ,
429 .\"O .B PTRACE_EVENT_FORK
430 .\"O will be delivered
431 .\"O if
432 .\"O .B PTRACE_O_TRACEFORK
433 .\"O is set.
434 ¼¡¤Î
435 .BR clone (2)
436 ¸Æ¤Ó½Ð¤·»þ¤Ë \fISIGTRAP | PTRACE_EVENT_CLONE\ << \8\fP ¤Ç
437 »Ò¥×¥í¥»¥¹¤ÎÆ°ºî¤òÄä»ß¤µ¤»¡¢
438 ¿·¤¿¤Ë clone ¤ÇºîÀ®¤µ¤ì¤¿¥×¥í¥»¥¹¤Î¥È¥ì¡¼¥¹¤ò¼«Æ°Åª¤Ë³«»Ï¤·¡¢
439 .B SIGSTOP
440 ¤Ç¥×¥í¥»¥¹¤Î¼Â¹Ô¤ò³«»Ï¤¹¤ë¡£
441 ¿·¤·¤¤¥×¥í¥»¥¹¤Î PID ¤Ï
442 .B PTRACE_GETEVENTMSG
443 ¤Ç¼èÆÀ¤Ç¤­¤ë¡£
444 ¤³¤Î¥ª¥×¥·¥ç¥ó¤ÇÁ´¤Æ¤Î
445 .BR clone (2)
446 ¥³¡¼¥ë¤òÊá¤Þ¤¨¤é¤ì¤ë¤ï¤±¤Ç¤Ï¤Ê¤¤¡£
447 »Ò¥×¥í¥»¥¹¤¬
448 .B CLONE_VFORK
449 ¥Õ¥é¥°ÉÕ¤­¤Ç
450 .BR clone (2)
451 ¤ò¸Æ¤Ó½Ð¤·¤¿¾ì¹ç¡¢
452 .B PTRACE_O_TRACEVFORK
453 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ì¤ÐÂå¤ï¤ê¤Ë
454 .B PTRACE_EVENT_VFORK
455 ¤¬ÇÛÁ÷¤µ¤ì¤ë¡£
456 ¤Þ¤¿¡¢»Ò¥×¥í¥»¥¹¤¬½ªÎ»¥·¥°¥Ê¥ë¤ò
457 .B SIGCHLD
458 ¤ËÀßÄꤷ¤Æ
459 .BR clone (2)
460 ¤ò¸Æ¤Ó½Ð¤·¤¿¾ì¹ç¤Ï¡¢
461 .B PTRACE_O_TRACEFORK
462 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ì¤Ð
463 .B PTRACE_EVENT_FORK
464 ¤¬ÇÛÁ÷¤µ¤ì¤ë¡£
465 .TP
466 .\"O .BR PTRACE_O_TRACEEXEC " (since Linux 2.5.46)"
467 .BR PTRACE_O_TRACEEXEC " (Linux 2.5.46 °Ê¹ß)"
468 .\"O Stop the child at the next
469 .\"O .BR execve (2)
470 .\"O call with \fISIGTRAP | PTRACE_EVENT_EXEC\ <<\ 8\fP.
471 ¼¡¤Î
472 .BR execve (2)
473 ¸Æ¤Ó½Ð¤·»þ¤Ë
474 \fISIGTRAP | PTRACE_EVENT_EXEC\ <<\ 8\fP
475 ¤Ç»Ò¥×¥í¥»¥¹¤ÎÆ°ºî¤òÄä»ß¤µ¤»¤ë¡£
476 .TP
477 .\"O .BR PTRACE_O_TRACEVFORKDONE " (since Linux 2.5.60)"
478 .BR PTRACE_O_TRACEVFORKDONE " (Linux 2.5.60 °Ê¹ß)"
479 .\"O Stop the child at the completion of the next
480 .\"O .BR vfork (2)
481 .\"O call with \fISIGTRAP | PTRACE_EVENT_VFORK_DONE\ <<\ 8\fP.
482 ¼¡¤Î
483 .BR vfork (2)
484 ¸Æ¤Ó½Ð¤·»þ¤Ë
485 \fISIGTRAP | PTRACE_EVENT_VFORK_DONE\ <<\ 8\fP
486 ¤Ç»Ò¥×¥í¥»¥¹¤ÎÆ°ºî¤òÄä»ß¤µ¤»¤ë¡£
487 .TP
488 .\"O .BR PTRACE_O_TRACEEXIT " (since Linux 2.5.60)"
489 .BR PTRACE_O_TRACEEXIT " (Linux 2.5.60 °Ê¹ß)"
490 .\"O Stop the child at exit with \fISIGTRAP | PTRACE_EVENT_EXIT\ <<\ 8\fP.
491 .\"O The child's exit status can be retrieved with
492 .\"O .BR PTRACE_GETEVENTMSG .
493 .\"O This stop will be done early during process exit when registers
494 .\"O are still available, allowing the tracer to see where the exit occurred,
495 .\"O whereas the normal exit notification is done after the process
496 .\"O is finished exiting.
497 .\"O Even though context is available, the tracer cannot prevent the exit from
498 .\"O happening at this point.
499 ½ªÎ» (exit) »þ¤Ë \fISIGTRAP | PTRACE_EVENT_EXIT\ <<\ 8\fP
500 ¤Ç»Ò¥×¥í¥»¥¹¤ÎÆ°ºî¤òÄä»ß¤µ¤»¤ë¡£»Ò¥×¥í¥»¥¹¤Î½ªÎ»¥¹¥Æ¡¼¥¿¥¹¤Ï
501 .B PTRACE_GETEVENTMSG
502 ¤Ç¼èÆÀ¤Ç¤­¤ë¡£
503 ¤³¤ÎÄä»ß¤Ï¥ì¥¸¥¹¥¿¤¬¤Þ¤À»²¾È²Äǽ¤Ç¤¢¤ë¥×¥í¥»¥¹½ªÎ»½èÍý¤Î½é´ü¤Ë¹Ô¤ï¤ì¡¢
504 ¥È¥ì¡¼¥µ¤Ï¤É¤³¤Ç½ªÎ»¤¬È¯À¸¤·¤¿¤«¤òÃΤ뤳¤È¤¬¤Ç¤­¤ë¡£
505 Ä̾ï¤Î½ªÎ»ÄÌÃΠ(exit notification) ¤Ï¥×¥í¥»¥¹¤Î½ªÎ»½èÍý¤¬´°Î»¤·¤¿¸å¤Ë
506 ¹Ô¤ï¤ì¤ë¡£¥³¥ó¥Æ¥­¥¹¥È¤ò»²¾È¤¹¤ë¤³¤È¤Ï¤Ç¤­¤ë¤Ë¤â´Ø¤ï¤é¤º¡¢
507 ¥È¥ì¡¼¥µ¤Ï¤³¤Î»þÅÀ¤«¤é½ªÎ»¤ò»ß¤á¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤¡£
508 .RE
509 .TP
510 .\"O .BR PTRACE_GETEVENTMSG " (since Linux 2.5.46)"
511 .BR PTRACE_GETEVENTMSG " (Linux 2.5.46 °Ê¹ß)"
512 .\"O Retrieve a message (as an
513 .\"O .IR "unsigned long" )
514 .\"O about the ptrace event
515 .\"O that just happened, placing it in the location \fIdata\fP in the parent.
516 .\"O For
517 .\"O .B PTRACE_EVENT_EXIT
518 .\"O this is the child's exit status.
519 .\"O For
520 .\"O .BR PTRACE_EVENT_FORK ,
521 .\"O .B PTRACE_EVENT_VFORK
522 .\"O and
523 .\"O .B PTRACE_EVENT_CLONE
524 .\"O this
525 .\"O is the PID of the new process.
526 .\"O Since Linux 2.6.18, the PID of the new process is also available
527 .\"O for
528 .\"O .BR PTRACE_EVENT_VFORK_DONE .
529 .\"O (\fIaddr\fP is ignored.)
530 ȯÀ¸¤·¤¿¤Ð¤«¤ê¤Î ptrace ¥¤¥Ù¥ó¥È¤Ë´Ø¤¹¤ë¥á¥Ã¥»¡¼¥¸¤ò
531 .RI ( "unsigned long"
532 ·¿¤Ç) ¼èÆÀ¤¹¤ë¡£
533 ¼èÆÀ¤·¤¿¥á¥Ã¥»¡¼¥¸¤Ï¿Æ¥×¥í¥»¥¹¤Î \fIdata\fP ¤Î°ÌÃ֤˳ÊǼ¤µ¤ì¤ë¡£
534 ÆÀ¤é¤ì¤ëÆâÍƤϡ¢
535 .B PTRACE_EVENT_EXIT
536 ¤Î¾ì¹ç¤Ï»Ò¥×¥í¥»¥¹¤Î½ªÎ»¥¹¥Æ¡¼¥¿¥¹¤Ç¤¢¤ê¡¢
537 .BR PTRACE_EVENT_FORK ,
538 .BR PTRACE_EVENT_VFORK ,
539 .B PTRACE_EVENT_CLONE
540 ¤Î¾ì¹ç¤Ï¿·¤·¤¤¥×¥í¥»¥¹¤Î PID ¤Ç¤¢¤ë¡£
541 Linux 2.6.18 °Ê¹ß¤Ç¤Ï¡¢¿·¤·¤¤¥×¥í¥»¥¹¤Î PID ¤Ï
542 .B PTRACE_EVENT_VFORK_DONE
543 ¤ÇÆþ¼ê¤Ç¤­¤ë¡£
544 (\fIaddr\fP ¤Ï̵»ë¤µ¤ì¤ë¡£)
545 .TP
546 .B PTRACE_CONT
547 .\"O Restarts the stopped child process.
548 .\"O If \fIdata\fP is nonzero and not
549 .\"O .BR SIGSTOP ,
550 .\"O it is interpreted as a signal to be delivered to the child;
551 .\"O otherwise, no signal is delivered.
552 .\"O Thus, for example, the parent can control
553 .\"O whether a signal sent to the child is delivered or not.
554 .\"O (\fIaddr\fP is ignored.)
555 Ää»ß¤·¤¿»Ò¥×¥í¥»¥¹¤Î¼Â¹Ô¤òºÆ³«¤µ¤»¤ë¡£
556 \fIdata\fP ¤¬¥¼¥í¤Ç¤Ê¤¯¡¢
557 .B SIGSTOP
558 ¤Ç¤â¤Ê¤±¤ì¤Ð¡¢
559 »Ò¥×¥í¥»¥¹¤ËÇÛÁ÷¤µ¤ì¤ë¥·¥°¥Ê¥ë¤È²ò¼á¤µ¤ì¤ë¡£
560 ¥¼¥í¤ä
561 .B SIGSTOP
562 ¤Î¾ì¹ç¤Ï¥·¥°¥Ê¥ë¤ÏÇÛÁ÷¤µ¤ì¤Ê¤¤¡£
563 ¤³¤ì¤ò»È¤¦¤È¡¢Î㤨¤Ð¡¢¿Æ¥×¥í¥»¥¹¤Ï
564 »Ò¥×¥í¥»¥¹¤ËÁ÷¤é¤ì¤¿¥·¥°¥Ê¥ë¤ò¼ÂºÝ¤ËÇÛÁ÷¤¹¤ë¤«¤É¤¦¤«¤ò
565 À©¸æ¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£(\fIaddr\fP ¤Ï̵»ë¤µ¤ì¤ë¡£)
566 .TP
567 .BR PTRACE_SYSCALL ", " PTRACE_SINGLESTEP
568 .\"O Restarts the stopped child as for
569 .\"O .BR PTRACE_CONT ,
570 .\"O but arranges for
571 .\"O the child to be stopped at the next entry to or exit from a system call,
572 .\"O or after execution of a single instruction, respectively.
573 .\"O (The child will also, as usual, be stopped upon receipt of a signal.)
574 .\"O From the parent's perspective, the child will appear to have been
575 .\"O stopped by receipt of a
576 .\"O .BR SIGTRAP .
577 .\"O So, for
578 .\"O .BR PTRACE_SYSCALL ,
579 .\"O for example, the idea is to inspect
580 .\"O the arguments to the system call at the first stop,
581 .\"O then do another
582 .\"O .B PTRACE_SYSCALL
583 .\"O and inspect the return value of
584 .\"O the system call at the second stop.
585 .\"O The
586 .\"O .I data
587 .\"O argument is treated as for
588 .\"O .BR PTRACE_CONT .
589 .\"O (\fIaddr\fP is ignored.)
590 .B PTRACE_CONT
591 ¤ÈƱÍͤËÄä»ß¤·¤¿»Ò¥×¥í¥»¥¹¤òºÆ³«¤¹¤ë¡£¤¿¤À¤·¡¢
592 .B PTRACE_SYSCALL
593 ¤Î¾ì¹ç¤Ï»Ò¥×¥í¥»¥¹¤¬
594 ¼¡¤Ë¥·¥¹¥Æ¥à¥³¡¼¥ë¤ËÆþ¤ë¤«¥·¥¹¥Æ¥à¥³¡¼¥ë¤«¤éÈ´¤±¤ë¤«¤¹¤ë»þ¤Ë¡¢
595 .B PTRACE_SINGLESTEP
596 ¤Î¾ì¹ç¤Ï 1 Ì¿Îá (instruction) ¼Â¹Ô¤·¤¿¸å¤ËÄä»ß¤µ¤»¤ë
597 (Ä̾ï¤É¤ª¤ê¡¢»Ò¥×¥í¥»¥¹¤Ï¥·¥°¥Ê¥ë¤ò¼õ¤±¼è¤Ã¤¿¾ì¹ç¤Ë¤âÄä»ß¤¹¤ë)¡£
598 ¿Æ¥×¥í¥»¥¹¤«¤é¸«¤ë¤È¡¢»Ò¥×¥í¥»¥¹¤Ï
599 .B SIGTRAP
600 ¤ò¼õ¿®¤·¤ÆÄä»ß¤·¤¿¤è¤¦¤Ë¸«¤¨¤ë¡£¤½¤Î¤¿¤á¡¢Î㤨¤Ð
601 .B PTRACE_SYSCALL
602 ¤ò»È¤¦¤È¡¢1²óÌܤÎÄä»ß¤Ç°ú¤­¿ô¤òÄ´¤Ù¤Æ
603 .B PTRACE_SYSCALL
604 ¤ò¼Â¹Ô¤·¡¢ 2²óÌܤÎÄä»ß¤Ç¥·¥¹¥Æ¥à¥³¡¼¥ë¤ÎÊÖ¤êÃͤòÄ´¤Ù¤ë¡¢
605 ¤È¤¤¤¦¤è¤¦¤Ê¤³¤È¤¬¤Ç¤­¤ë¡£
606 °ú¤­¿ô
607 .I data
608 ¤Ï
609 .B PTRACE_CONT
610 ¤Î¾ì¹ç¤ÈƱ¤¸Íͤ˲ò¼á¤µ¤ì¤ë¡£
611 (\fIaddr\fP ¤Ï̵»ë¤µ¤ì¤ë¡£)
612 .TP
613 .\"O .BR PTRACE_SYSEMU ", " PTRACE_SYSEMU_SINGLESTEP " (since Linux 2.6.14)"
614 .BR PTRACE_SYSEMU ", " PTRACE_SYSEMU_SINGLESTEP " (Linux 2.6.14 °Ê¹ß)"
615 .\"O For
616 .\"O .BR PTRACE_SYSEMU ,
617 .\"O continue and stop on entry to the next syscall,
618 .\"O which will not be executed.
619 .\"O For
620 .\"O .BR PTRACE_SYSEMU_SINGLESTEP ,
621 .\"O do the same
622 .\"O but also singlestep if not a syscall.
623 .\"O This call is used by programs like
624 .\"O User Mode Linux that want to emulate all the child's syscalls.
625 .\"O The
626 .\"O .I data
627 .\"O argument is treated as for
628 .\"O .BR PTRACE_CONT .
629 .\"O (\fIaddr\fP is ignored;
630 .\"O not supported on all architectures.)
631 .B PTRACE_SYSEMU
632 ¤Ï¡¢¼Â¹Ô¤òºÆ³«¤·¡¢¼¡¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤ËÆþ¤ë»þ¤ËÄä»ß¤µ¤»¤ë¡£
633 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¼Â¹Ô¤µ¤ì¤Ê¤¤¡£
634 .B PTRACE_SYSEMU_SINGLESTEP
635 ¤âƱÍͤÀ¤¬¡¢¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ç¤Ê¤¤¾ì¹ç¤Ë¤Ï
636 1 Ì¿Îá (singlestep) ¤À¤±¼Â¹Ô¤·¤¿»þÅÀ¤Ç¤âÄä»ß¤µ¤»¤ë¡£
637 ¤³¤Î¥³¡¼¥ë¤Ï User Mode Linux ¤Î¤è¤¦¤Ë»Ò¥×¥í¥»¥¹¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤òÁ´¤Æ
638 ¥¨¥ß¥å¥ì¡¼¥È¤·¤è¤¦¤È¤¹¤ë¥×¥í¥°¥é¥à¤Ç»ÈÍѤµ¤ì¤ë¡£
639 °ú¤­¿ô
640 .I data
641 ¤Ï
642 .B PTRACE_CONT
643 ¤Î¾ì¹ç¤ÈƱ¤¸Íͤ˲ò¼á¤µ¤ì¤ë¡£
644 (\fIaddr\fP ¤Ï̵»ë¤µ¤ì¤ë¡£
645 Á´¤Æ¤Î¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤Ç¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¤ï¤±¤Ç¤Ï¤Ê¤¤¡£)
646 .TP
647 .B PTRACE_KILL
648 .\"O Sends the child a
649 .\"O .B SIGKILL
650 .\"O to terminate it.
651 .\"O (\fIaddr\fP and \fIdata\fP are ignored.)
652 »Ò¥×¥í¥»¥¹¤Ë
653 .B SIGKILL
654 ¤òÁ÷¤ê½ªÎ»¤µ¤»¤ë¡£(\fIaddr\fP ¤È \fIdata\fP ¤Ï̵»ë¤µ¤ì¤ë¡£)
655 .TP
656 .B PTRACE_ATTACH
657 .\"O Attaches to the process specified in
658 .\"O .IR pid ,
659 .\"O making it a traced "child" of the calling process;
660 .\"O the behavior of the child is as if it had done a
661 .\"O .BR PTRACE_TRACEME .
662 .\"O The calling process actually becomes the parent of the child
663 .\"O process for most purposes (e.g., it will receive
664 .\"O notification of child events and appears in
665 .\"O .BR ps (1)
666 .\"O output as the child's parent), but a
667 .\"O .BR getppid (2)
668 .\"O by the child will still return the PID of the original parent.
669 .\"O The child is sent a
670 .\"O .BR SIGSTOP ,
671 .\"O but will not necessarily have stopped
672 .\"O by the completion of this call; use
673 .\"O .BR wait (2)
674 .\"O to wait for the child to stop.
675 .\"O (\fIaddr\fP and \fIdata\fP are ignored.)
676 .I pid
677 ¤Ç»ØÄꤵ¤ì¤¿¥×¥í¥»¥¹¤ËÀܳ (attach) ¤·¡¢¤½¤ì¤ò¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤Î
678 »Ò¥×¥í¥»¥¹¤È¤·¤Æ¥È¥ì¡¼¥¹¤Ç¤­¤ë¤è¤¦¤Ë¤¹¤ë¡£»Ò¥×¥í¥»¥¹¤Ï
679 .B PTRACE_TRACEME
680 ¤·¤¿¤«¤Î¤è¤¦¤Ë¿¶Éñ¤¦¡£¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤Ï¤½¤Î¤Û¤È¤ó¤É¤ÎÌÜŪ¤Ë¤ª¤¤¤Æ¡¢
681 ¤½¤Î»Ò¥×¥í¥»¥¹¤Î¼ÂºÝ¤Î¿Æ¤Ë¤Ê¤ë (Î㤨¤Ð¡¢»Ò¥×¥í¥»¥¹¤Î¥¤¥Ù¥ó¥È¤Î
682 ÄÌÃΤò¼õ¤±¤È¤Ã¤¿¤ê¡¢
683 .BR ps (1)
684 ¤Ç¿Æ¤È¤·¤Æɽ¼¨¤µ¤ì¤¿¤ê¤¹¤ë)¡£¤·¤«¤·¡¢»Ò¥×¥í¥»¥¹¤Ç
685 .BR getppid (2)
686 ¤ò¼Â¹Ô¤·¤¿¾ì¹ç¤Ë¤Ï¸µ¤Î¿Æ¥×¥í¥»¥¹¤Î PID ¤¬ÊÖ¤µ¤ì¤ë¡£
687 »Ò¥×¥í¥»¥¹¤Ë¤Ï
688 .B SIGSTOP
689 ¤¬Á÷¤é¤ì¤ë¤¬¡¢¤³¤Î¸Æ¤Ó½Ð¤·¤¬´°Î»¤¹¤ë¤Þ¤Ç¤Ë
690 ɬ¤º¤·¤âÄä»ß¤¹¤ë¤È¤Ï¸Â¤é¤Ê¤¤¡£»Ò¥×¥í¥»¥¹¤ÎÄä»ß¤òÂԤĤˤÏ
691 .BR wait (2)
692 ¤ò»ÈÍѤ¹¤ë¤³¤È¡£(\fIaddr\fP ¤È \fIdata\fP ¤Ï̵»ë¤µ¤ì¤ë¡£)
693 .TP
694 .B PTRACE_DETACH
695 .\"O Restarts the stopped child as for
696 .\"O .BR PTRACE_CONT ,
697 .\"O but first detaches
698 .\"O from the process, undoing the reparenting effect of
699 .\"O .BR PTRACE_ATTACH ,
700 .\"O and the effects of
701 .\"O .BR PTRACE_TRACEME .
702 .\"O Although perhaps not intended, under Linux a traced child can be
703 .\"O detached in this way regardless of which method was used to initiate
704 .\"O tracing.
705 .\"O (\fIaddr\fP is ignored.)
706 .B PTRACE_CONT
707 ¤ÈƱÍͤËÄä»ß¤·¤¿»Ò¥×¥í¥»¥¹¤òºÆ³«¤¹¤ë¡£¤¿¤À¤·
708 ¤Þ¤º¤½¤Î¥×¥í¥»¥¹¤«¤é¤ÎʬΥ (detach) ¤ò¹Ô¤¤¡¢
709 .B PTRACE_ATTACH
710 ¤Ç¤Î¿Æ¤ÎÀڤ괹¤¨¤Ë¤è¤ë¸ú²Ì¤È
711 .B PTRACE_TRACEME
712 ¤Î¸ú²Ì¤ò¼è¤ê¾Ã¤¹¡£°Õ¿Þ¤·¤¿¤â¤Î¤Ç¤Ï¤Ê¤¤¤À¤í¤¦¤¬¡¢
713 Linux ¤Ç¤Ï¡¢¥È¥ì¡¼¥¹¤µ¤ì¤Æ¤¤¤ë»Ò¥×¥í¥»¥¹¤Ï¤É¤Î¤è¤¦¤ÊÊýË¡¤Ç¥È¥ì¡¼¥¹¤ò
714 ³«»Ï¤µ¤ì¤¿¤È¤·¤Æ¤â¡¢¤³¤ÎÊýË¡¤ÇʬΥ (detach) ¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
715 (\fIaddr\fP ¤Ï̵»ë¤µ¤ì¤ë¡£)
716 .\"O .SH "RETURN VALUE"
717 .SH ÊÖ¤êÃÍ
718 .\"O On success,
719 .\"O .B PTRACE_PEEK*
720 .\"O requests return the requested data,
721 .\"O while other requests return zero.
722 .\"O On error, all requests return \-1, and
723 .\"O .I errno
724 .\"O is set appropriately.
725 .\"O Since the value returned by a successful
726 .\"O .B PTRACE_PEEK*
727 .\"O request may be \-1, the caller must check
728 .\"O .I errno
729 .\"O after such requests to determine whether or not an error occurred.
730 À®¸ù¤¹¤ë¤È¡¢
731 .B PTRACE_PEEK*
732 ¤Î¾ì¹ç¤ÏÍ׵ᤷ¤¿¥Ç¡¼¥¿¤òÊÖ¤·¡¢
733 ¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï 0 ¤òÊÖ¤¹¡£
734 ¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤òÊÖ¤·¡¢
735 .I errno
736 ¤¬Å¬ÀÚ¤ËÀßÄꤵ¤ì¤ë¡£
737 .B PTRACE_PEEK*
738 ¤¬À®¸ù¤·¤ÆÊÖ¤¹Ãͤ⡡\-1 ¤Ë¤Ê¤ë¤³¤È¤¬¤¢¤ë¤¿¤á¡¢
739 ¤½¤Î¤è¤¦¤ÊÍ×µá¤Î¾ì¹ç¤Ë¤Ï¡¢¸Æ¤Ó½Ð¤·¸µ¤Ï
740 .I errno
741 ¤òÄ´¤Ù¡¢¥¨¥é¡¼¤«È¯À¸¤·¤¿¤Î¤«¤É¤¦¤«¤òȽÃǤ·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
742 .\"O .SH ERRORS
743 .SH ¥¨¥é¡¼
744 .TP
745 .B EBUSY
746 .\"O (i386 only) There was an error with allocating or freeing a debug
747 .\"O register.
748 (i386 ¤Î¤ß) ¥Ç¥Ð¥Ã¥°¥ì¥¸¥¹¥¿¤Î³ÎÊݤޤ¿¤Ï²òÊü¤Ç¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
749 .TP
750 .B EFAULT
751 .\"O There was an attempt to read from or write to an invalid area in
752 .\"O the parent's or child's memory,
753 .\"O probably because the area wasn't mapped or accessible.
754 .\"O Unfortunately, under Linux, different variations of this fault
755 .\"O will return
756 .\"O .B EIO
757 .\"O or
758 .\"O .B EFAULT
759 .\"O more or less arbitrarily.
760 ¿Æ¥×¥í¥»¥¹¤Þ¤¿¤Ï»Ò¥×¥í¥»¥¹¤Î¥á¥â¥ê¤ÎÉÔÀµ¤ÊÎΰè¤ËÆɤ߽ñ¤­¤·¤è¤¦¤È¤·¤¿¡£
761 ¤ª¤½¤é¤¯¤½¤ÎÎΰ褬¥Þ¥Ã¥Ô¥ó¥°¤µ¤ì¤Æ¤¤¤Ê¤¤¤«¡¢
762 ¤½¤ÎÎΰè¤Ø¤Î¥¢¥¯¥»¥¹¤¬µö¤µ¤ì¤Æ¤¤¤Ê¤¤¤«¤Ç¤¢¤ë¡£
763 ÉÔ±¿¤Ê¤³¤È¤Ë¡¢Linux ¤Ç¤Ï¤³¤Î¤è¤¦¤Ê¥¨¥é¡¼¤Î¾ì¹ç¡¢Â¿¤«¤ì¾¯¤Ê¤«¤ì
764 ×ó°ÕŪ¤Ë
765 .B EIO
766 ¤òÊÖ¤·¤¿¤ê
767 .B EFAULT
768 ¤òÊÖ¤·¤¿¤ê¤¹¤ë¤³¤È¤¬¤¢¤ë¡£
769 .TP
770 .B EINVAL
771 .\"O An attempt was made to set an invalid option.
772 ÉÔÀµ¤Ê¥ª¥×¥·¥ç¥ó¤òÀßÄꤷ¤è¤¦¤È¤·¤¿¡£
773 .TP
774 .B EIO
775 .\"O \fIrequest\fP is invalid, or an attempt was made to read from or
776 .\"O write to an invalid area in the parent's or child's memory,
777 .\"O or there was a word-alignment violation,
778 .\"O or an invalid signal was specified during a restart request.
779 \fIrequest\fP ¤¬ÉÔÀµ¤Ç¤¢¤ë¡£
780 ¤Þ¤¿¤Ï¡¢¿Æ¥×¥í¥»¥¹¤Þ¤¿¤Ï»Ò¥×¥í¥»¥¹¤Î¥á¥â¥ê¤Î
781 ÉÔÀµ¤ÊÎΰè¤ËÆɤ߽ñ¤­¤·¤è¤¦¤È¤·¤¿¡£
782 ¤Þ¤¿¤Ï¡¢¥ï¡¼¥É¶­³¦°ãÈ¿¤¬¤¢¤Ã¤¿¡£
783 ¤Þ¤¿¤Ï¡¢¼Â¹ÔºÆ³«¤ÎÍ×µá¤ÇÉÔÀµ¤Ê¥·¥°¥Ê¥ë¤ò»ØÄꤷ¤¿¡£
784 .TP
785 .B EPERM
786 .\"O The specified process cannot be traced.
787 .\"O This could be because the
788 .\"O parent has insufficient privileges (the required capability is
789 .\"O .BR CAP_SYS_PTRACE );
790 .\"O unprivileged processes cannot trace processes that they
791 .\"O cannot send signals to or those running
792 .\"O set-user-ID/set-group-ID programs, for obvious reasons.
793 .\"O Alternatively, the process may already be being traced, or be
794 .\"O .BR init (8)
795 .\"O (PID 1).
796 »ØÄꤷ¤¿¥×¥í¥»¥¹¤ò¥È¥ì¡¼¥¹¤¹¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¤¡£¤³¤ì¤Ï¿Æ¥×¥í¥»¥¹¤¬
797 ɬÍפʸ¢¸Â (ɬÍפʥ±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤Ï
798 .BR CAP_SYS_PTRACE )
799 ¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¤³¤È¤¬¸¶°ø¤Î¾ì¹ç¤¬¤¢¤ë¡£
800 ʬ¤«¤ê¤ä¤¹¤¤Íýͳ¤òµó¤²¤ë¤Ê¤é¡¢
801 ÈóÆø¢¥×¥í¥»¥¹¤Ï¥·¥°¥Ê¥ë¤òÁ÷¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¤¥×¥í¥»¥¹¤ò¥È¥ì¡¼¥¹¤Ç¤­¤Ê¤¤¤·¡¢
802 set-user-ID/set-group-ID ¥×¥í¥°¥é¥à¤ò¼Â¹Ô¤·¤Æ¤¤¤ë¥×¥í¥»¥¹¤Ï¥È¥ì¡¼¥¹¤Ç¤­¤Ê¤¤¡£
803 ¤Þ¤¿¤Ï¡¢¥×¥í¥»¥¹¤Ï¤¹¤Ç¤Ë¥È¥ì¡¼¥¹Ãæ¤Ç¤¢¤ë¡¢
804 ¤Þ¤¿¤Ï
805 .BR init (8)
806 ¥×¥í¥»¥¹ (PID ¤¬ 1) ¤Ç¤¢¤ë¡£
807 .TP
808 .B ESRCH
809 .\"O The specified process does not exist, or is not currently being traced
810 .\"O by the caller, or is not stopped (for requests that require that).
811 »ØÄꤷ¤¿¥×¥í¥»¥¹¤¬Â¸ºß¤·¤Ê¤¤¡£
812 ¤Þ¤¿¤Ï¡¢»ØÄꤷ¤¿¥×¥í¥»¥¹¤Ï¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤¬
813 ¸½ºß¥È¥ì¡¼¥¹Ãæ¤Î»Ò¥×¥í¥»¥¹¤Ç¤Ï¤Ê¤¤¡£
814 ¤Þ¤¿¤Ï¡¢»ØÄꤷ¤¿¥×¥í¥»¥¹¤¬Ää»ß¤·¤Æ¤¤¤Ê¤¤ (Ää»ß¤·¤Æ¤¤¤ë¤³¤È¤¬É¬ÍפÊÍ×µá¤Î¾ì¹ç)¡£
815 .\"O .SH "CONFORMING TO"
816 .SH ½àµò
817 SVr4, 4.3BSD.
818 .\"O .SH NOTES
819 .SH Ãí°Õ
820 .\"O Although arguments to
821 .\"O .BR ptrace ()
822 .\"O are interpreted according to the prototype given,
823 .\"O glibc currently declares
824 .\"O .BR ptrace ()
825 .\"O as a variadic function with only the \fIrequest\fP argument fixed.
826 .\"O This means that unneeded trailing arguments may be omitted,
827 .\"O though doing so makes use of undocumented
828 .\"O .BR gcc (1)
829 .\"O behavior.
830 .BR ptrace ()
831 ¤Î°ú¤­¿ô¤Ï¾å¤Î¤è¤¦¤Ê¥×¥í¥È¥¿¥¤¥×¤Ë´ð¤Å¤¤¤Æ²ò¼á¤µ¤ì¤ë¤¬¡¢
832 glibc ¤Ç¤Ï¡¢¸½ºß¤Î¤È¤³¤í
833 .BR ptrace ()
834 ¤Ï \fIrequest\fP °ú¤­¿ô¤À¤±¤¬¸ÇÄê¤Î²ÄÊÑĹ°ú¤­¿ô´Ø¿ô¤È¤·¤Æ
835 Àë¸À¤µ¤ì¤Æ¤¤¤ë¡£
836 ¤³¤ì¤ÏɬÍפʤ±¤ì¤Ð»Ä¤ê¤Î°ú¤­¿ô¤Ï¾Êά²Äǽ¤Ç¤¢¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¤¬¡¢
837 ¤½¤ì¤Ï
838 .BR gcc (1)
839 ¤ÎÌÀʸ²½¤µ¤ì¤Æ¤¤¤Ê¤¤Æ°ºî¤òÍøÍѤ·¤Æ¤¤¤ë¤³¤È¤Ë¤Ê¤ë¡£
840 .LP
841 .\"O .BR init (8),
842 .\"O the process with pid 1, may not be traced.
843 .BR init (8)
844 ¤¹¤Ê¤ï¤Á PID ¤¬ 1 ¤Î¥×¥í¥»¥¹¤Ï¥È¥ì¡¼¥¹¤¹¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¤¡£
845 .LP
846 .\"O The layout of the contents of memory and the USER area are quite OS- and
847 .\"O architecture-specific.
848 ¥á¥â¥ê¤ä USER Îΰè¤ÎÆâÍƤäÇÛÃ֤ϠOS ¤´¤È¡¢¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤´¤È¤Ë
849 Èó¾ï¤Ë°Í¸¤¹¤ë¡£
850 .\"O The offset supplied, and the data returned,
851 .\"O might not entirely match with the definition of
852 .\"O .IR "struct user" .
853 .\"O .\" See http://lkml.org/lkml/2008/5/8/375
854 ¥ª¥Õ¥»¥Ã¥È¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢ÊÖ¤µ¤ì¤ë¥Ç¡¼¥¿¤Ï
855 .I "struct user"
856 ¤ÎÄêµÁ¤È´°Á´¤Ë°ìÃפ·¤Ê¤¤¤³¤È¤â¤¢¤ê¤¨¤ë¡£
857 .\" http://lkml.org/lkml/2008/5/8/375 »²¾È¡£
858 .LP
859 .\"O The size of a "word" is determined by the OS variant
860 .\"O (e.g., for 32-bit Linux it is 32 bits, etc.).
861 ¡Ö¥ï¡¼¥É (word) ¡×¤ÎÂ礭¤µ¤Ï OS ¤Ë¤è¤Ã¤Æ·è¤Þ¤ë¡£
862 (Î㤨¤Ð¡¢32 ¥Ó¥Ã¥È¤Î Linux ¤Ç¤Ï 32 ¥Ó¥Ã¥È¤Ç¤¢¤ë¡¢¤Ê¤É¡£)
863 .LP
864 .\"O Tracing causes a few subtle differences in the semantics of
865 .\"O traced processes.
866 .\"O For example, if a process is attached to with
867 .\"O .BR PTRACE_ATTACH ,
868 .\"O its original parent can no longer receive notification via
869 .\"O .BR wait (2)
870 .\"O when it stops, and there is no way for the new parent to
871 .\"O effectively simulate this notification.
872 ¥È¥ì¡¼¥¹¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¥È¥ì¡¼¥¹¤µ¤ì¤ë¥×¥í¥»¥¹¤ÎÆ°ºî¤Ëº³ºÙ¤Ê°ã¤¤¤¬
873 µ¯¤³¤ë¤³¤È¤¬¤¢¤ë¡£Î㤨¤Ð¡¢¥×¥í¥»¥¹¤¬
874 .B PTRACE_ATTACH
875 ¤Ë¤è¤Ã¤ÆÀܳ¤µ¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢¤½¤Î¥×¥í¥»¥¹¤¬Ää»ß¤·¤¿»þ¤Ç¤âËÜÍè¤Î¿Æ¤Ï
876 .BR wait (2)
877 ¤ò»È¤Ã¤ÆÄÌÃΤò¼õ¤±¤ë¤³¤È¤¬¤Ç¤­¤º¡¢¿·¤·¤¤¿Æ¤¬¸úΨ¤è¤¯
878 ¤³¤ÎÄÌÃΤò¿¿»÷¤ëÊýË¡¤â¤Ê¤¤¡£
879 .LP
880 .\"O When the parent receives an event with
881 .\"O .B PTRACE_EVENT_*
882 .\"O set,
883 .\"O the child is not in the normal signal delivery path.
884 .\"O This means the parent cannot do
885 .\"O .BR ptrace (PTRACE_CONT)
886 .\"O with a signal or
887 .\"O .BR ptrace (PTRACE_KILL).
888 .\"O .BR kill (2)
889 .\"O with a
890 .\"O .B SIGKILL
891 .\"O signal can be used instead to kill the child process
892 .\"O after receiving one of these messages.
893 ¿Æ¥×¥í¥»¥¹¤¬
894 .B PTRACE_EVENT_*
895 ¤¬¥»¥Ã¥È¤µ¤ì¤¿¥¤¥Ù¥ó¥È¤ò¼õ¿®¤·¤¿¾ì¹ç¡¢
896 »Ò¥×¥í¥»¥¹¤ÏÄ̾ïÄ̤ê¤Î¥·¥°¥Ê¥ëÇÛÁ÷¤¬¹Ô¤ï¤ì¤ë¾õÂ֤ˤʤ¤¡£
897 ¤Ä¤Þ¤ê¡¢¿Æ¥×¥í¥»¥¹¤¬¡¢
898 ¥·¥°¥Ê¥ë¤Ë¤è¤ê
899 .BR ptrace (PTRACE_CONT)
900 ¤ò¹Ô¤Ã¤¿¤ê¡¢
901 .BR ptrace (PTRACE_KILL)
902 ¤ò¹Ô¤Ã¤¿¤ê¤Ç¤­¤Ê¤¤¤È¤¤¤¦¤³¤È¤Ç¤¢¤ë¡£
903 ¤³¤é¤é¤Î¥á¥Ã¥»¡¼¥¸¤Î¼õ¿®¸å¤Ï¡¢»Ò¥×¥í¥»¥¹¤ò½ªÎ» (kill) ¤¹¤ë¤Î¤Ë¡¢
904 ¥·¥°¥Ê¥ë
905 .B SIGKILL
906 ¤ò»ØÄꤷ¤Æ
907 .BR kill (2)
908 ¤ò¹Ô¤¦ÊýË¡¤òÂå¤ï¤ê¤Ë»ÈÍѤǤ­¤ë¡£
909 .LP
910 .\"O This page documents the way the
911 .\"O .BR ptrace ()
912 .\"O call works currently in Linux.
913 .\"O Its behavior differs noticeably on other flavors of UNIX.
914 .\"O In any case, use of
915 .\"O .BR ptrace ()
916 .\"O is highly OS- and architecture-specific.
917 ¤³¤Î¥Þ¥Ë¥å¥¢¥ë¤Ï¸½ºß¤Î Linux ¤Ë¤ª¤±¤ë
918 .BR ptrace ()
919 ¥³¡¼¥ë¤ÎÆ°ºî¤Ë¤Ä¤¤¤Æµ­½Ò¤·¤Æ¤¤¤ë¡£Â¾¤Î UNIX ¤Ç¤Ï
920 ¤½¤ÎÆ°ºî¤ÏÃø¤·¤¯°Û¤Ê¤ë¡£
921 ¤¤¤«¤Ê¤ë¾ì¹ç¤â
922 .BR ptrace ()
923 ¤ò»È¤¦¤È OS ¤ä¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤ËÈó¾ï¤Ë°Í¸¤·¤¿¤â¤Î¤Ë¤Ê¤ë¡£
924 .LP
925 .\"O The SunOS man page describes
926 .\"O .BR ptrace ()
927 .\"O as "unique and arcane", which it is.
928 .\"O The proc-based debugging interface
929 .\"O present in Solaris 2 implements a superset of
930 .\"O .BR ptrace ()
931 .\"O functionality in a more powerful and uniform way.
932 SunOS ¤Î¥Þ¥Ë¥å¥¢¥ë¡¦¥Ú¡¼¥¸¤Ë¤Ï
933 .BR ptrace ()
934 ¤Ï¡ÖÆÈÆäÇÉԲIJò¡×¤Èµ­½Ò¤µ¤ì¤Æ¤ª¤ê¡¢¤Þ¤µ¤·¤¯¤½¤¦¤Ç¤¢¤ë¡£
935 Solaris 2 ¤Ç¤Ï proc ¥Ù¡¼¥¹¤Î
936 ¥Ç¥Ð¥Ã¥°¤Î¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤È¤·¤Æ
937 .BR ptrace ()
938 ¤Î¾å°Ì¸ß´¹´Ø¿ô¤¬¼ÂÁõ¤µ¤ì¡¢¤è¤ê¶¯ÎϤǰì´ÓÀ­¤Î¤¢¤ë¤â¤Î¤È¤Ê¤Ã¤Æ¤¤¤ë¡£
939 .\"O .SH BUGS
940 .SH ¥Ð¥°
941 .\"O On hosts with 2.6 kernel headers,
942 .\"O .B PTRACE_SETOPTIONS
943 .\"O is declared
944 .\"O with a different value than the one for 2.4.
945 .\"O This leads to applications compiled with such
946 .\"O headers failing when run on 2.4 kernels.
947 .\"O This can be worked around by redefining
948 .\"O .B PTRACE_SETOPTIONS
949 .\"O to
950 .\"O .BR PTRACE_OLDSETOPTIONS ,
951 .\"O if that is defined.
952 ¥«¡¼¥Í¥ë 2.6 ¤Î¥Ø¥Ã¥À¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤¿¥Û¥¹¥È¤Ç¤Ï¡¢
953 .B PTRACE_SETOPTIONS
954 ¤Ï¥«¡¼¥Í¥ë 2.4 ¤Î¥Ø¥Ã¥À¤È¤Ï°Û¤Ê¤ëÃͤÇÀë¸À¤µ¤ì¤ë¡£
955 ¤³¤Î¤¿¤á¡¢¥«¡¼¥Í¥ë 2.6 ¤Î¥Ø¥Ã¥À¤Ç¥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤¿¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï
956 ¥«¡¼¥Í¥ë 2.4 ¤Ç¤ÏÀµ¤·¤¯Æ°ºî¤·¤Ê¤¤¡£
957 ¤³¤ÎÌäÂê¤Ï¡¢
958 .B PTRACE_SETOPTIONS
959 ¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤¿ºÝ¤Ï¡¢
960 .B PTRACE_SETOPTIONS
961 ¤ò
962 .B PTRACE_OLDSETOPTIONS
963 ¤ËÄêµÁ¤·Ä¾¤¹¤³¤È¤ÇÂнè¤Ç¤­¤ë¡£
964 .\"O .SH "SEE ALSO"
965 .SH ´ØÏ¢¹àÌÜ
966 .BR gdb (1),
967 .BR strace (1),
968 .BR execve (2),
969 .BR fork (2),
970 .BR signal (2),
971 .BR wait (2),
972 .BR exec (3),
973 .BR capabilities (7)