perldebug >
5.26.1
との差分
perldebug 5.26.1 と 5.12.1 の差分
1 | 1 | |
2 | 2 | =encoding euc-jp |
3 | 3 | |
4 | 4 | =head1 NAME |
5 | 5 | X<debug> X<debugger> |
6 | 6 | |
7 | 7 | =begin original |
8 | 8 | |
9 | 9 | perldebug - Perl debugging |
10 | 10 | |
11 | 11 | =end original |
12 | 12 | |
13 | 13 | perldebug - Perl のデバッグ |
14 | 14 | |
15 | 15 | =head1 DESCRIPTION |
16 | 16 | |
17 | 17 | =begin original |
18 | 18 | |
19 | First of all, have you tried using | |
19 | First of all, have you tried using the B<-w> switch? | |
20 | L<C<use warnings;>|warnings>? | |
21 | 20 | |
22 | 21 | =end original |
23 | 22 | |
24 | まず最初に | |
23 | まず最初に一言「もう B<-w> スイッチはお使いになりましたか。」 | |
25 | 使ってみましたか? | |
26 | 24 | |
27 | 25 | =begin original |
28 | 26 | |
29 | 27 | If you're new to the Perl debugger, you may prefer to read |
30 | L<perldebtut>, which is a tutorial introduction to the debugger. | |
28 | L<perldebtut>, which is a tutorial introduction to the debugger . | |
31 | 29 | |
32 | 30 | =end original |
33 | 31 | |
34 | 32 | もし Perl デバッガに慣れていないなら、デバッガに関するチュートリアルである |
35 | 33 | L<perldebtut> を読んだ方がいいかもしれません。 |
36 | 34 | |
37 | 35 | =head1 The Perl Debugger |
38 | 36 | |
39 | 37 | =begin original |
40 | 38 | |
41 | 39 | If you invoke Perl with the B<-d> switch, your script runs under the |
42 | 40 | Perl source debugger. This works like an interactive Perl |
43 | 41 | environment, prompting for debugger commands that let you examine |
44 | 42 | source code, set breakpoints, get stack backtraces, change the values of |
45 | 43 | variables, etc. This is so convenient that you often fire up |
46 | 44 | the debugger all by itself just to test out Perl constructs |
47 | 45 | interactively to see what they do. For example: |
48 | 46 | X<-d> |
49 | 47 | |
50 | 48 | =end original |
51 | 49 | |
52 | 50 | Perl を B<-d> スイッチを付けて起動すれば、スクリプトは Perl ソースデバッガ |
53 | 51 | 上で実行されることになります。 |
54 | 52 | これは対話的な Perl 環境のように動作し、 |
55 | 53 | ソースコードの表示、ブレークポイントの設定、スタックのバックトレース、 |
56 | 54 | 変数の値の変更、などを実行するデバッガコマンドを入力できます。 |
57 | 55 | これはとても便利なので、単にやりたいことを対話的に試すために |
58 | 56 | デバッガを起動するようになるでしょう。 |
59 | 57 | 例えば: |
60 | 58 | X<-d> |
61 | 59 | |
62 | 60 | $ perl -d -e 42 |
63 | 61 | |
64 | 62 | =begin original |
65 | 63 | |
66 | 64 | In Perl, the debugger is not a separate program the way it usually is in the |
67 | 65 | typical compiled environment. Instead, the B<-d> flag tells the compiler |
68 | 66 | to insert source information into the parse trees it's about to hand off |
69 | 67 | to the interpreter. That means your code must first compile correctly |
70 | 68 | for the debugger to work on it. Then when the interpreter starts up, it |
71 | 69 | preloads a special Perl library file containing the debugger. |
72 | 70 | |
73 | 71 | =end original |
74 | 72 | |
75 | 73 | しかし、Perl デバッガは典型的なコンパイルされた環境の様に独立した |
76 | 74 | プログラムではありません。 その代わりに、 |
77 | 75 | -d フラグによって、コンパイラがインタプリタに渡すパース木にソース情報を |
78 | 76 | 埋め込むようにしています。これは、ソースがデバッガ上で動作できるためには、 |
79 | 77 | 一度正常にコンパイルできないといけないということです。 |
80 | 78 | それからインタプリタが起動され、デバッガを含む |
81 | 79 | 特別な Perl ライブラリをロードします。 |
82 | 80 | |
83 | 81 | =begin original |
84 | 82 | |
85 | 83 | The program will halt I<right before> the first run-time executable |
86 | 84 | statement (but see below regarding compile-time statements) and ask you |
87 | 85 | to enter a debugger command. Contrary to popular expectations, whenever |
88 | 86 | the debugger halts and shows you a line of code, it always displays the |
89 | 87 | line it's I<about> to execute, rather than the one it has just executed. |
90 | 88 | |
91 | 89 | =end original |
92 | 90 | |
93 | 91 | プログラムは、最初の実行時実行文のI<直前>で停止し |
94 | 92 | (ただし、以下コンパイル時実行文については後述します)、以下に示すいずれかの |
95 | 93 | コマンドが入力されるのを待ちます。 |
96 | 94 | よくある期待とは逆に、 |
97 | 95 | デバッガが停止してある行のコードを表示しているときは、 |
98 | 96 | 直前に実行した行ではなく、常にI<今から実行する>行を表示します。 |
99 | 97 | |
100 | 98 | =begin original |
101 | 99 | |
102 | 100 | Any command not recognized by the debugger is directly executed |
103 | 101 | (C<eval>'d) as Perl code in the current package. (The debugger |
104 | 102 | uses the DB package for keeping its own state information.) |
105 | 103 | |
106 | 104 | =end original |
107 | 105 | |
108 | 106 | デバッガが認識できないコマンドは現在のパッケージ内で Perl のコードとして |
109 | 107 | 実行(C<eval>)されます。 |
110 | 108 | (デバッガは自分自身の状態を保存するために DB パッケージを使います。) |
111 | 109 | |
112 | 110 | =begin original |
113 | 111 | |
114 | 112 | Note that the said C<eval> is bound by an implicit scope. As a |
115 | 113 | result any newly introduced lexical variable or any modified |
116 | 114 | capture buffer content is lost after the eval. The debugger is a |
117 | 115 | nice environment to learn Perl, but if you interactively experiment using |
118 | 116 | material which should be in the same scope, stuff it in one line. |
119 | 117 | |
120 | 118 | =end original |
121 | 119 | |
122 | 120 | C<eval> は暗黙のスコープで区切られていることに注意してください。 |
123 | 121 | 結果として、新しく導入されたレキシカル変数や変更された捕捉バッファの内容は |
124 | 122 | eval の後失われます。 |
125 | 123 | デバッガは Perl を学ぶよい環境ですが、もし同じスコープ内であるべき |
126 | 124 | ものを使って対話的に実験したい場合は、それを 1 行に書いてください。 |
127 | 125 | |
128 | 126 | =begin original |
129 | 127 | |
130 | 128 | For any text entered at the debugger prompt, leading and trailing whitespace |
131 | 129 | is first stripped before further processing. If a debugger command |
132 | 130 | coincides with some function in your own program, merely precede the |
133 | 131 | function with something that doesn't look like a debugger command, such |
134 | 132 | as a leading C<;> or perhaps a C<+>, or by wrapping it with parentheses |
135 | 133 | or braces. |
136 | 134 | |
137 | 135 | =end original |
138 | 136 | |
139 | 137 | デバッガコマンドとして入力された文字列は、まず先頭と末尾の |
140 | 138 | 空白が切り詰められます。 |
141 | 139 | デバッガコマンドがプログラムの関数名と一致する場合、 |
142 | 140 | 関数名の前に C<;> や C<+> のような、デバッガコマンドに見えない文字を |
143 | 141 | 付け加えるか、括弧でくくってください。 |
144 | 142 | |
145 | =head2 Calling the | |
143 | =head2 Calling the debugger | |
146 | 144 | |
147 | 145 | (デバッガを呼び出す) |
148 | 146 | |
149 | 147 | =begin original |
150 | 148 | |
151 | 149 | There are several ways to call the debugger: |
152 | 150 | |
153 | 151 | =end original |
154 | 152 | |
155 | 153 | デバッガを呼び出すにはいくつかの方法があります: |
156 | 154 | |
157 | 155 | =over 4 |
158 | 156 | |
159 | 157 | =item perl -d program_name |
160 | 158 | |
161 | 159 | =begin original |
162 | 160 | |
163 | 161 | On the given program identified by C<program_name>. |
164 | 162 | |
165 | 163 | =end original |
166 | 164 | |
167 | 165 | C<program_name> で識別されるプログラムに対して。 |
168 | 166 | |
169 | 167 | =item perl -d -e 0 |
170 | 168 | |
171 | 169 | =begin original |
172 | 170 | |
173 | 171 | Interactively supply an arbitrary C<expression> using C<-e>. |
174 | 172 | |
175 | 173 | =end original |
176 | 174 | |
177 | 175 | C<-e> を使って指定された任意の C<expression> を対話的に。 |
178 | 176 | |
179 | =item perl -d: | |
177 | =item perl -d:Ptkdb program_name | |
180 | 178 | |
181 | 179 | =begin original |
182 | 180 | |
183 | Debug a given program via the C<Devel:: | |
181 | Debug a given program via the C<Devel::Ptkdb> GUI. | |
184 | 182 | |
185 | 183 | =end original |
186 | 184 | |
187 | 185 | C<Devel::Ptkdb> GUI 経由で与えられたプログラムをデバッグする。 |
188 | 186 | |
189 | 187 | =item perl -dt threaded_program_name |
190 | 188 | |
191 | 189 | =begin original |
192 | 190 | |
193 | 191 | Debug a given program using threads (experimental). |
194 | 192 | |
195 | 193 | =end original |
196 | 194 | |
197 | 195 | スレッドを使っているプログラムをデバッグする(実験的機能)。 |
198 | 196 | |
199 | 197 | =back |
200 | 198 | |
201 | 199 | =head2 Debugger Commands |
202 | 200 | |
203 | 201 | (デバッガコマンド) |
204 | 202 | |
205 | 203 | =begin original |
206 | 204 | |
207 | 205 | The interactive debugger understands the following commands: |
208 | 206 | |
209 | 207 | =end original |
210 | 208 | |
211 | 209 | 対話式のデバッガは以下のコマンドを理解します: |
212 | 210 | |
213 | 211 | =over 12 |
214 | 212 | |
215 | 213 | =item h |
216 | 214 | X<debugger command, h> |
217 | 215 | |
218 | 216 | =begin original |
219 | 217 | |
220 | 218 | Prints out a summary help message |
221 | 219 | |
222 | 220 | =end original |
223 | 221 | |
224 | 222 | サマリヘルプメッセージを表示します。 |
225 | 223 | |
226 | 224 | =item h [command] |
227 | 225 | |
228 | 226 | =begin original |
229 | 227 | |
230 | 228 | Prints out a help message for the given debugger command. |
231 | 229 | |
232 | 230 | =end original |
233 | 231 | |
234 | 232 | 指定されたコマンドの説明を表示します。 |
235 | 233 | |
236 | 234 | =item h h |
237 | 235 | |
238 | 236 | =begin original |
239 | 237 | |
240 | 238 | The special argument of C<h h> produces the entire help page, which is quite long. |
241 | 239 | |
242 | 240 | =end original |
243 | 241 | |
244 | 242 | C<h h> という特別なコマンドは、かなり長い、ヘルプ全体を表示します。 |
245 | 243 | |
246 | 244 | =begin original |
247 | 245 | |
248 | 246 | If the output of the C<h h> command (or any command, for that matter) scrolls |
249 | 247 | past your screen, precede the command with a leading pipe symbol so |
250 | 248 | that it's run through your pager, as in |
251 | 249 | |
252 | 250 | =end original |
253 | 251 | |
254 | 252 | C<h h> コマンド(や他のコマンドでも)の出力で画面がスクロールしてしまう場合、 |
255 | 253 | 以下のようにコマンドの前にパイプ記号をつけるとページャーを呼び出します: |
256 | 254 | |
257 | 255 | DB> |h h |
258 | 256 | |
259 | 257 | =begin original |
260 | 258 | |
261 | 259 | You may change the pager which is used via C<o pager=...> command. |
262 | 260 | |
263 | 261 | =end original |
264 | 262 | |
265 | 263 | 使用されるページャーは C<O pager=...> コマンドで変更できます。 |
266 | 264 | |
267 | 265 | =item p expr |
268 | 266 | X<debugger command, p> |
269 | 267 | |
270 | 268 | =begin original |
271 | 269 | |
272 | 270 | Same as C<print {$DB::OUT} expr> in the current package. In particular, |
273 | 271 | because this is just Perl's own C<print> function, this means that nested |
274 | 272 | data structures and objects are not dumped, unlike with the C<x> command. |
275 | 273 | |
276 | 274 | =end original |
277 | 275 | |
278 | 276 | 現在のパッケージでの C<print {$DB::OUT} expr> と同じです。 |
279 | 277 | 特に、これは Perl 自身の C<print> 関数なので、 |
280 | 278 | C<x> コマンドと違って、ネストしたデータ構造やオブジェクトはダンプしません。 |
281 | 279 | |
282 | 280 | =begin original |
283 | 281 | |
284 | 282 | The C<DB::OUT> filehandle is opened to F</dev/tty>, regardless of |
285 | 283 | where STDOUT may be redirected to. |
286 | 284 | |
287 | 285 | =end original |
288 | 286 | |
289 | 287 | STDOUT がどこにリダイレクトされていても、 |
290 | 288 | ファイルハンドル C<DB::OUT> は F</dev/tty> に対して |
291 | 289 | オープンされています。 |
292 | 290 | |
293 | 291 | =item x [maxdepth] expr |
294 | 292 | X<debugger command, x> |
295 | 293 | |
296 | 294 | =begin original |
297 | 295 | |
298 | 296 | Evaluates its expression in list context and dumps out the result in a |
299 | 297 | pretty-printed fashion. Nested data structures are printed out |
300 | 298 | recursively, unlike the real C<print> function in Perl. When dumping |
301 | 299 | hashes, you'll probably prefer 'x \%h' rather than 'x %h'. |
302 | 300 | See L<Dumpvalue> if you'd like to do this yourself. |
303 | 301 | |
304 | 302 | =end original |
305 | 303 | |
306 | 304 | 式をリストコンテキストで評価し、結果を多少読みやすい形で表示します。 |
307 | ネストしたデータは再帰的に表示します | |
305 | ネストしたデータは再帰的に表示します。 | |
308 | 異なります。 | |
306 | これは Perl の実際の C<print> 関数とは異なります。 | |
309 | ||
307 | When dumping | |
308 | hashes, you'll probably prefer 'x \%h' rather than 'x %h'. | |
310 | 309 | これを自分自身で行いたい場合は L<Dumpvalue> を参照して下さい。 |
311 | 310 | |
312 | 311 | =begin original |
313 | 312 | |
314 | 313 | The output format is governed by multiple options described under |
315 | L< | |
314 | L<"Configurable Options">. | |
316 | 315 | |
317 | 316 | =end original |
318 | 317 | |
319 | 出力フォーマットは L<" | |
318 | 出力フォーマットは L<"Configurable Options"> に記された | |
320 | 319 | 様々なオプションの影響を受けます。 |
321 | 320 | |
322 | 321 | =begin original |
323 | 322 | |
324 | 323 | If the C<maxdepth> is included, it must be a numeral I<N>; the value is |
325 | 324 | dumped only I<N> levels deep, as if the C<dumpDepth> option had been |
326 | 325 | temporarily set to I<N>. |
327 | 326 | |
328 | 327 | =end original |
329 | 328 | |
330 | 329 | C<maxdepth> が指定されている場合、それは数値 I<N> でなければなりません; |
331 | 330 | C<dumpDepth> オプションが一時的に I<N> に設定されたかのように、 |
332 | 331 | 値は I<N> レベルの深さでだけダンプされます。 |
333 | 332 | |
334 | 333 | =item V [pkg [vars]] |
335 | 334 | X<debugger command, V> |
336 | 335 | |
337 | 336 | =begin original |
338 | 337 | |
339 | 338 | Display all (or some) variables in package (defaulting to C<main>) |
340 | 339 | using a data pretty-printer (hashes show their keys and values so |
341 | 340 | you see what's what, control characters are made printable, etc.). |
342 | 341 | Make sure you don't put the type specifier (like C<$>) there, just |
343 | 342 | the symbol names, like this: |
344 | 343 | |
345 | 344 | =end original |
346 | 345 | |
347 | 346 | package (デフォルトは C<main>) 内のすべて (または、一部) の |
348 | 347 | 変数 (variable) をデータプリティプリンタを使って表示します |
349 | 348 | (ハッシュは何が何か解るように、key と value を表示し、 |
350 | 349 | コントロール文字は表示できる形にします)。 |
351 | 350 | 以下に示すように、symbol は名前だけを示し、(C<$> などの) 型識別子を |
352 | 351 | 付けないようにしてください: |
353 | 352 | |
354 | 353 | V DB filename line |
355 | 354 | |
356 | 355 | =begin original |
357 | 356 | |
358 | 357 | Use C<~pattern> and C<!pattern> for positive and negative regexes. |
359 | 358 | |
360 | 359 | =end original |
361 | 360 | |
362 | 361 | 正と逆の正規表現のためには C<~pattern> と C<!pattern> を使ってください。 |
363 | 362 | |
364 | 363 | =begin original |
365 | 364 | |
366 | 365 | This is similar to calling the C<x> command on each applicable var. |
367 | 366 | |
368 | 367 | =end original |
369 | 368 | |
370 | 369 | これは有効な変数のそれぞれについて C<x> を呼び出すのと似ています。 |
371 | 370 | |
372 | 371 | =item X [vars] |
373 | 372 | X<debugger command, X> |
374 | 373 | |
375 | 374 | =begin original |
376 | 375 | |
377 | 376 | Same as C<V currentpackage [vars]>. |
378 | 377 | |
379 | 378 | =end original |
380 | 379 | |
381 | 380 | C<V 現在のパッケージ [vars]> と同じです。 |
382 | 381 | |
383 | 382 | =item y [level [vars]] |
384 | 383 | X<debugger command, y> |
385 | 384 | |
386 | 385 | =begin original |
387 | 386 | |
388 | 387 | Display all (or some) lexical variables (mnemonic: C<mY> variables) |
389 | 388 | in the current scope or I<level> scopes higher. You can limit the |
390 | 389 | variables that you see with I<vars> which works exactly as it does |
391 | 390 | for the C<V> and C<X> commands. Requires the C<PadWalker> module |
392 | 391 | version 0.08 or higher; will warn if this isn't installed. Output |
393 | 392 | is pretty-printed in the same style as for C<V> and the format is |
394 | 393 | controlled by the same options. |
395 | 394 | |
396 | 395 | =end original |
397 | 396 | |
398 | 397 | 現在のスコープや、I<level> だけ高いスコープの全て(またはいくつか)の |
399 | 398 | レキシカル変数を表示します(記憶法: C<mY> 変数)。 |
400 | 399 | C<V> や C<X> コマンドと全く同じように、I<vars> を制定することで |
401 | 400 | 表示される変数を制限できます。 |
402 | 401 | バージョン 0.08 以降の C<PadWalker> モジュールが必要です; |
403 | 402 | もしインストールされていなければ警告されます。 |
404 | 403 | 出力は C<V> コマンドと同じスタイルにフォーマットされ、 |
405 | 404 | このフォーマットは同じオプションで制御されます。 |
406 | 405 | |
407 | 406 | =item T |
408 | 407 | X<debugger command, T> X<backtrace> X<stack, backtrace> |
409 | 408 | |
410 | 409 | =begin original |
411 | 410 | |
412 | 411 | Produce a stack backtrace. See below for details on its output. |
413 | 412 | |
414 | 413 | =end original |
415 | 414 | |
416 | 415 | スタックのバックトレースを行います。出力についての詳細は後述します。 |
417 | 416 | |
418 | 417 | =item s [expr] |
419 | 418 | X<debugger command, s> X<step> |
420 | 419 | |
421 | 420 | =begin original |
422 | 421 | |
423 | 422 | Single step. Executes until the beginning of another |
424 | 423 | statement, descending into subroutine calls. If an expression is |
425 | 424 | supplied that includes function calls, it too will be single-stepped. |
426 | 425 | |
427 | 426 | =end original |
428 | 427 | |
429 | 428 | シングルステップ実行します。 |
430 | 429 | サブルーチンをたどりながら、別の実行文の先頭に到達するまで実行します。 |
431 | 430 | 関数呼び出しを含む式が与えられた場合、これもシングルステップ実行します。 |
432 | 431 | |
433 | 432 | =item n [expr] |
434 | 433 | X<debugger command, n> |
435 | 434 | |
436 | 435 | =begin original |
437 | 436 | |
438 | 437 | Next. Executes over subroutine calls, until the beginning |
439 | 438 | of the next statement. If an expression is supplied that includes |
440 | 439 | function calls, those functions will be executed with stops before |
441 | 440 | each statement. |
442 | 441 | |
443 | 442 | =end original |
444 | 443 | |
445 | 444 | ネクスト。次の実行文の先頭に到達するまで、サブルーチンにまたがって実行します。 |
446 | 445 | 関数呼び出しを含む式が与えられた場合、 |
447 | 446 | 各行毎に停止しながら関数を実行します。 |
448 | 447 | |
449 | 448 | =item r |
450 | 449 | X<debugger command, r> |
451 | 450 | |
452 | 451 | =begin original |
453 | 452 | |
454 | 453 | Continue until the return from the current subroutine. |
455 | 454 | Dump the return value if the C<PrintRet> option is set (default). |
456 | 455 | |
457 | 456 | =end original |
458 | 457 | |
459 | 458 | 現在のサブルーチンから戻るまで実行します。 |
460 | 459 | C<PrintRet> がセットされていれば(デフォルトではセットされています) |
461 | 460 | 返り値をダンプします。 |
462 | 461 | |
463 | 462 | =item <CR> |
464 | 463 | |
465 | 464 | =begin original |
466 | 465 | |
467 | 466 | Repeat last C<n> or C<s> command. |
468 | 467 | |
469 | 468 | =end original |
470 | 469 | |
471 | 470 | 最後の C<n> または C<s> を繰り返します。 |
472 | 471 | |
473 | 472 | =item c [line|sub] |
474 | 473 | X<debugger command, c> |
475 | 474 | |
476 | 475 | =begin original |
477 | 476 | |
478 | 477 | Continue, optionally inserting a one-time-only breakpoint |
479 | 478 | at the specified line or subroutine. |
480 | 479 | |
481 | 480 | =end original |
482 | 481 | |
483 | 続きを実行します | |
482 | 続きを実行します。 | |
484 | ||
483 | オプションとして、1 回限りのブレークポイントを | |
484 | 指定された行またはサブルーチンに設定します。 | |
485 | 485 | |
486 | 486 | =item l |
487 | 487 | X<debugger command, l> |
488 | 488 | |
489 | 489 | =begin original |
490 | 490 | |
491 | 491 | List next window of lines. |
492 | 492 | |
493 | 493 | =end original |
494 | 494 | |
495 | 495 | 次の 1 画面分をリスト表示します。 |
496 | 496 | |
497 | 497 | =item l min+incr |
498 | 498 | |
499 | 499 | =begin original |
500 | 500 | |
501 | 501 | List C<incr+1> lines starting at C<min>. |
502 | 502 | |
503 | 503 | =end original |
504 | 504 | |
505 | 505 | C<min> から C<incr+1> 行をリスト表示します。 |
506 | 506 | |
507 | 507 | =item l min-max |
508 | 508 | |
509 | 509 | =begin original |
510 | 510 | |
511 | 511 | List lines C<min> through C<max>. C<l -> is synonymous to C<->. |
512 | 512 | |
513 | 513 | =end original |
514 | 514 | |
515 | 515 | C<min> 行から C<max> 行をリスト表示します。 |
516 | 516 | C<l -> は C<-> と同じです。 |
517 | 517 | |
518 | 518 | =item l line |
519 | 519 | |
520 | 520 | =begin original |
521 | 521 | |
522 | 522 | List a single line. |
523 | 523 | |
524 | 524 | =end original |
525 | 525 | |
526 | 526 | 指定行をリスト表示します。 |
527 | 527 | |
528 | 528 | =item l subname |
529 | 529 | |
530 | 530 | =begin original |
531 | 531 | |
532 | 532 | List first window of lines from subroutine. I<subname> may |
533 | 533 | be a variable that contains a code reference. |
534 | 534 | |
535 | 535 | =end original |
536 | 536 | |
537 | 537 | サブルーチンの最初の一画面分をリスト表示します。 |
538 | 538 | I<subname> は コードリファレンスが入った変数でも構いません。 |
539 | 539 | |
540 | 540 | =item - |
541 | 541 | X<debugger command, -> |
542 | 542 | |
543 | 543 | =begin original |
544 | 544 | |
545 | 545 | List previous window of lines. |
546 | 546 | |
547 | 547 | =end original |
548 | 548 | |
549 | 549 | 前の 1 画面分をリスト表示します。 |
550 | 550 | |
551 | 551 | =item v [line] |
552 | 552 | X<debugger command, v> |
553 | 553 | |
554 | 554 | =begin original |
555 | 555 | |
556 | 556 | View a few lines of code around the current line. |
557 | 557 | |
558 | 558 | =end original |
559 | 559 | |
560 | 560 | 指定行付近の(数行のコードをリスト表示します。 |
561 | 561 | |
562 | 562 | =item . |
563 | 563 | X<debugger command, .> |
564 | 564 | |
565 | 565 | =begin original |
566 | 566 | |
567 | 567 | Return the internal debugger pointer to the line last |
568 | 568 | executed, and print out that line. |
569 | 569 | |
570 | 570 | =end original |
571 | 571 | |
572 | 572 | 最後に実行した行への内部デバッガポインタを返し、 |
573 | 573 | その行を表示します。 |
574 | 574 | |
575 | 575 | =item f filename |
576 | 576 | X<debugger command, f> |
577 | 577 | |
578 | 578 | =begin original |
579 | 579 | |
580 | 580 | Switch to viewing a different file or C<eval> statement. If I<filename> |
581 | 581 | is not a full pathname found in the values of %INC, it is considered |
582 | 582 | a regex. |
583 | 583 | |
584 | 584 | =end original |
585 | 585 | |
586 | 586 | 異なるファイルまたは C<eval> 行に表示を切り替えます。 |
587 | 587 | もし I<filename> が %INC にあるフルパス名でなければ、 |
588 | 588 | 正規表現として扱われます。 |
589 | 589 | |
590 | 590 | =begin original |
591 | 591 | |
592 | 592 | C<eval>ed strings (when accessible) are considered to be filenames: |
593 | 593 | C<f (eval 7)> and C<f eval 7\b> access the body of the 7th C<eval>ed string |
594 | 594 | (in the order of execution). The bodies of the currently executed C<eval> |
595 | 595 | and of C<eval>ed strings that define subroutines are saved and thus |
596 | 596 | accessible. |
597 | 597 | |
598 | 598 | =end original |
599 | 599 | |
600 | 600 | C<eval> した文字列は(アクセス可能なら)ファイル名として扱われます: |
601 | 601 | C<f (eval 7)> と C<f eval 7\b> は (実行した順で) 7 番目に C<eval> した |
602 | 602 | 文字列の中身にアクセスします。 |
603 | 603 | 現在実行した C<eval> の中身と、サブルーチンを定義する C<eval> した |
604 | 604 | 中身は保存されるので、アクセス可能です。 |
605 | 605 | |
606 | 606 | =item /pattern/ |
607 | 607 | |
608 | 608 | =begin original |
609 | 609 | |
610 | 610 | Search forwards for pattern (a Perl regex); final / is optional. |
611 | 611 | The search is case-insensitive by default. |
612 | 612 | |
613 | 613 | =end original |
614 | 614 | |
615 | pattern を用いて Perl 正規表現による前方検索を行います | |
615 | pattern を用いて Perl 正規表現による前方検索を行います。 | |
616 | なくてもかまいません。 | |
616 | 最後の / はなくてもかまいません。 | |
617 | 617 | デフォルトでは検索は大文字小文字を区別しません。 |
618 | 618 | |
619 | 619 | =item ?pattern? |
620 | 620 | |
621 | 621 | =begin original |
622 | 622 | |
623 | 623 | Search backwards for pattern; final ? is optional. |
624 | 624 | The search is case-insensitive by default. |
625 | 625 | |
626 | 626 | =end original |
627 | 627 | |
628 | pattern を用いて後方検索を行います | |
628 | pattern を用いて後方検索を行います。 | |
629 | 最後の ? はなくてもかまいません。 | |
629 | 630 | デフォルトでは検索は大文字小文字を区別しません。 |
630 | 631 | |
631 | 632 | =item L [abw] |
632 | 633 | X<debugger command, L> |
633 | 634 | |
634 | 635 | =begin original |
635 | 636 | |
636 | 637 | List (default all) actions, breakpoints and watch expressions |
637 | 638 | |
638 | 639 | =end original |
639 | 640 | |
640 | 641 | ブレークポイント、アクション、ウォッチ式を |
641 | 642 | (デフォルトは全て)リストアップします。 |
642 | 643 | |
643 | 644 | =item S [[!]regex] |
644 | 645 | X<debugger command, S> |
645 | 646 | |
646 | 647 | =begin original |
647 | 648 | |
648 | 649 | List subroutine names [not] matching the regex. |
649 | 650 | |
650 | 651 | =end original |
651 | 652 | |
652 | 653 | regex に一致する(または一致しない)サブルーチン名をリストアップします。 |
653 | 654 | |
654 | =item t | |
655 | =item t | |
655 | 656 | X<debugger command, t> |
656 | 657 | |
657 | 658 | =begin original |
658 | 659 | |
659 | 660 | Toggle trace mode (see also the C<AutoTrace> option). |
660 | Optional argument is the maximum number of levels to trace below | |
661 | the current one; anything deeper than that will be silent. | |
662 | 661 | |
663 | 662 | =end original |
664 | 663 | |
665 | トレースモードの on/off を切り替えます | |
664 | トレースモードの on/off を切り替えます。(C<AutoTrace> | |
666 | 参照して下さい) | |
665 | オプションも参照して下さい) | |
667 | オプションの引数は現在のもの以下でトレースする最大レベル数です; | |
668 | これよりも深いものは沈黙します。 | |
669 | 666 | |
670 | =item t | |
667 | =item t expr | |
671 | 668 | X<debugger command, t> |
672 | 669 | |
673 | 670 | =begin original |
674 | 671 | |
675 | 672 | Trace through execution of C<expr>. |
676 | Optional first argument is the maximum number of levels to trace below | |
677 | the current one; anything deeper than that will be silent. | |
678 | 673 | See L<perldebguts/"Frame Listing Output Examples"> for examples. |
679 | 674 | |
680 | 675 | =end original |
681 | 676 | |
682 | 677 | C<expr> の実行をトレースします。 |
683 | オプションの引数は現在のもの以下でトレースする最大レベル数です; | |
684 | これよりも深いものは沈黙します。 | |
685 | 678 | 例については L<perldebguts/"Frame Listing Output Examples"> を |
686 | 679 | 参照して下さい。 |
687 | 680 | |
688 | 681 | =item b |
689 | 682 | X<breakpoint> |
690 | 683 | X<debugger command, b> |
691 | 684 | |
692 | 685 | =begin original |
693 | 686 | |
694 | 687 | Sets breakpoint on current line |
695 | 688 | |
696 | 689 | =end original |
697 | 690 | |
698 | 691 | 現在の位置にブレークポイントを設定します。 |
699 | 692 | |
700 | 693 | =item b [line] [condition] |
701 | 694 | X<breakpoint> |
702 | 695 | X<debugger command, b> |
703 | 696 | |
704 | 697 | =begin original |
705 | 698 | |
706 | 699 | Set a breakpoint before the given line. If a condition |
707 | 700 | is specified, it's evaluated each time the statement is reached: a |
708 | 701 | breakpoint is taken only if the condition is true. Breakpoints may |
709 | 702 | only be set on lines that begin an executable statement. Conditions |
710 | 703 | don't use C<if>: |
711 | 704 | |
712 | 705 | =end original |
713 | 706 | |
714 | 707 | 与えられた行の直前にブレークポイントを設定します。 |
715 | condition が指定されると、その文にさしかかる度に評価されます | |
708 | condition が指定されると、その文にさしかかる度に評価されます。 | |
716 | 真となったときにだけブレークポイントが働きます。 | |
709 | condition が真となったときにだけブレークポイントが働きます。 | |
717 | ブレークポイントは、実行可能な文で始まる行にだけ、 | |
710 | ブレークポイントは、実行可能な文で始まる行にだけ、 | |
718 | condition には C<if> を使いません: | |
711 | 設定できます。 condition には C<if> を使いません: | |
719 | 712 | |
720 | 713 | b 237 $x > 30 |
721 | 714 | b 237 ++$count237 < 11 |
722 | 715 | b 33 /pattern/i |
723 | 716 | |
724 | =begin original | |
725 | ||
726 | If the line number is C<.>, sets a breakpoint on the current line: | |
727 | ||
728 | =end original | |
729 | ||
730 | 行番号が C<.> なら、現在行にブレークポイントを設定します: | |
731 | ||
732 | b . $n > 100 | |
733 | ||
734 | =item b [file]:[line] [condition] | |
735 | X<breakpoint> | |
736 | X<debugger command, b> | |
737 | ||
738 | =begin original | |
739 | ||
740 | Set a breakpoint before the given line in a (possibly different) file. If a | |
741 | condition is specified, it's evaluated each time the statement is reached: a | |
742 | breakpoint is taken only if the condition is true. Breakpoints may only be set | |
743 | on lines that begin an executable statement. Conditions don't use C<if>: | |
744 | ||
745 | =end original | |
746 | ||
747 | ブレークポイントを(おそらくは異なった)ファイルの指定された行に設定します。 | |
748 | condition が指定されると、その文にさしかかる度に評価されます: condition が | |
749 | 真となったときにだけブレークポイントが働きます。 | |
750 | ブレークポイントは、実行可能な文で始まる行にだけ、設定できます。 | |
751 | condition には C<if> を使いません: | |
752 | ||
753 | b lib/MyModule.pm:237 $x > 30 | |
754 | b /usr/lib/perl5/site_perl/CGI.pm:100 ++$count100 < 11 | |
755 | ||
756 | 717 | =item b subname [condition] |
757 | 718 | X<breakpoint> |
758 | 719 | X<debugger command, b> |
759 | 720 | |
760 | 721 | =begin original |
761 | 722 | |
762 | 723 | Set a breakpoint before the first line of the named subroutine. I<subname> may |
763 | 724 | be a variable containing a code reference (in this case I<condition> |
764 | 725 | is not supported). |
765 | 726 | |
766 | 727 | =end original |
767 | 728 | |
768 | 729 | サブルーチンの最初の実行可能文にブレークポイントを設定します。 |
769 | 730 | I<subname> は コードリファレンスが入った変数でも構いません |
770 | 731 | (この場合は I<condition> は非対応です)。 |
771 | 732 | |
772 | 733 | =item b postpone subname [condition] |
773 | 734 | X<breakpoint> |
774 | 735 | X<debugger command, b> |
775 | 736 | |
776 | 737 | =begin original |
777 | 738 | |
778 | 739 | Set a breakpoint at first line of subroutine after it is compiled. |
779 | 740 | |
780 | 741 | =end original |
781 | 742 | |
782 | 743 | コンパイル後、サブルーチンの最初の行にブレークポイントをセットします。 |
783 | 744 | |
784 | 745 | =item b load filename |
785 | 746 | X<breakpoint> |
786 | 747 | X<debugger command, b> |
787 | 748 | |
788 | 749 | =begin original |
789 | 750 | |
790 | 751 | Set a breakpoint before the first executed line of the I<filename>, |
791 | 752 | which should be a full pathname found amongst the %INC values. |
792 | 753 | |
793 | 754 | =end original |
794 | 755 | |
795 | I<filename> の最初に実行される行の手前にブレークポイントをセットします | |
756 | I<filename> の最初に実行される行の手前にブレークポイントをセットします。 | |
796 | 757 | これは %INC の値に含まれるフルパス名であるべきです。 |
797 | 758 | |
798 | 759 | =item b compile subname |
799 | 760 | X<breakpoint> |
800 | 761 | X<debugger command, b> |
801 | 762 | |
802 | 763 | =begin original |
803 | 764 | |
804 | 765 | Sets a breakpoint before the first statement executed after the specified |
805 | 766 | subroutine is compiled. |
806 | 767 | |
807 | 768 | =end original |
808 | 769 | |
809 | 770 | 指定されたサブルーチンがコンパイルされた後、最初に実行される文の手前に |
810 | 771 | ブレークポイントをセットします。 |
811 | 772 | |
812 | 773 | =item B line |
813 | 774 | X<breakpoint> |
814 | 775 | X<debugger command, B> |
815 | 776 | |
816 | 777 | =begin original |
817 | 778 | |
818 | 779 | Delete a breakpoint from the specified I<line>. |
819 | 780 | |
820 | 781 | =end original |
821 | 782 | |
822 | 783 | I<line> で指定されたブレークポイントを削除します。 |
823 | 784 | |
824 | 785 | =item B * |
825 | 786 | X<breakpoint> |
826 | 787 | X<debugger command, B> |
827 | 788 | |
828 | 789 | =begin original |
829 | 790 | |
830 | 791 | Delete all installed breakpoints. |
831 | 792 | |
832 | 793 | =end original |
833 | 794 | |
834 | 795 | すべてのブレークポイントを削除します。 |
835 | 796 | |
836 | =item disable [file]:[line] | |
837 | X<breakpoint> | |
838 | X<debugger command, disable> | |
839 | X<disable> | |
840 | ||
841 | =begin original | |
842 | ||
843 | Disable the breakpoint so it won't stop the execution of the program. | |
844 | Breakpoints are enabled by default and can be re-enabled using the C<enable> | |
845 | command. | |
846 | ||
847 | =end original | |
848 | ||
849 | ブレークポイントを向こうにして、プログラムの実行を止めないようにします。 | |
850 | ブレークポイントはデフォルトで有効で、C<enable> コマンドを使って | |
851 | 再有効化できます。 | |
852 | ||
853 | =item disable [line] | |
854 | X<breakpoint> | |
855 | X<debugger command, disable> | |
856 | X<disable> | |
857 | ||
858 | =begin original | |
859 | ||
860 | Disable the breakpoint so it won't stop the execution of the program. | |
861 | Breakpoints are enabled by default and can be re-enabled using the C<enable> | |
862 | command. | |
863 | ||
864 | =end original | |
865 | ||
866 | ブレークポイントを向こうにして、プログラムの実行を止めないようにします。 | |
867 | ブレークポイントはデフォルトで有効で、C<enable> コマンドを使って | |
868 | 再有効化できます。 | |
869 | ||
870 | =begin original | |
871 | ||
872 | This is done for a breakpoint in the current file. | |
873 | ||
874 | =end original | |
875 | ||
876 | これは現在のファイルのブレークポイントに対して行われます。 | |
877 | ||
878 | =item enable [file]:[line] | |
879 | X<breakpoint> | |
880 | X<debugger command, disable> | |
881 | X<disable> | |
882 | ||
883 | =begin original | |
884 | ||
885 | Enable the breakpoint so it will stop the execution of the program. | |
886 | ||
887 | =end original | |
888 | ||
889 | ブレークポイントを有効にして、プログラムの実行を止めるようにします。 | |
890 | ||
891 | =item enable [line] | |
892 | X<breakpoint> | |
893 | X<debugger command, disable> | |
894 | X<disable> | |
895 | ||
896 | =begin original | |
897 | ||
898 | Enable the breakpoint so it will stop the execution of the program. | |
899 | ||
900 | =end original | |
901 | ||
902 | ブレークポイントを有効にして、プログラムの実行を止めるようにします。 | |
903 | ||
904 | =begin original | |
905 | ||
906 | This is done for a breakpoint in the current file. | |
907 | ||
908 | =end original | |
909 | ||
910 | これは現在のファイルのブレークポイントに対して行われます。 | |
911 | ||
912 | 797 | =item a [line] command |
913 | 798 | X<debugger command, a> |
914 | 799 | |
915 | 800 | =begin original |
916 | 801 | |
917 | 802 | Set an action to be done before the line is executed. If I<line> is |
918 | 803 | omitted, set an action on the line about to be executed. |
919 | 804 | The sequence of steps taken by the debugger is |
920 | 805 | |
921 | 806 | =end original |
922 | 807 | |
923 | 808 | その行を実行する前に行うアクションを設定します。 |
924 | 809 | I<line> が省略されると、いままさに実行しようとしていた行に |
925 | 810 | アクションを設定します。 |
926 | 811 | デバッガが実行する処理の順番は以下の通りです。 |
927 | 812 | |
928 | 813 | =begin original |
929 | 814 | |
930 | 815 | 1. check for a breakpoint at this line |
931 | 816 | 2. print the line if necessary (tracing) |
932 | 817 | 3. do any actions associated with that line |
933 | 818 | 4. prompt user if at a breakpoint or in single-step |
934 | 819 | 5. evaluate line |
935 | 820 | |
936 | 821 | =end original |
937 | 822 | |
938 | 823 | 1. この行のブレークポイントをチェックします |
939 | 824 | 2. 必要なら行を表示します(トレース) |
940 | 825 | 3. この行に結び付けられたアクションを実行します |
941 | 826 | 4. ブレークポイントやシングルステップの場合はユーザーに確認します |
942 | 827 | 5. 行を評価します |
943 | 828 | |
944 | 829 | =begin original |
945 | 830 | |
946 | 831 | For example, this will print out $foo every time line |
947 | 832 | 53 is passed: |
948 | 833 | |
949 | 834 | =end original |
950 | 835 | |
951 | 836 | 例えば、以下のコードは 53 行を通過する毎に $foo を表示します。 |
952 | 837 | |
953 | 838 | a 53 print "DB FOUND $foo\n" |
954 | 839 | |
955 | 840 | =item A line |
956 | 841 | X<debugger command, A> |
957 | 842 | |
958 | 843 | =begin original |
959 | 844 | |
960 | 845 | Delete an action from the specified line. |
961 | 846 | |
962 | 847 | =end original |
963 | 848 | |
964 | 849 | 指定された行に設定されたアクションを削除します。 |
850 | I<line> が省略されると、いままさに実行しようとしている行に設定されている | |
851 | アクションが削除されます。 | |
965 | 852 | |
966 | 853 | =item A * |
967 | 854 | X<debugger command, A> |
968 | 855 | |
969 | 856 | =begin original |
970 | 857 | |
971 | 858 | Delete all installed actions. |
972 | 859 | |
973 | 860 | =end original |
974 | 861 | |
975 | 862 | 設定されたすべてのアクションを削除します。 |
976 | 863 | |
977 | 864 | =item w expr |
978 | 865 | X<debugger command, w> |
979 | 866 | |
980 | 867 | =begin original |
981 | 868 | |
982 | 869 | Add a global watch-expression. Whenever a watched global changes the |
983 | 870 | debugger will stop and display the old and new values. |
984 | 871 | |
985 | 872 | =end original |
986 | 873 | |
987 | 874 | グローバルなウォッチ式を追加します。 |
988 | 875 | グローバルな変更が行われたときは、デバッガは停止して新旧の値を表示します。 |
989 | 876 | |
990 | 877 | =item W expr |
991 | 878 | X<debugger command, W> |
992 | 879 | |
993 | 880 | =begin original |
994 | 881 | |
995 | 882 | Delete watch-expression |
996 | 883 | |
997 | 884 | =end original |
998 | 885 | |
999 | 886 | ウォッチ式を削除します。 |
1000 | 887 | |
1001 | 888 | =item W * |
1002 | 889 | X<debugger command, W> |
1003 | 890 | |
1004 | 891 | =begin original |
1005 | 892 | |
1006 | 893 | Delete all watch-expressions. |
1007 | 894 | |
1008 | 895 | =end original |
1009 | 896 | |
1010 | 897 | 全てのウォッチ式を削除します。 |
1011 | 898 | |
1012 | 899 | =item o |
1013 | 900 | X<debugger command, o> |
1014 | 901 | |
1015 | 902 | =begin original |
1016 | 903 | |
1017 | Display all options | |
904 | Display all options | |
1018 | 905 | |
1019 | 906 | =end original |
1020 | 907 | |
1021 | 908 | 全てのオプションを表示します。 |
1022 | 909 | |
1023 | 910 | =item o booloption ... |
1024 | 911 | X<debugger command, o> |
1025 | 912 | |
1026 | 913 | =begin original |
1027 | 914 | |
1028 | 915 | Set each listed Boolean option to the value C<1>. |
1029 | 916 | |
1030 | 917 | =end original |
1031 | 918 | |
1032 | 919 | リストされた各真偽値オプションの値を C<1> に設定します。 |
1033 | 920 | |
1034 | 921 | =item o anyoption? ... |
1035 | 922 | X<debugger command, o> |
1036 | 923 | |
1037 | 924 | =begin original |
1038 | 925 | |
1039 | 926 | Print out the value of one or more options. |
1040 | 927 | |
1041 | 928 | =end original |
1042 | 929 | |
1043 | 930 | 1 つ、あるいは複数のオプションの値を表示します。 |
1044 | 931 | |
1045 | 932 | =item o option=value ... |
1046 | 933 | X<debugger command, o> |
1047 | 934 | |
1048 | 935 | =begin original |
1049 | 936 | |
1050 | 937 | Set the value of one or more options. If the value has internal |
1051 | 938 | whitespace, it should be quoted. For example, you could set C<o |
1052 | 939 | pager="less -MQeicsNfr"> to call B<less> with those specific options. |
1053 | 940 | You may use either single or double quotes, but if you do, you must |
1054 | 941 | escape any embedded instances of same sort of quote you began with, |
1055 | 942 | as well as any escaping any escapes that immediately precede that |
1056 | 943 | quote but which are not meant to escape the quote itself. In other |
1057 | 944 | words, you follow single-quoting rules irrespective of the quote; |
1058 | 945 | eg: C<o option='this isn\'t bad'> or C<o option="She said, \"Isn't |
1059 | 946 | it?\"">. |
1060 | 947 | |
1061 | 948 | =end original |
1062 | 949 | |
1063 | 950 | 一つまたは複数のオプションをセットします。 |
1064 | 951 | 値自身に空白を含む場合、クォートする必要があります。 |
1065 | 952 | 例えば、B<less> をオプション付きで呼び出す場合は |
1066 | 953 | C<o pager="less -MQeicsNfr"> のようにします。 |
1067 | 954 | シングルクォートとダブルクォートのどちらでも使えますが、クォートする場合は、 |
1068 | 955 | クォート文字と同じ文字はエスケープする必要があります; |
1069 | 956 | そしてエスケープ文字自身もエスケープして、クォート文字を |
1070 | 957 | エスケープしているのではないことを示す必要があります。 |
1071 | 958 | 言い換えると、クォートに関わりなく、シングルクォートルールに従います; |
1072 | 959 | 例えば: C<o option='this isn\'t bad'> や |
1073 | 960 | C<o option="She said, \"Isn't it?\""> |
1074 | 961 | |
1075 | 962 | =begin original |
1076 | 963 | |
1077 | 964 | For historical reasons, the C<=value> is optional, but defaults to |
1078 | 965 | 1 only where it is safe to do so--that is, mostly for Boolean |
1079 | 966 | options. It is always better to assign a specific value using C<=>. |
1080 | 967 | The C<option> can be abbreviated, but for clarity probably should |
1081 | not be. Several options can be set together. See L< | |
968 | not be. Several options can be set together. See L<"Configurable Options"> | |
1082 | 969 | for a list of these. |
1083 | 970 | |
1084 | 971 | =end original |
1085 | 972 | |
1086 | 973 | 歴史的な理由により、C<=value> は省略可能ですが、そうするのが安全な場合にのみ |
1087 | 974 | デフォルトは 1 です -- これは、ほとんどの場合ブール値オプションです。 |
1088 | 975 | C<=> を使って指定した値を代入する方が常によいです。 |
1089 | 976 | C<option> は短縮できますが、明確化のためにはそうしない方がいいでしょう。 |
1090 | 977 | いくつかのオプションは互いにセットできます。 |
1091 | それらの一覧については L<" | |
978 | それらの一覧については L<"Configurable Options"> を参照してください。 | |
1092 | 979 | |
1093 | 980 | =item < ? |
1094 | 981 | X<< debugger command, < >> |
1095 | 982 | |
1096 | 983 | =begin original |
1097 | 984 | |
1098 | 985 | List out all pre-prompt Perl command actions. |
1099 | 986 | |
1100 | 987 | =end original |
1101 | 988 | |
1102 | 989 | プロンプト表示前に実行するアクションを全て表示します。 |
1103 | 990 | |
1104 | 991 | =item < [ command ] |
1105 | 992 | X<< debugger command, < >> |
1106 | 993 | |
1107 | 994 | =begin original |
1108 | 995 | |
1109 | 996 | Set an action (Perl command) to happen before every debugger prompt. |
1110 | 997 | A multi-line command may be entered by backslashing the newlines. |
1111 | 998 | |
1112 | 999 | =end original |
1113 | 1000 | |
1114 | 1001 | デバッガがプロンプトを出す直前に、毎回実行するアクション |
1115 | 1002 | (Perl のコマンド)を設定します。 |
1116 | 1003 | 複数行の command は、バックスラッシュと改行で書くことができます。 |
1117 | 1004 | |
1118 | 1005 | =item < * |
1119 | 1006 | X<< debugger command, < >> |
1120 | 1007 | |
1121 | 1008 | =begin original |
1122 | 1009 | |
1123 | 1010 | Delete all pre-prompt Perl command actions. |
1124 | 1011 | |
1125 | 1012 | =end original |
1126 | 1013 | |
1127 | 1014 | プロンプト表示前に実行するアクションを全て削除します。 |
1128 | 1015 | |
1129 | 1016 | =item << command |
1130 | 1017 | X<< debugger command, << >> |
1131 | 1018 | |
1132 | 1019 | =begin original |
1133 | 1020 | |
1134 | 1021 | Add an action (Perl command) to happen before every debugger prompt. |
1135 | 1022 | A multi-line command may be entered by backwhacking the newlines. |
1136 | 1023 | |
1137 | 1024 | =end original |
1138 | 1025 | |
1139 | 1026 | デバッガがプロンプトを出す直前に、毎回実行するアクション |
1140 | 1027 | (Perl のコマンド)を追加します。 |
1141 | 1028 | 複数行の command は、バックスラッシュと改行で書くことができます。 |
1142 | 1029 | |
1143 | 1030 | =item > ? |
1144 | 1031 | X<< debugger command, > >> |
1145 | 1032 | |
1146 | 1033 | =begin original |
1147 | 1034 | |
1148 | 1035 | List out post-prompt Perl command actions. |
1149 | 1036 | |
1150 | 1037 | =end original |
1151 | 1038 | |
1152 | 1039 | プロンプト表示後に実行するアクションを全て表示します。 |
1153 | 1040 | |
1154 | 1041 | =item > command |
1155 | 1042 | X<< debugger command, > >> |
1156 | 1043 | |
1157 | 1044 | =begin original |
1158 | 1045 | |
1159 | 1046 | Set an action (Perl command) to happen after the prompt when you've |
1160 | 1047 | just given a command to return to executing the script. A multi-line |
1161 | 1048 | command may be entered by backslashing the newlines (we bet you |
1162 | 1049 | couldn't have guessed this by now). |
1163 | 1050 | |
1164 | 1051 | =end original |
1165 | 1052 | |
1166 | 1053 | スクリプトの実行に戻るコマンドを入力した時に、デバッガが |
1167 | 1054 | プロンプトを出した後で、毎回実行するアクション(Perl のコマンド)を設定します。 |
1168 | 1055 | 複数行の command は、バックスラッシュと改行で書くことができます |
1169 | 1056 | (きっとあなたは今までこのことを知らなかったはずです)。 |
1170 | 1057 | |
1171 | 1058 | =item > * |
1172 | 1059 | X<< debugger command, > >> |
1173 | 1060 | |
1174 | 1061 | =begin original |
1175 | 1062 | |
1176 | 1063 | Delete all post-prompt Perl command actions. |
1177 | 1064 | |
1178 | 1065 | =end original |
1179 | 1066 | |
1180 | 1067 | プロンプト表示後に実行するアクションを全て削除します。 |
1181 | 1068 | |
1182 | 1069 | =item >> command |
1183 | 1070 | X<<< debugger command, >> >>> |
1184 | 1071 | |
1185 | 1072 | =begin original |
1186 | 1073 | |
1187 | 1074 | Adds an action (Perl command) to happen after the prompt when you've |
1188 | 1075 | just given a command to return to executing the script. A multi-line |
1189 | 1076 | command may be entered by backslashing the newlines. |
1190 | 1077 | |
1191 | 1078 | =end original |
1192 | 1079 | |
1193 | 1080 | スクリプトの実行に戻るコマンドを入力した時に、デバッガが |
1194 | 1081 | プロンプトを出した後で、毎回実行するアクション(Perl のコマンド)を追加します。 |
1195 | 1082 | 複数行の command は、バックスラッシュと改行で書くことができます。 |
1196 | 1083 | |
1197 | 1084 | =item { ? |
1198 | 1085 | X<debugger command, {> |
1199 | 1086 | |
1200 | 1087 | =begin original |
1201 | 1088 | |
1202 | 1089 | List out pre-prompt debugger commands. |
1203 | 1090 | |
1204 | 1091 | =end original |
1205 | 1092 | |
1206 | 1093 | プロンプト表示前に実行するデバッガコマンドを表示します。 |
1207 | 1094 | |
1208 | 1095 | =item { [ command ] |
1209 | 1096 | |
1210 | 1097 | =begin original |
1211 | 1098 | |
1212 | 1099 | Set an action (debugger command) to happen before every debugger prompt. |
1213 | 1100 | A multi-line command may be entered in the customary fashion. |
1214 | 1101 | |
1215 | 1102 | =end original |
1216 | 1103 | |
1217 | 1104 | デバッガがプロンプトを出す前に、毎回実行するアクション(デバッガの |
1218 | 1105 | コマンド)を設定します。 |
1219 | 1106 | 複数行の command は、いつもの方法で書くことができます |
1220 | 1107 | B<警告> もし C<command> がないと、全てのアクションが消えてしまいます! |
1221 | 1108 | |
1222 | 1109 | =begin original |
1223 | 1110 | |
1224 | 1111 | Because this command is in some senses new, a warning is issued if |
1225 | 1112 | you appear to have accidentally entered a block instead. If that's |
1226 | 1113 | what you mean to do, write it as with C<;{ ... }> or even |
1227 | 1114 | C<do { ... }>. |
1228 | 1115 | |
1229 | 1116 | =end original |
1230 | 1117 | |
1231 | 1118 | このコマンドはある意味新しいので、もし代わりに間違ってブロックを |
1232 | 1119 | 入力したように見えるときには、警告が出ます。 |
1233 | 1120 | 本当に奏したい場合は、C<;{ ... }> か、いっそ C<do { ... }> と |
1234 | 1121 | 書いてください。 |
1235 | 1122 | |
1236 | 1123 | =item { * |
1237 | 1124 | X<debugger command, {> |
1238 | 1125 | |
1239 | 1126 | =begin original |
1240 | 1127 | |
1241 | 1128 | Delete all pre-prompt debugger commands. |
1242 | 1129 | |
1243 | 1130 | =end original |
1244 | 1131 | |
1245 | 1132 | プロンプト前に実行するデバッガコマンドを全て削除します。 |
1246 | 1133 | |
1247 | 1134 | =item {{ command |
1248 | 1135 | X<debugger command, {{> |
1249 | 1136 | |
1250 | 1137 | =begin original |
1251 | 1138 | |
1252 | 1139 | Add an action (debugger command) to happen before every debugger prompt. |
1253 | 1140 | A multi-line command may be entered, if you can guess how: see above. |
1254 | 1141 | |
1255 | 1142 | =end original |
1256 | 1143 | |
1257 | 1144 | 毎回デバッガプロンプトを表示する前に実行するアクション(デバッガコマンド)を |
1258 | 1145 | 追加します。予測可能な方法な方法で複数行コマンドも登録できます: |
1259 | 1146 | 上記を参照してください。 |
1260 | 1147 | |
1261 | 1148 | =item ! number |
1262 | 1149 | X<debugger command, !> |
1263 | 1150 | |
1264 | 1151 | =begin original |
1265 | 1152 | |
1266 | 1153 | Redo a previous command (defaults to the previous command). |
1267 | 1154 | |
1268 | 1155 | =end original |
1269 | 1156 | |
1270 | 以前のコマンドを再実行します(number が省略されると、直前のコマンドを | |
1157 | 以前のコマンドを再実行します。(number が省略されると、直前のコマンドを実行します) | |
1271 | 実行します)。 | |
1272 | 1158 | |
1273 | 1159 | =item ! -number |
1274 | 1160 | X<debugger command, !> |
1275 | 1161 | |
1276 | 1162 | =begin original |
1277 | 1163 | |
1278 | 1164 | Redo number'th previous command. |
1279 | 1165 | |
1280 | 1166 | =end original |
1281 | 1167 | |
1282 | 1168 | 指定数値分前のコマンドを実行します。 |
1283 | 1169 | |
1284 | 1170 | =item ! pattern |
1285 | 1171 | X<debugger command, !> |
1286 | 1172 | |
1287 | 1173 | =begin original |
1288 | 1174 | |
1289 | 1175 | Redo last command that started with pattern. |
1290 | 1176 | See C<o recallCommand>, too. |
1291 | 1177 | |
1292 | 1178 | =end original |
1293 | 1179 | |
1294 | 1180 | pattern で始まるうち、最も最近に実行されたコマンドを |
1295 | 1181 | 再実行します。 |
1296 | 1182 | C<O recallCommand> も参照して下さい。 |
1297 | 1183 | |
1298 | 1184 | =item !! cmd |
1299 | 1185 | X<debugger command, !!> |
1300 | 1186 | |
1301 | 1187 | =begin original |
1302 | 1188 | |
1303 | 1189 | Run cmd in a subprocess (reads from DB::IN, writes to DB::OUT) See |
1304 | 1190 | C<o shellBang>, also. Note that the user's current shell (well, |
1305 | 1191 | their C<$ENV{SHELL}> variable) will be used, which can interfere |
1306 | 1192 | with proper interpretation of exit status or signal and coredump |
1307 | 1193 | information. |
1308 | 1194 | |
1309 | 1195 | =end original |
1310 | 1196 | |
1311 | cmd をサブプロセスとして実行します(DB::IN から読み込み、DB::OUT に | |
1197 | cmd をサブプロセスとして実行します(DB::IN から読み込み、DB::OUT に書き出します)。 | |
1312 | 書き出します)。 | |
1313 | 1198 | C<O shellBang> も参照してください。 |
1314 | 1199 | ユーザーの現在のシェル(つまり、 C<$ENV{SHELL}> 変数)が使われるので、 |
1315 | 1200 | 終了コードの適切な解釈やシグナルとコアダンプの情報が妨害されるかもしれない |
1316 | 1201 | ことに注意してください。 |
1317 | 1202 | |
1318 | 1203 | =item source file |
1319 | 1204 | X<debugger command, source> |
1320 | 1205 | |
1321 | 1206 | =begin original |
1322 | 1207 | |
1323 | 1208 | Read and execute debugger commands from I<file>. |
1324 | 1209 | I<file> may itself contain C<source> commands. |
1325 | 1210 | |
1326 | 1211 | =end original |
1327 | 1212 | |
1328 | 1213 | デバッガコマンドを I<file> から読み込んで実行します。 |
1329 | 1214 | I<file> 自身に C<source> コマンドを含んでいても構いません。 |
1330 | 1215 | |
1331 | 1216 | =item H -number |
1332 | 1217 | X<debugger command, H> |
1333 | 1218 | |
1334 | 1219 | =begin original |
1335 | 1220 | |
1336 | 1221 | Display last n commands. Only commands longer than one character are |
1337 | 1222 | listed. If I<number> is omitted, list them all. |
1338 | 1223 | |
1339 | 1224 | =end original |
1340 | 1225 | |
1341 | 1226 | 最近の指定数値分のコマンドを表示します。 |
1342 | 1227 | 2 文字以上のコマンドのみが表示されます。 |
1343 | 1228 | I<number> が省略されると、全てを表示します。 |
1344 | 1229 | |
1345 | 1230 | =item q or ^D |
1346 | 1231 | X<debugger command, q> |
1347 | 1232 | X<debugger command, ^D> |
1348 | 1233 | |
1349 | 1234 | =begin original |
1350 | 1235 | |
1351 | 1236 | Quit. ("quit" doesn't work for this, unless you've made an alias) |
1352 | 1237 | This is the only supported way to exit the debugger, though typing |
1353 | 1238 | C<exit> twice might work. |
1354 | 1239 | |
1355 | 1240 | =end original |
1356 | 1241 | |
1357 | 1242 | デバッガを終了します。 |
1358 | 1243 | (エイリアスを設定しない限り、"quit" はこの目的には使えません。) |
1359 | 1244 | これはデバッガを終了する唯一の方法ですが、C<exit> を2回 |
1360 | 1245 | 入力しても動作します。 |
1361 | 1246 | |
1362 | 1247 | =begin original |
1363 | 1248 | |
1364 | 1249 | Set the C<inhibit_exit> option to 0 if you want to be able to step |
1365 | 1250 | off the end the script. You may also need to set $finished to 0 |
1366 | 1251 | if you want to step through global destruction. |
1367 | 1252 | |
1368 | 1253 | =end original |
1369 | 1254 | |
1370 | 1255 | スクリプトの最後にステップ実行できるようにしたい場合は、 |
1371 | 1256 | C<inhibit_exit> オプションに 0 を設定してください。 |
1372 | 1257 | グローバルなデストラクタを実行してステップ実行したい場合は、 |
1373 | 1258 | $finished に 0 を設定する必要があります。 |
1374 | 1259 | |
1375 | 1260 | =item R |
1376 | 1261 | X<debugger command, R> |
1377 | 1262 | |
1378 | 1263 | =begin original |
1379 | 1264 | |
1380 | 1265 | Restart the debugger by C<exec()>ing a new session. We try to maintain |
1381 | 1266 | your history across this, but internal settings and command-line options |
1382 | 1267 | may be lost. |
1383 | 1268 | |
1384 | 1269 | =end original |
1385 | 1270 | |
1386 | 1271 | 新しいセッションを C<exec()> することでデバッガを再起動します。 |
1387 | 1272 | 履歴は残そうと努力しますが、内部設定やコマンドラインオプションは |
1388 | 1273 | 失われるかもしれません。 |
1389 | 1274 | |
1390 | 1275 | =begin original |
1391 | 1276 | |
1392 | 1277 | The following setting are currently preserved: history, breakpoints, |
1393 | 1278 | actions, debugger options, and the Perl command-line |
1394 | 1279 | options B<-w>, B<-I>, and B<-e>. |
1395 | 1280 | |
1396 | 1281 | =end original |
1397 | 1282 | |
1398 | 1283 | 今のところ、以下の設定は保存されます: 履歴、ブレークポイント、アクション、 |
1399 | 1284 | デバッガオプション、Perl コマンドラインオプション B<-w>, B<-I>, B<-e>。 |
1400 | 1285 | |
1401 | 1286 | =item |dbcmd |
1402 | 1287 | X<debugger command, |> |
1403 | 1288 | |
1404 | 1289 | =begin original |
1405 | 1290 | |
1406 | 1291 | Run the debugger command, piping DB::OUT into your current pager. |
1407 | 1292 | |
1408 | 1293 | =end original |
1409 | 1294 | |
1410 | 1295 | デバッガコマンドを実行し、DB::OUT をパイプであなたの現在のページャと繋ぎます。 |
1411 | 1296 | |
1412 | 1297 | =item ||dbcmd |
1413 | 1298 | X<debugger command, ||> |
1414 | 1299 | |
1415 | 1300 | =begin original |
1416 | 1301 | |
1417 | 1302 | Same as C<|dbcmd> but DB::OUT is temporarily C<select>ed as well. |
1418 | 1303 | |
1419 | 1304 | =end original |
1420 | 1305 | |
1421 | 1306 | C<|dbcmd> と同様ですが、 DB::OUT は一時的に C<select> で |
1422 | 1307 | 選択されているものになります。 |
1423 | 1308 | |
1424 | 1309 | =item = [alias value] |
1425 | 1310 | X<debugger command, => |
1426 | 1311 | |
1427 | 1312 | =begin original |
1428 | 1313 | |
1429 | 1314 | Define a command alias, like |
1430 | 1315 | |
1431 | 1316 | =end original |
1432 | 1317 | |
1433 | 1318 | 以下のようにコマンドエイリアスを定義する: |
1434 | 1319 | |
1435 | 1320 | = quit q |
1436 | 1321 | |
1437 | 1322 | =begin original |
1438 | 1323 | |
1439 | 1324 | or list current aliases. |
1440 | 1325 | |
1441 | 1326 | =end original |
1442 | 1327 | |
1443 | 1328 | または現在のエイリアスの一覧を表示します。 |
1444 | 1329 | |
1445 | 1330 | =item command |
1446 | 1331 | |
1447 | 1332 | =begin original |
1448 | 1333 | |
1449 | 1334 | Execute command as a Perl statement. A trailing semicolon will be |
1450 | 1335 | supplied. If the Perl statement would otherwise be confused for a |
1451 | 1336 | Perl debugger, use a leading semicolon, too. |
1452 | 1337 | |
1453 | 1338 | =end original |
1454 | 1339 | |
1455 | 1340 | command を Perl の文として実行します。文末のセミコロンはなくてもかまいません。 |
1456 | 1341 | Perl の文が Perl デバッガにとって紛らわしい場合は |
1457 | 1342 | 先頭にセミコロンをつけてください。 |
1458 | 1343 | |
1459 | 1344 | =item m expr |
1460 | 1345 | X<debugger command, m> |
1461 | 1346 | |
1462 | 1347 | =begin original |
1463 | 1348 | |
1464 | 1349 | List which methods may be called on the result of the evaluated |
1465 | 1350 | expression. The expression may evaluated to a reference to a |
1466 | 1351 | blessed object, or to a package name. |
1467 | 1352 | |
1468 | 1353 | =end original |
1469 | 1354 | |
1470 | 1355 | 評価した表現の結果が呼び出されたメソッドを一覧表示します。 |
1471 | 1356 | 表現は bless されたオブジェクトへのリファレンスか、パッケージ名として |
1472 | 1357 | 評価されます。 |
1473 | 1358 | |
1474 | 1359 | =item M |
1475 | 1360 | X<debugger command, M> |
1476 | 1361 | |
1477 | 1362 | =begin original |
1478 | 1363 | |
1479 | Display all loaded modules and their versions | |
1364 | Displays all loaded modules and their versions | |
1480 | 1365 | |
1481 | 1366 | =end original |
1482 | 1367 | |
1483 | 1368 | 読み込まれたモジュールとバージョンを全て表示します。 |
1484 | 1369 | |
1485 | 1370 | =item man [manpage] |
1486 | 1371 | X<debugger command, man> |
1487 | 1372 | |
1488 | 1373 | =begin original |
1489 | 1374 | |
1490 | 1375 | Despite its name, this calls your system's default documentation |
1491 | 1376 | viewer on the given page, or on the viewer itself if I<manpage> is |
1492 | 1377 | omitted. If that viewer is B<man>, the current C<Config> information |
1493 | 1378 | is used to invoke B<man> using the proper MANPATH or S<B<-M> |
1494 | 1379 | I<manpath>> option. Failed lookups of the form C<XXX> that match |
1495 | 1380 | known manpages of the form I<perlXXX> will be retried. This lets |
1496 | 1381 | you type C<man debug> or C<man op> from the debugger. |
1497 | 1382 | |
1498 | 1383 | =end original |
1499 | 1384 | |
1500 | 1385 | その名前にも関わらず、これは与えられたページ(I<manpage> が省略された |
1501 | 1386 | 場合はビューワ自身)に対してシステムのデフォルトのドキュメントビューワを |
1502 | 1387 | 呼び出します。 |
1503 | 1388 | ビューワが B<man> の場合、適切な MANPATH や S<B<-M> I<manpath>> |
1504 | 1389 | オプションを使って B<man> を起動するために、現在の C<Config> 情報が |
1505 | 1390 | 使われます。 |
1506 | 1391 | C<XXX> の形で一致する man ページの検索に失敗した場合、 |
1507 | 1392 | I<perlXXX> の形のものを再検索します。 |
1508 | 1393 | これにより、デバッガから C<man debug> や C<man op> と |
1509 | 1394 | タイプできるようになります。 |
1510 | 1395 | |
1511 | 1396 | =begin original |
1512 | 1397 | |
1513 | 1398 | On systems traditionally bereft of a usable B<man> command, the |
1514 | 1399 | debugger invokes B<perldoc>. Occasionally this determination is |
1515 | 1400 | incorrect due to recalcitrant vendors or rather more felicitously, |
1516 | 1401 | to enterprising users. If you fall into either category, just |
1517 | 1402 | manually set the $DB::doccmd variable to whatever viewer to view |
1518 | 1403 | the Perl documentation on your system. This may be set in an rc |
1519 | 1404 | file, or through direct assignment. We're still waiting for a |
1520 | 1405 | working example of something along the lines of: |
1521 | 1406 | |
1522 | 1407 | =end original |
1523 | 1408 | |
1524 | 1409 | 伝統的に利用可能な B<man> コマンドを奪われたシステムでは、デバッガは< |
1525 | 1410 | B<perldoc> を起動します。 |
1526 | 1411 | 反抗的なベンダーや、より適切には、積極的なユーザーによって、この判断は |
1527 | 1412 | 正しくありません。 |
1528 | 1413 | もしあなたがどちらかの分類に当てはまってしまうなら、Perl のドキュメントを |
1529 | 1414 | 表示するためにどのビューワを使うかを、手動で $DB::doccmd 変数に |
1530 | 1415 | セットしてください。 |
1531 | 1416 | これは rc ファイルででも、直接の代入ででもセットできます。 |
1532 | 1417 | 私たちは以下のような感じで、実際に動作する例を待っています: |
1533 | 1418 | |
1534 | 1419 | $DB::doccmd = 'netscape -remote http://something.here/'; |
1535 | 1420 | |
1536 | 1421 | =back |
1537 | 1422 | |
1538 | 1423 | =head2 Configurable Options |
1539 | 1424 | |
1540 | 1425 | (設定可能なオプション) |
1541 | 1426 | |
1542 | 1427 | =begin original |
1543 | 1428 | |
1544 | 1429 | The debugger has numerous options settable using the C<o> command, |
1545 | 1430 | either interactively or from the environment or an rc file. |
1546 | 1431 | (./.perldb or ~/.perldb under Unix.) |
1547 | 1432 | |
1548 | 1433 | =end original |
1549 | 1434 | |
1550 | 1435 | デバッガには C<O> コマンドで設定できるさまざまなオプションがあります。 |
1551 | 1436 | これは対話的、環境変数、rc ファイル (Unix では ./.perldb または |
1552 | 1437 | ~/.perldb) で設定できます。 |
1553 | 1438 | |
1554 | 1439 | =over 12 |
1555 | 1440 | |
1556 | 1441 | =item C<recallCommand>, C<ShellBang> |
1557 | 1442 | X<debugger option, recallCommand> |
1558 | 1443 | X<debugger option, ShellBang> |
1559 | 1444 | |
1560 | 1445 | =begin original |
1561 | 1446 | |
1562 | The characters used to recall | |
1447 | The characters used to recall command or spawn shell. By | |
1563 | 1448 | default, both are set to C<!>, which is unfortunate. |
1564 | 1449 | |
1565 | 1450 | =end original |
1566 | 1451 | |
1567 | 1452 | 再呼び出しコマンドとシェル起動に使われる文字です。 |
1568 | 1453 | デフォルトでは、残念ながら、両方とも C<!> にセットされています。 |
1569 | 1454 | |
1570 | 1455 | =item C<pager> |
1571 | 1456 | X<debugger option, pager> |
1572 | 1457 | |
1573 | 1458 | =begin original |
1574 | 1459 | |
1575 | 1460 | Program to use for output of pager-piped commands (those beginning |
1576 | 1461 | with a C<|> character.) By default, C<$ENV{PAGER}> will be used. |
1577 | 1462 | Because the debugger uses your current terminal characteristics |
1578 | 1463 | for bold and underlining, if the chosen pager does not pass escape |
1579 | 1464 | sequences through unchanged, the output of some debugger commands |
1580 | 1465 | will not be readable when sent through the pager. |
1581 | 1466 | |
1582 | 1467 | =end original |
1583 | 1468 | |
1584 | 1469 | ページャにパイプされるコマンド(文字 C<|> で始まるもの)の出力に |
1585 | 1470 | 使われるプログラム。 |
1586 | 1471 | デフォルトでは、C<$ENV{PAGER}> が使われます。 |
1587 | 1472 | デバッガは強調と下線に関して現在の端末設定を使うので、もし選択した |
1588 | 1473 | ページャがエスケープシーケンスを変更せずに通過させられない場合、 |
1589 | 1474 | 一部のデバッガコマンドの出力は、ページャに送られると読めなくなるでしょう。 |
1590 | 1475 | |
1591 | 1476 | =item C<tkRunning> |
1592 | 1477 | X<debugger option, tkRunning> |
1593 | 1478 | |
1594 | 1479 | =begin original |
1595 | 1480 | |
1596 | 1481 | Run Tk while prompting (with ReadLine). |
1597 | 1482 | |
1598 | 1483 | =end original |
1599 | 1484 | |
1600 | 1485 | プロンプトで (ReadLine と共に) Tk を実行します。 |
1601 | 1486 | |
1602 | 1487 | =item C<signalLevel>, C<warnLevel>, C<dieLevel> |
1603 | 1488 | X<debugger option, signalLevel> X<debugger option, warnLevel> |
1604 | 1489 | X<debugger option, dieLevel> |
1605 | 1490 | |
1606 | 1491 | =begin original |
1607 | 1492 | |
1608 | 1493 | Level of verbosity. By default, the debugger leaves your exceptions |
1609 | 1494 | and warnings alone, because altering them can break correctly running |
1610 | 1495 | programs. It will attempt to print a message when uncaught INT, BUS, or |
1611 | SEGV signals arrive. (But see the mention of signals in L< | |
1496 | SEGV signals arrive. (But see the mention of signals in L<BUGS> below.) | |
1612 | 1497 | |
1613 | 1498 | =end original |
1614 | 1499 | |
1615 | 1500 | 詳細さのレベル。 |
1616 | 1501 | デフォルトでは、デバッガは例外と警告を放っておきます; |
1617 | 1502 | これを変更すると、プログラムが正しく動かなくなることがあるからです。 |
1618 | 1503 | 捕捉されていない INT, BUS, SEGV シグナルがあると、メッセージを |
1619 | 1504 | 表示しようとします。 |
1620 | 1505 | (しかし、以下の L<BUGS> のシグナルに関する注意を参照してください。) |
1621 | 1506 | |
1622 | 1507 | =begin original |
1623 | 1508 | |
1624 | 1509 | To disable this default safe mode, set these values to something higher |
1625 | 1510 | than 0. At a level of 1, you get backtraces upon receiving any kind |
1626 | 1511 | of warning (this is often annoying) or exception (this is |
1627 | 1512 | often valuable). Unfortunately, the debugger cannot discern fatal |
1628 | 1513 | exceptions from non-fatal ones. If C<dieLevel> is even 1, then your |
1629 | 1514 | non-fatal exceptions are also traced and unceremoniously altered if they |
1630 | 1515 | came from C<eval'ed> strings or from any kind of C<eval> within modules |
1631 | 1516 | you're attempting to load. If C<dieLevel> is 2, the debugger doesn't |
1632 | 1517 | care where they came from: It usurps your exception handler and prints |
1633 | 1518 | out a trace, then modifies all exceptions with its own embellishments. |
1634 | 1519 | This may perhaps be useful for some tracing purposes, but tends to hopelessly |
1635 | 1520 | destroy any program that takes its exception handling seriously. |
1636 | 1521 | |
1637 | 1522 | =end original |
1638 | 1523 | |
1639 | 1524 | このデフォルトのセーフモードを無効にするには、これらの値を 0 以上に |
1640 | 1525 | セットしてください。 |
1641 | 1526 | レベル 1 では、あらゆる種類の警告(これはしばしばうんざりさせるものです)や |
1642 | 1527 | 例外(これはしばしば価値があります)を受信した時にバックトレースを得ます。 |
1643 | 1528 | 残念ながら、デバッガは致命的な例外と致命的でない例外を識別できません。 |
1644 | 1529 | C<dieLevel> は 1 であっても、致命的でない例外もトレースされ、 |
1645 | 1530 | それが C<eval された> 文字列からか、読み込もうとしたモジュール内の |
1646 | 1531 | あらゆる種類の C<eval> からのものであるなら、突然置き換えられます。 |
1647 | 1532 | C<dieLevel> が 2 なら、デバッガは例外の出所を気にしません: |
1648 | 1533 | 例外ハンドラを横取りしてトレースを表示し、それから全ての例外を自身の装飾で |
1649 | 1534 | 修正します。 |
1650 | 1535 | これはある種のトレースの目的にはおそらく有用ですが、 |
1651 | 1536 | 例外をまじめに扱っているプログラムをどうしようもなく破壊してしまう傾向が |
1652 | 1537 | あります。 |
1653 | 1538 | |
1654 | 1539 | =item C<AutoTrace> |
1655 | 1540 | X<debugger option, AutoTrace> |
1656 | 1541 | |
1657 | 1542 | =begin original |
1658 | 1543 | |
1659 | 1544 | Trace mode (similar to C<t> command, but can be put into |
1660 | 1545 | C<PERLDB_OPTS>). |
1661 | 1546 | |
1662 | 1547 | =end original |
1663 | 1548 | |
1664 | 1549 | トレースモード(C<t> コマンドと同様ですが、C<PERLDB_OPTS> に書けます)。 |
1665 | 1550 | |
1666 | 1551 | =item C<LineInfo> |
1667 | 1552 | X<debugger option, LineInfo> |
1668 | 1553 | |
1669 | 1554 | =begin original |
1670 | 1555 | |
1671 | 1556 | File or pipe to print line number info to. If it is a pipe (say, |
1672 | 1557 | C<|visual_perl_db>), then a short message is used. This is the |
1673 | 1558 | mechanism used to interact with a slave editor or visual debugger, |
1674 | 1559 | such as the special C<vi> or C<emacs> hooks, or the C<ddd> graphical |
1675 | 1560 | debugger. |
1676 | 1561 | |
1677 | 1562 | =end original |
1678 | 1563 | |
1679 | 1564 | 行番号情報を記録するファイルまたはパイプ。 |
1680 | 1565 | これが (C<|visual_perl_db> のように) パイプの場合、短い文章が使われます。 |
1681 | 1566 | これは、特別な C<vi> や C<emacs> のフックや、C<ddd> グラフィカル |
1682 | 1567 | デバッガのようなスレーブエディタやビジュアルデバッガと相互作用するために |
1683 | 1568 | 使われる機構です。 |
1684 | 1569 | |
1685 | 1570 | =item C<inhibit_exit> |
1686 | 1571 | X<debugger option, inhibit_exit> |
1687 | 1572 | |
1688 | 1573 | =begin original |
1689 | 1574 | |
1690 | 1575 | If 0, allows I<stepping off> the end of the script. |
1691 | 1576 | |
1692 | 1577 | =end original |
1693 | 1578 | |
1694 | 1579 | 0 だと、スクリプトの最後で I<プログラムを終了する> ことを認めます。 |
1695 | 1580 | |
1696 | 1581 | =item C<PrintRet> |
1697 | 1582 | X<debugger option, PrintRet> |
1698 | 1583 | |
1699 | 1584 | =begin original |
1700 | 1585 | |
1701 | 1586 | Print return value after C<r> command if set (default). |
1702 | 1587 | |
1703 | 1588 | =end original |
1704 | 1589 | |
1705 | 1590 | 設定されると(デフォルト)、C<r> コマンドの後に返り値を表示します。 |
1706 | 1591 | |
1707 | 1592 | =item C<ornaments> |
1708 | 1593 | X<debugger option, ornaments> |
1709 | 1594 | |
1710 | 1595 | =begin original |
1711 | 1596 | |
1712 | 1597 | Affects screen appearance of the command line (see L<Term::ReadLine>). |
1713 | 1598 | There is currently no way to disable these, which can render |
1714 | 1599 | some output illegible on some displays, or with some pagers. |
1715 | 1600 | This is considered a bug. |
1716 | 1601 | |
1717 | 1602 | =end original |
1718 | 1603 | |
1719 | 1604 | コマンドラインの画面への表示に影響を与えます(L<Term::ReadLine> を |
1720 | 1605 | 参照してください)。 |
1721 | 1606 | 今のところ、これを無効にする方法はありません; |
1722 | 1607 | これにより、ディスプレイやページャーによっては判読できない出力を |
1723 | 1608 | 行うことがあります。 |
1724 | 1609 | これはバグと考えられています。 |
1725 | 1610 | |
1726 | 1611 | =item C<frame> |
1727 | 1612 | X<debugger option, frame> |
1728 | 1613 | |
1729 | 1614 | =begin original |
1730 | 1615 | |
1731 | 1616 | Affects the printing of messages upon entry and exit from subroutines. If |
1732 | 1617 | C<frame & 2> is false, messages are printed on entry only. (Printing |
1733 | 1618 | on exit might be useful if interspersed with other messages.) |
1734 | 1619 | |
1735 | 1620 | =end original |
1736 | 1621 | |
1737 | 1622 | サブルーチンへの出入り時のメッセージ表示に影響を与えます。 |
1738 | 1623 | C<frame & 2> が偽なら、サブルーチンに入る時にのみメッセージを出力します。 |
1739 | 1624 | (出るときのメッセージは、他のメッセージがまき散らされているときには |
1740 | 1625 | 有用でしょう。) |
1741 | 1626 | |
1742 | 1627 | =begin original |
1743 | 1628 | |
1744 | 1629 | If C<frame & 4>, arguments to functions are printed, plus context |
1745 | 1630 | and caller info. If C<frame & 8>, overloaded C<stringify> and |
1746 | 1631 | C<tie>d C<FETCH> is enabled on the printed arguments. If C<frame |
1747 | 1632 | & 16>, the return value from the subroutine is printed. |
1748 | 1633 | |
1749 | 1634 | =end original |
1750 | 1635 | |
1751 | 1636 | C<frame & 4> の場合、関数の引数に加えて、コンテキストと呼び出し元の |
1752 | 1637 | 情報を表示します。 |
1753 | 1638 | C<frame & 8> の場合、引数の表示にオーバーロードされた C<文字列化> と |
1754 | 1639 | C<tie> した C<FETCH> が有効になります。 |
1755 | 1640 | C<frame & 16> の場合、サブルーチンからの返り値が表示されます。 |
1756 | 1641 | |
1757 | 1642 | =begin original |
1758 | 1643 | |
1759 | 1644 | The length at which the argument list is truncated is governed by the |
1760 | 1645 | next option: |
1761 | 1646 | |
1762 | 1647 | =end original |
1763 | 1648 | |
1764 | 1649 | 引数リストが切り詰められた時の長さは次のオプションの管轄となります: |
1765 | 1650 | |
1766 | 1651 | =item C<maxTraceLen> |
1767 | 1652 | X<debugger option, maxTraceLen> |
1768 | 1653 | |
1769 | 1654 | =begin original |
1770 | 1655 | |
1771 | 1656 | Length to truncate the argument list when the C<frame> option's |
1772 | 1657 | bit 4 is set. |
1773 | 1658 | |
1774 | 1659 | =end original |
1775 | 1660 | |
1776 | 1661 | C<frame> オプションの bit 4 がセットされている時の引数リストを切り詰める |
1777 | 1662 | 長さ。 |
1778 | 1663 | |
1779 | 1664 | =item C<windowSize> |
1780 | 1665 | X<debugger option, windowSize> |
1781 | 1666 | |
1782 | 1667 | =begin original |
1783 | 1668 | |
1784 | 1669 | Change the size of code list window (default is 10 lines). |
1785 | 1670 | |
1786 | 1671 | =end original |
1787 | 1672 | |
1788 | 1673 | コードリストウィンドウの大きさを変更します(デフォルトは 10 行です)。 |
1789 | 1674 | |
1790 | 1675 | =back |
1791 | 1676 | |
1792 | 1677 | =begin original |
1793 | 1678 | |
1794 | 1679 | The following options affect what happens with C<V>, C<X>, and C<x> |
1795 | 1680 | commands: |
1796 | 1681 | |
1797 | 1682 | =end original |
1798 | 1683 | |
1799 | 1684 | 以下のオプションは C<V>, C<X>, C<x> コマンドに影響を与えます。 |
1800 | 1685 | |
1801 | 1686 | =over 12 |
1802 | 1687 | |
1803 | 1688 | =item C<arrayDepth>, C<hashDepth> |
1804 | 1689 | X<debugger option, arrayDepth> X<debugger option, hashDepth> |
1805 | 1690 | |
1806 | 1691 | =begin original |
1807 | 1692 | |
1808 | 1693 | Print only first N elements ('' for all). |
1809 | 1694 | |
1810 | 1695 | =end original |
1811 | 1696 | |
1812 | 1697 | 最初の N 要素だけを表示します('' を指定すると全て表示します)。 |
1813 | 1698 | |
1814 | 1699 | =item C<dumpDepth> |
1815 | 1700 | X<debugger option, dumpDepth> |
1816 | 1701 | |
1817 | 1702 | =begin original |
1818 | 1703 | |
1819 | 1704 | Limit recursion depth to N levels when dumping structures. |
1820 | 1705 | Negative values are interpreted as infinity. Default: infinity. |
1821 | 1706 | |
1822 | 1707 | =end original |
1823 | 1708 | |
1824 | 1709 | 構造をダンプするときに再帰の深さを N レベルに制限します。 |
1825 | 1710 | 負数を指定すると無限として解釈されます。 |
1826 | 1711 | デフォルト: 無限。 |
1827 | 1712 | |
1828 | 1713 | =item C<compactDump>, C<veryCompact> |
1829 | 1714 | X<debugger option, compactDump> X<debugger option, veryCompact> |
1830 | 1715 | |
1831 | 1716 | =begin original |
1832 | 1717 | |
1833 | 1718 | Change the style of array and hash output. If C<compactDump>, short array |
1834 | 1719 | may be printed on one line. |
1835 | 1720 | |
1836 | 1721 | =end original |
1837 | 1722 | |
1838 | 1723 | 配列とハッシュの出力スタイルを変更します。 |
1839 | 1724 | C<compactDump> の場合は、短い配列は 1 行で表示します。 |
1840 | 1725 | |
1841 | 1726 | =item C<globPrint> |
1842 | 1727 | X<debugger option, globPrint> |
1843 | 1728 | |
1844 | 1729 | =begin original |
1845 | 1730 | |
1846 | 1731 | Whether to print contents of globs. |
1847 | 1732 | |
1848 | 1733 | =end original |
1849 | 1734 | |
1850 | 1735 | グロブの内容を表示するかどうかです。 |
1851 | 1736 | |
1852 | 1737 | =item C<DumpDBFiles> |
1853 | 1738 | X<debugger option, DumpDBFiles> |
1854 | 1739 | |
1855 | 1740 | =begin original |
1856 | 1741 | |
1857 | 1742 | Dump arrays holding debugged files. |
1858 | 1743 | |
1859 | 1744 | =end original |
1860 | 1745 | |
1861 | 1746 | デバッグしていているファイルが保持している配列をダンプします。 |
1862 | 1747 | |
1863 | 1748 | =item C<DumpPackages> |
1864 | 1749 | X<debugger option, DumpPackages> |
1865 | 1750 | |
1866 | 1751 | =begin original |
1867 | 1752 | |
1868 | 1753 | Dump symbol tables of packages. |
1869 | 1754 | |
1870 | 1755 | =end original |
1871 | 1756 | |
1872 | 1757 | パッケージのシンボルテーブルをダンプします。 |
1873 | 1758 | |
1874 | 1759 | =item C<DumpReused> |
1875 | 1760 | X<debugger option, DumpReused> |
1876 | 1761 | |
1877 | 1762 | =begin original |
1878 | 1763 | |
1879 | 1764 | Dump contents of "reused" addresses. |
1880 | 1765 | |
1881 | 1766 | =end original |
1882 | 1767 | |
1883 | 1768 | 「再利用された」アドレスの内容をダンプします。 |
1884 | 1769 | |
1885 | 1770 | =item C<quote>, C<HighBit>, C<undefPrint> |
1886 | 1771 | X<debugger option, quote> X<debugger option, HighBit> |
1887 | 1772 | X<debugger option, undefPrint> |
1888 | 1773 | |
1889 | 1774 | =begin original |
1890 | 1775 | |
1891 | 1776 | Change the style of string dump. The default value for C<quote> |
1892 | 1777 | is C<auto>; one can enable double-quotish or single-quotish format |
1893 | 1778 | by setting it to C<"> or C<'>, respectively. By default, characters |
1894 | 1779 | with their high bit set are printed verbatim. |
1895 | 1780 | |
1896 | 1781 | =end original |
1897 | 1782 | |
1898 | 1783 | 文字列ダンプのスタイルを変更します。 |
1899 | 1784 | C<quote> のデフォルトは C<auto> です; |
1900 | 1785 | C<"> や C<'> にセットすることでダブルクォート風やシングルクォート風に |
1901 | 1786 | できます。 |
1902 | 1787 | デフォルトでは、最上位ビットがセットされている文字はそのまま表示されます。 |
1903 | 1788 | |
1904 | 1789 | =item C<UsageOnly> |
1905 | 1790 | X<debugger option, UsageOnly> |
1906 | 1791 | |
1907 | 1792 | =begin original |
1908 | 1793 | |
1909 | 1794 | Rudimentary per-package memory usage dump. Calculates total |
1910 | 1795 | size of strings found in variables in the package. This does not |
1911 | 1796 | include lexicals in a module's file scope, or lost in closures. |
1912 | 1797 | |
1913 | 1798 | =end original |
1914 | 1799 | |
1915 | 1800 | 基本的なパッケージ単位のメモリ使用量ダンプ。 |
1916 | 1801 | パッケージ内の変数で見つかった文字列のサイズの合計を計算します。 |
1917 | 1802 | モジュールのファイルスコープ内のレキシカルや、クロージャ内で |
1918 | 1803 | 失われたものは含まれません。 |
1919 | 1804 | |
1920 | =item C<HistFile> | |
1921 | X<debugger option, history, HistFile> | |
1922 | ||
1923 | =begin original | |
1924 | ||
1925 | The path of the file from which the history (assuming a usable | |
1926 | Term::ReadLine backend) will be read on the debugger's startup, and to which | |
1927 | it will be saved on shutdown (for persistence across sessions). Similar in | |
1928 | concept to Bash's C<.bash_history> file. | |
1929 | ||
1930 | =end original | |
1931 | ||
1932 | デバッガの起動時に読み込まれ、(セッションをまたいで永続させるために)終了時に | |
1933 | 保管されるヒストリ (Term::ReadLine バックエンドが利用可能であることを | |
1934 | 仮定しています) のファイルのパス。 | |
1935 | Bash の C<.bash_history> ファイルと同じ考え方です。 | |
1936 | ||
1937 | =item C<HistSize> | |
1938 | X<debugger option, history, HistSize> | |
1939 | ||
1940 | =begin original | |
1941 | ||
1942 | The count of the saved lines in the history (assuming C<HistFile> above). | |
1943 | ||
1944 | =end original | |
1945 | ||
1946 | ヒストリに保管される行数 (上述の C<HistFile> を仮定します)。 | |
1947 | ||
1948 | 1805 | =back |
1949 | 1806 | |
1950 | 1807 | =begin original |
1951 | 1808 | |
1952 | 1809 | After the rc file is read, the debugger reads the C<$ENV{PERLDB_OPTS}> |
1953 | 1810 | environment variable and parses this as the remainder of a "O ..." |
1954 | 1811 | line as one might enter at the debugger prompt. You may place the |
1955 | 1812 | initialization options C<TTY>, C<noTTY>, C<ReadLine>, and C<NonStop> |
1956 | 1813 | there. |
1957 | 1814 | |
1958 | 1815 | =end original |
1959 | 1816 | |
1960 | 1817 | rc ファイルが読み込まれた後、デバッガは C<$ENV{PERLDB_OPTS}> 環境変数を |
1961 | 1818 | 読み込み、デバッガのプロンプトから "O ..." として入力されたかのように |
1962 | 1819 | パースします。 |
1963 | 1820 | 初期化オプション C<TTY>, C<noTTY>, C<ReadLine>, C<NonStop> も |
1964 | 1821 | ここで設定できます。 |
1965 | 1822 | |
1966 | 1823 | =begin original |
1967 | 1824 | |
1968 | 1825 | If your rc file contains: |
1969 | 1826 | |
1970 | 1827 | =end original |
1971 | 1828 | |
1972 | 1829 | rc ファイルに以下のように書くと: |
1973 | 1830 | |
1974 | 1831 | parse_options("NonStop=1 LineInfo=db.out AutoTrace"); |
1975 | 1832 | |
1976 | 1833 | =begin original |
1977 | 1834 | |
1978 | 1835 | then your script will run without human intervention, putting trace |
1979 | 1836 | information into the file I<db.out>. (If you interrupt it, you'd |
1980 | 1837 | better reset C<LineInfo> to F</dev/tty> if you expect to see anything.) |
1981 | 1838 | |
1982 | 1839 | =end original |
1983 | 1840 | |
1984 | 1841 | スクリプトは人間の介入なしに実行され、トレース情報を |
1985 | 1842 | I<db.out> ファイルに出力します。 |
1986 | 1843 | (中断して、何も表示されない場合は、C<LineInfo> を F</dev/tty> に |
1987 | 1844 | リセットしたほうがよいでしょう。) |
1988 | 1845 | |
1989 | 1846 | =over 12 |
1990 | 1847 | |
1991 | 1848 | =item C<TTY> |
1992 | 1849 | X<debugger option, TTY> |
1993 | 1850 | |
1994 | 1851 | =begin original |
1995 | 1852 | |
1996 | 1853 | The TTY to use for debugging I/O. |
1997 | 1854 | |
1998 | 1855 | =end original |
1999 | 1856 | |
2000 | 1857 | デバッグ I/O として TTY を使います。 |
2001 | 1858 | |
2002 | 1859 | =item C<noTTY> |
2003 | 1860 | X<debugger option, noTTY> |
2004 | 1861 | |
2005 | 1862 | =begin original |
2006 | 1863 | |
2007 | 1864 | If set, the debugger goes into C<NonStop> mode and will not connect to a TTY. If |
2008 | 1865 | interrupted (or if control goes to the debugger via explicit setting of |
2009 | 1866 | $DB::signal or $DB::single from the Perl script), it connects to a TTY |
2010 | 1867 | specified in the C<TTY> option at startup, or to a tty found at |
2011 | 1868 | runtime using the C<Term::Rendezvous> module of your choice. |
2012 | 1869 | |
2013 | 1870 | =end original |
2014 | 1871 | |
2015 | 1872 | セットすると、デバッガは C<NonStop> モードとなり、TTY と接続されません。 |
2016 | 1873 | もし中断された(または Perl スクリプトから明示的に $DB::signal や |
2017 | 1874 | $DB::single をセットすることによってデバッガに制御が移った)場合、 |
2018 | 1875 | 起動時に C<TTY> オプションで指定された TTY か、実行時に C<Term::Rendezvous> |
2019 | 1876 | モジュールで選択された TTY に接続されます。 |
2020 | 1877 | |
2021 | 1878 | =begin original |
2022 | 1879 | |
2023 | 1880 | This module should implement a method named C<new> that returns an object |
2024 | 1881 | with two methods: C<IN> and C<OUT>. These should return filehandles to use |
2025 | 1882 | for debugging input and output correspondingly. The C<new> method should |
2026 | 1883 | inspect an argument containing the value of C<$ENV{PERLDB_NOTTY}> at |
2027 | 1884 | startup, or C<"$ENV{HOME}/.perldbtty$$"> otherwise. This file is not |
2028 | 1885 | inspected for proper ownership, so security hazards are theoretically |
2029 | 1886 | possible. |
2030 | 1887 | |
2031 | 1888 | =end original |
2032 | 1889 | |
2033 | 1890 | このモジュールは、2 つのメソッド C<IN> と C<OUT> をもつオブジェクトを |
2034 | 1891 | 返すメソッド C<new> を実装する必要があります。 |
2035 | 1892 | これらはそれぞれ、デバッグ入力と出力のためのファイルハンドルを |
2036 | 1893 | 返すようにします。 |
2037 | 1894 | C<new> メソッドは起動時に C<$ENV{PERLDB_NOTTY}> の値を含んでいる |
2038 | 1895 | 引数を検査し、さもなければ C<"$ENV{HOME}/.perldbtty$$"> となります。 |
2039 | 1896 | このファイルは適切な所有権について検査されないので、 |
2040 | 1897 | 理論的にはセキュリティの問題が起こり得ます。 |
2041 | 1898 | |
2042 | 1899 | =item C<ReadLine> |
2043 | 1900 | X<debugger option, ReadLine> |
2044 | 1901 | |
2045 | 1902 | =begin original |
2046 | 1903 | |
2047 | 1904 | If false, readline support in the debugger is disabled in order |
2048 | 1905 | to debug applications that themselves use ReadLine. |
2049 | 1906 | |
2050 | 1907 | =end original |
2051 | 1908 | |
2052 | 1909 | 偽だと、デバッグするアプリケーション自身が ReadLine を使うために、 |
2053 | 1910 | readline 対応を無効にします。 |
2054 | 1911 | |
2055 | 1912 | =item C<NonStop> |
2056 | 1913 | X<debugger option, NonStop> |
2057 | 1914 | |
2058 | 1915 | =begin original |
2059 | 1916 | |
2060 | 1917 | If set, the debugger goes into non-interactive mode until interrupted, or |
2061 | 1918 | programmatically by setting $DB::signal or $DB::single. |
2062 | 1919 | |
2063 | 1920 | =end original |
2064 | 1921 | |
2065 | 1922 | 設定されると、デバッガは中断されるか、プログラム的に $DB::signal か |
2066 | 1923 | $DB::single に設定されるまで、非対話的モードとなります。 |
2067 | 1924 | |
2068 | 1925 | =back |
2069 | 1926 | |
2070 | 1927 | =begin original |
2071 | 1928 | |
2072 | 1929 | Here's an example of using the C<$ENV{PERLDB_OPTS}> variable: |
2073 | 1930 | |
2074 | 1931 | =end original |
2075 | 1932 | |
2076 | 1933 | 以下に C<$ENV{PERLDB_OPTS}> 変数を使った例を示します: |
2077 | 1934 | |
2078 | 1935 | $ PERLDB_OPTS="NonStop frame=2" perl -d myprogram |
2079 | 1936 | |
2080 | 1937 | =begin original |
2081 | 1938 | |
2082 | 1939 | That will run the script B<myprogram> without human intervention, |
2083 | 1940 | printing out the call tree with entry and exit points. Note that |
2084 | 1941 | C<NonStop=1 frame=2> is equivalent to C<N f=2>, and that originally, |
2085 | 1942 | options could be uniquely abbreviated by the first letter (modulo |
2086 | 1943 | the C<Dump*> options). It is nevertheless recommended that you |
2087 | 1944 | always spell them out in full for legibility and future compatibility. |
2088 | 1945 | |
2089 | 1946 | =end original |
2090 | 1947 | |
2091 | 1948 | これは、人間の関与なしでスクリプト B<myprogram> を実行し、進入と終了の |
2092 | 1949 | ポイントの呼び出し木を表示します。 |
2093 | 1950 | C<NonStop=1 frame=2> は C<N f=2> と等価で、もともとオプションは最初の文字 |
2094 | 1951 | (C<Dump*> オプションを法として) に省略できます。 |
2095 | 1952 | それでもやはり、読みやすさと将来の互換性のために、常にフルスペルを書くことが |
2096 | 1953 | 推奨されます。 |
2097 | 1954 | |
2098 | 1955 | =begin original |
2099 | 1956 | |
2100 | 1957 | Other examples include |
2101 | 1958 | |
2102 | 1959 | =end original |
2103 | 1960 | |
2104 | 1961 | もう一つの例としては: |
2105 | 1962 | |
2106 | 1963 | $ PERLDB_OPTS="NonStop LineInfo=listing frame=2" perl -d myprogram |
2107 | 1964 | |
2108 | 1965 | =begin original |
2109 | 1966 | |
2110 | 1967 | which runs script non-interactively, printing info on each entry |
2111 | 1968 | into a subroutine and each executed line into the file named F<listing>. |
2112 | 1969 | (If you interrupt it, you would better reset C<LineInfo> to something |
2113 | 1970 | "interactive"!) |
2114 | 1971 | |
2115 | 1972 | =end original |
2116 | 1973 | |
2117 | 1974 | とするとスクリプトは非対話的に実行され、サブルーチンへの進入と実行行を |
2118 | 1975 | F<listing> という名前のファイルに記録します。 |
2119 | 1976 | (中断すると、何か「対話的」にするために C<LineInfo> をリセットする方が |
2120 | 1977 | 良いでしょう!) |
2121 | 1978 | |
2122 | 1979 | =begin original |
2123 | 1980 | |
2124 | 1981 | Other examples include (using standard shell syntax to show environment |
2125 | 1982 | variable settings): |
2126 | 1983 | |
2127 | 1984 | =end original |
2128 | 1985 | |
2129 | 1986 | (環境変数設定を表示する標準シェル構文を使った)もう一つの例としては: |
2130 | 1987 | |
2131 | 1988 | $ ( PERLDB_OPTS="NonStop frame=1 AutoTrace LineInfo=tperl.out" |
2132 | 1989 | perl -d myprogram ) |
2133 | 1990 | |
2134 | 1991 | =begin original |
2135 | 1992 | |
2136 | 1993 | which may be useful for debugging a program that uses C<Term::ReadLine> |
2137 | 1994 | itself. Do not forget to detach your shell from the TTY in the window that |
2138 | 1995 | corresponds to F</dev/ttyXX>, say, by issuing a command like |
2139 | 1996 | |
2140 | 1997 | =end original |
2141 | 1998 | |
2142 | 1999 | これは C<Term::ReadLine> 地震を使っているプログラムをデバッグするのに |
2143 | 2000 | 便利です。 |
2144 | 2001 | 以下のようなコマンドを使って、使用中のシェルを、F</dev/ttyXX> に対応する |
2145 | 2002 | ウィンドウの TTY からデタッチすることを忘れないで下さい: |
2146 | 2003 | |
2147 | 2004 | $ sleep 1000000 |
2148 | 2005 | |
2149 | 2006 | =begin original |
2150 | 2007 | |
2151 | 2008 | See L<perldebguts/"Debugger Internals"> for details. |
2152 | 2009 | |
2153 | 2010 | =end original |
2154 | 2011 | |
2155 | 2012 | 詳細については L<perldebguts/"Debugger Internals"> を参照してください。 |
2156 | 2013 | |
2157 | =head2 Debugger | |
2014 | =head2 Debugger input/output | |
2158 | 2015 | |
2159 | 2016 | (デバッガの入出力) |
2160 | 2017 | |
2161 | 2018 | =over 8 |
2162 | 2019 | |
2163 | 2020 | =item Prompt |
2164 | 2021 | |
2165 | 2022 | =begin original |
2166 | 2023 | |
2167 | 2024 | The debugger prompt is something like |
2168 | 2025 | |
2169 | 2026 | =end original |
2170 | 2027 | |
2171 | 2028 | デバッガのプロンプトは以下のようだったり: |
2172 | 2029 | |
2173 | 2030 | DB<8> |
2174 | 2031 | |
2175 | 2032 | =begin original |
2176 | 2033 | |
2177 | 2034 | or even |
2178 | 2035 | |
2179 | 2036 | =end original |
2180 | 2037 | |
2181 | 2038 | あるいは以下のようだったりします: |
2182 | 2039 | |
2183 | 2040 | DB<<17>> |
2184 | 2041 | |
2185 | 2042 | =begin original |
2186 | 2043 | |
2187 | 2044 | where that number is the command number, and which you'd use to |
2188 | 2045 | access with the built-in B<csh>-like history mechanism. For example, |
2189 | 2046 | C<!17> would repeat command number 17. The depth of the angle |
2190 | 2047 | brackets indicates the nesting depth of the debugger. You could |
2191 | 2048 | get more than one set of brackets, for example, if you'd already |
2192 | 2049 | at a breakpoint and then printed the result of a function call that |
2193 | 2050 | itself has a breakpoint, or you step into an expression via C<s/n/t |
2194 | 2051 | expression> command. |
2195 | 2052 | |
2196 | 2053 | =end original |
2197 | 2054 | |
2198 | 2055 | ここで数値はコマンド番号で、組み込みの B<csh> 風履歴機構を使って |
2199 | 2056 | アクセスするのに使います。 |
2200 | 2057 | 例えば、C<!17> はコマンド番号 17 を再実行します。 |
2201 | 2058 | 不等号の深さはデバッガのネストの深さを示します。 |
2202 | 2059 | 例えば、既にブレークポイントにいて、それ自身にもブレークポイントを |
2203 | 2060 | 含む関数呼び出しの結果を表示させたり、C<s/n/t expression> コマンドを |
2204 | 2061 | 使って式をステップ実行したりした時に複数の不等号の組を見ることがあります。 |
2205 | 2062 | |
2206 | 2063 | =item Multiline commands |
2207 | 2064 | |
2208 | 2065 | =begin original |
2209 | 2066 | |
2210 | 2067 | If you want to enter a multi-line command, such as a subroutine |
2211 | 2068 | definition with several statements or a format, escape the newline |
2212 | 2069 | that would normally end the debugger command with a backslash. |
2213 | 2070 | Here's an example: |
2214 | 2071 | |
2215 | 2072 | =end original |
2216 | 2073 | |
2217 | 2074 | 複数の文からなるサブルーチン定義やフォーマットといった、複数行の |
2218 | 2075 | コマンドを入力したい場合は、通常はデバッガコマンドを終了させる改行を |
2219 | 2076 | バックスラッシュでエスケープしてください。 |
2220 | 2077 | 以下は例です: |
2221 | 2078 | |
2222 | 2079 | DB<1> for (1..4) { \ |
2223 | 2080 | cont: print "ok\n"; \ |
2224 | 2081 | cont: } |
2225 | 2082 | ok |
2226 | 2083 | ok |
2227 | 2084 | ok |
2228 | 2085 | ok |
2229 | 2086 | |
2230 | 2087 | =begin original |
2231 | 2088 | |
2232 | 2089 | Note that this business of escaping a newline is specific to interactive |
2233 | 2090 | commands typed into the debugger. |
2234 | 2091 | |
2235 | 2092 | =end original |
2236 | 2093 | |
2237 | 2094 | この、改行をエスケープする問題は、対話的にデバッガに入力されたコマンドに |
2238 | 2095 | 特有であることに注意してください。 |
2239 | 2096 | |
2240 | 2097 | =item Stack backtrace |
2241 | 2098 | X<backtrace> X<stack, backtrace> |
2242 | 2099 | |
2243 | 2100 | =begin original |
2244 | 2101 | |
2245 | 2102 | Here's an example of what a stack backtrace via C<T> command might |
2246 | 2103 | look like: |
2247 | 2104 | |
2248 | 2105 | =end original |
2249 | 2106 | |
2250 | 2107 | これは、C<T> コマンドによって表示されるスタックバックトレースの |
2251 | 2108 | 例です: |
2252 | 2109 | |
2253 | $ = main::infested called from file | |
2110 | $ = main::infested called from file `Ambulation.pm' line 10 | |
2254 | @ = Ambulation::legs(1, 2, 3, 4) called from file | |
2111 | @ = Ambulation::legs(1, 2, 3, 4) called from file `camel_flea' line 7 | |
2255 | | |
2112 | $ = main::pests('bactrian', 4) called from file `camel_flea' line 4 | |
2256 | $ = main::pests('bactrian', 4) called from file 'camel_flea' | |
2257 | line 4 | |
2258 | 2113 | |
2259 | 2114 | =begin original |
2260 | 2115 | |
2261 | 2116 | The left-hand character up there indicates the context in which the |
2262 | 2117 | function was called, with C<$> and C<@> meaning scalar or list |
2263 | 2118 | contexts respectively, and C<.> meaning void context (which is |
2264 | 2119 | actually a sort of scalar context). The display above says |
2265 | 2120 | that you were in the function C<main::infested> when you ran the |
2266 | 2121 | stack dump, and that it was called in scalar context from line |
2267 | 2122 | 10 of the file I<Ambulation.pm>, but without any arguments at all, |
2268 | 2123 | meaning it was called as C<&infested>. The next stack frame shows |
2269 | 2124 | that the function C<Ambulation::legs> was called in list context |
2270 | 2125 | from the I<camel_flea> file with four arguments. The last stack |
2271 | 2126 | frame shows that C<main::pests> was called in scalar context, |
2272 | 2127 | also from I<camel_flea>, but from line 4. |
2273 | 2128 | |
2274 | 2129 | =end original |
2275 | 2130 | |
2276 | 2131 | 上記の左側の文字は関数が呼び出されたコンテキストを示しています; |
2277 | 2132 | C<$> と C<@> はそれぞれスカラコンテキストとリストコンテキストを意味し、 |
2278 | 2133 | C<.> は無効コンテキスト(実際のところはスカラコンテキストのようなもの)を |
2279 | 2134 | 意味します。 |
2280 | 2135 | 上記の表示は、スタックダンプを実行したときに C<main::infested> にいて、 |
2281 | 2136 | これはファイル I<Ambulation.pm> の 10 行目から、スカラコンテキストで |
2282 | 2137 | 引数なしで呼び出されています; つまり C<&infested> のようにして |
2283 | 2138 | 呼び出されています。 |
2284 | 2139 | 次のスタックフレームは、関数 C<Ambulation::legs> が I<camel_flea> から |
2285 | 2140 | リストコンテキストで 4 つの引数と共に呼び出されています。 |
2286 | 2141 | 最後のスタックフレームは、C<main::pests> が、同じファイル I<camel_flea> の |
2287 | 2142 | 4 行目からスカラコンテキストで呼び出されています。 |
2288 | 2143 | |
2289 | 2144 | =begin original |
2290 | 2145 | |
2291 | 2146 | If you execute the C<T> command from inside an active C<use> |
2292 | 2147 | statement, the backtrace will contain both a C<require> frame and |
2293 | an C<eval> frame. | |
2148 | an C<eval>) frame. | |
2294 | 2149 | |
2295 | 2150 | =end original |
2296 | 2151 | |
2297 | 2152 | 有効な C<use> 文の中から C<T> コマンドを実行すると、バックとレースには |
2298 | 2153 | C<require> フレームと C<eval> フレームの両方が含まれます。 |
2299 | 2154 | |
2300 | 2155 | =item Line Listing Format |
2301 | 2156 | |
2302 | 2157 | =begin original |
2303 | 2158 | |
2304 | 2159 | This shows the sorts of output the C<l> command can produce: |
2305 | 2160 | |
2306 | 2161 | =end original |
2307 | 2162 | |
2308 | 2163 | これは C<l> コマンドの出力を示しています: |
2309 | 2164 | |
2310 | DB<<13>> l | |
2165 | DB<<13>> l | |
2311 | 101: @i{@i} = (); | |
2166 | 101: @i{@i} = (); | |
2312 | 102:b @isa{@i,$pack} = () | |
2167 | 102:b @isa{@i,$pack} = () | |
2313 | 103 if(exists $i{$prevpack} || exists $isa{$pack}); | |
2168 | 103 if(exists $i{$prevpack} || exists $isa{$pack}); | |
2314 | 104 } | |
2169 | 104 } | |
2315 | 105 | |
2170 | 105 | |
2316 | 106 next | |
2171 | 106 next | |
2317 | 107==> if(exists $isa{$pack}); | |
2172 | 107==> if(exists $isa{$pack}); | |
2318 | 108 | |
2173 | 108 | |
2319 | 109:a if ($extra-- > 0) { | |
2174 | 109:a if ($extra-- > 0) { | |
2320 | 110: %isa = ($pack,1); | |
2175 | 110: %isa = ($pack,1); | |
2321 | 2176 | |
2322 | 2177 | =begin original |
2323 | 2178 | |
2324 | 2179 | Breakable lines are marked with C<:>. Lines with breakpoints are |
2325 | 2180 | marked by C<b> and those with actions by C<a>. The line that's |
2326 | 2181 | about to be executed is marked by C<< ==> >>. |
2327 | 2182 | |
2328 | 2183 | =end original |
2329 | 2184 | |
2330 | 2185 | ブレーク可能な行には C<:> が付いています。 |
2331 | 2186 | ブレークポイントのある行には C<b> が、アクションがある行には |
2332 | 2187 | C<a> があります。 |
2333 | 2188 | 今から実行しようとしている行には C<< ==> >> が付いています。 |
2334 | 2189 | |
2335 | 2190 | =begin original |
2336 | 2191 | |
2337 | 2192 | Please be aware that code in debugger listings may not look the same |
2338 | 2193 | as your original source code. Line directives and external source |
2339 | 2194 | filters can alter the code before Perl sees it, causing code to move |
2340 | 2195 | from its original positions or take on entirely different forms. |
2341 | 2196 | |
2342 | 2197 | =end original |
2343 | 2198 | |
2344 | 2199 | デバッガで表示されるコードは、元のソースコードと同じように見えるとは |
2345 | 2200 | 限らないことに注意してください。 |
2346 | 2201 | 行指示子と外部ソースフィルタが、Perl がコードを見る前にコードを |
2347 | 2202 | 変更することがあり、それによってコードが元の位置から移動したり、 |
2348 | 2203 | 完全に異なる形になったりします。 |
2349 | 2204 | |
2350 | 2205 | =item Frame listing |
2351 | 2206 | |
2352 | 2207 | =begin original |
2353 | 2208 | |
2354 | 2209 | When the C<frame> option is set, the debugger would print entered (and |
2355 | 2210 | optionally exited) subroutines in different styles. See L<perldebguts> |
2356 | 2211 | for incredibly long examples of these. |
2357 | 2212 | |
2358 | 2213 | =end original |
2359 | 2214 | |
2360 | 2215 | C<frame> オプションが設定されると、デバッガはサブルーチンに入ったとき |
2361 | 2216 | (および出たときもオプションで)違ったスタイルで表示します。 |
2362 | 2217 | これらの非常に長い例については L<perldebguts> を参照してください。 |
2363 | 2218 | |
2364 | 2219 | =back |
2365 | 2220 | |
2366 | =head2 Debugging | |
2221 | =head2 Debugging compile-time statements | |
2367 | 2222 | |
2368 | 2223 | (コンパイル時に実行される文のデバッグ) |
2369 | 2224 | |
2370 | 2225 | =begin original |
2371 | 2226 | |
2372 | 2227 | If you have compile-time executable statements (such as code within |
2373 | 2228 | BEGIN, UNITCHECK and CHECK blocks or C<use> statements), these will |
2374 | 2229 | I<not> be stopped by debugger, although C<require>s and INIT blocks |
2375 | will, and compile-time statements can be traced with | |
2230 | will, and compile-time statements can be traced with C<AutoTrace> | |
2376 | 2231 | option set in C<PERLDB_OPTS>). From your own Perl code, however, you |
2377 | 2232 | can transfer control back to the debugger using the following |
2378 | 2233 | statement, which is harmless if the debugger is not running: |
2379 | 2234 | |
2380 | 2235 | =end original |
2381 | 2236 | |
2382 | 2237 | コンパイル時に実行される文 (BEGIN, UNITCHECK, CHECK のブロック内のコードや |
2383 | C<use> 文) があれば、それらはデバッガによってI<止めることができま | |
2238 | C<use> 文) があれば、それらはデバッガによってI<止めることができま | |
2384 | C<require> と INIT ブロックは可能です | |
2239 | せん>。C<require> と INIT ブロックは可能です。 | |
2385 | C<PERLDB_OPTS> で C<AutoTrace> オプションを | |
2240 | また、コンパイル時実行文は C<PERLDB_OPTS> で C<AutoTrace> オプションを | |
2241 | 設定することでトレースできます。 | |
2386 | 2242 | しかし、以下のような文を自分で Perl コードに含めれば、 |
2387 | デバッガに制御を渡すことができます | |
2243 | デバッガに制御を渡すことができます。 | |
2388 | 起動していないときには、何もしません: | |
2244 | この文は、デバッガを起動していないときには、何もしません: | |
2389 | 2245 | |
2390 | 2246 | $DB::single = 1; |
2391 | 2247 | |
2392 | 2248 | =begin original |
2393 | 2249 | |
2394 | 2250 | If you set C<$DB::single> to 2, it's equivalent to having |
2395 | 2251 | just typed the C<n> command, whereas a value of 1 means the C<s> |
2396 | 2252 | command. The C<$DB::trace> variable should be set to 1 to simulate |
2397 | 2253 | having typed the C<t> command. |
2398 | 2254 | |
2399 | 2255 | =end original |
2400 | 2256 | |
2401 | 2257 | C<$DB::single> に 2 をセットすると、C<n>コマンドをタイプしたのと |
2402 | 等価になります | |
2258 | 等価になります。 | |
2259 | 1 を設定すると C<s> コマンドとなります。 | |
2403 | 2260 | C<$DB::trace> 変数は C<t> コマンドをタイプした状態をシミュレートするために |
2404 | 2261 | 1 にセットするべきです。 |
2405 | 2262 | |
2406 | 2263 | =begin original |
2407 | 2264 | |
2408 | 2265 | Another way to debug compile-time code is to start the debugger, set a |
2409 | 2266 | breakpoint on the I<load> of some module: |
2410 | 2267 | |
2411 | 2268 | =end original |
2412 | 2269 | |
2413 | 2270 | コンパイル時に実行されるコードをデバッグするもう一つの方法は、 |
2414 | 2271 | モジュールの I<load> にブレークポイントを設定して: |
2415 | 2272 | |
2416 | 2273 | DB<7> b load f:/perllib/lib/Carp.pm |
2417 | Will stop on load of | |
2274 | Will stop on load of `f:/perllib/lib/Carp.pm'. | |
2418 | 2275 | |
2419 | 2276 | =begin original |
2420 | 2277 | |
2421 | 2278 | and then restart the debugger using the C<R> command (if possible). One can use C<b |
2422 | 2279 | compile subname> for the same purpose. |
2423 | 2280 | |
2424 | 2281 | =end original |
2425 | 2282 | |
2426 | 2283 | (可能なら) C<R> コマンドを使ってデバッガを再起動することです。 |
2427 | 2284 | C<b compile subname> も同じ目的に使えます。 |
2428 | 2285 | |
2429 | 2286 | =head2 Debugger Customization |
2430 | 2287 | |
2431 | 2288 | (デバッガのカスタマイズ) |
2432 | 2289 | |
2433 | 2290 | =begin original |
2434 | 2291 | |
2435 | 2292 | The debugger probably contains enough configuration hooks that you |
2436 | 2293 | won't ever have to modify it yourself. You may change the behaviour |
2437 | of | |
2294 | of debugger from within the debugger using its C<o> command, from | |
2438 | 2295 | the command line via the C<PERLDB_OPTS> environment variable, and |
2439 | 2296 | from customization files. |
2440 | 2297 | |
2441 | 2298 | =end original |
2442 | 2299 | |
2443 | 2300 | デバッガにはおそらくあなたが自分で修正する必要があるとは思わないような |
2444 | 2301 | ところまで含んだ設定フックがあります。 |
2445 | 2302 | デバッガの振る舞いは、デバッガ内で C<o> コマンドを使って変更できます; |
2446 | 2303 | これは C<PERLDB_OPT> 環境変数経由でコマンドラインからか、設定ファイルから |
2447 | 2304 | 変更できます。 |
2448 | 2305 | |
2449 | 2306 | =begin original |
2450 | 2307 | |
2451 | 2308 | You can do some customization by setting up a F<.perldb> file, which |
2452 | 2309 | contains initialization code. For instance, you could make aliases |
2453 | 2310 | like these (the last one is one people expect to be there): |
2454 | 2311 | |
2455 | 2312 | =end original |
2456 | 2313 | |
2457 | 2314 | 初期化コードを入れたファイル .perldb を設定することでも、 |
2458 | 2315 | いくらかのカスタマイズができます。 |
2459 | 2316 | たとえば、以下のようなエイリアスが行えます (最後のものは、 |
2460 | 2317 | 人々があると思っているものです): |
2461 | 2318 | |
2462 | 2319 | $DB::alias{'len'} = 's/^len(.*)/p length($1)/'; |
2463 | 2320 | $DB::alias{'stop'} = 's/^stop (at|in)/b/'; |
2464 | 2321 | $DB::alias{'ps'} = 's/^ps\b/p scalar /'; |
2465 | 2322 | $DB::alias{'quit'} = 's/^quit(\s*)/exit/'; |
2466 | 2323 | |
2467 | 2324 | =begin original |
2468 | 2325 | |
2469 | 2326 | You can change options from F<.perldb> by using calls like this one; |
2470 | 2327 | |
2471 | 2328 | =end original |
2472 | 2329 | |
2473 | 2330 | F<.perldb> のオプションを、以下のような呼び出しによって変更できます: |
2474 | 2331 | |
2475 | 2332 | parse_options("NonStop=1 LineInfo=db.out AutoTrace=1 frame=2"); |
2476 | 2333 | |
2477 | 2334 | =begin original |
2478 | 2335 | |
2479 | 2336 | The code is executed in the package C<DB>. Note that F<.perldb> is |
2480 | 2337 | processed before processing C<PERLDB_OPTS>. If F<.perldb> defines the |
2481 | 2338 | subroutine C<afterinit>, that function is called after debugger |
2482 | 2339 | initialization ends. F<.perldb> may be contained in the current |
2483 | 2340 | directory, or in the home directory. Because this file is sourced |
2484 | 2341 | in by Perl and may contain arbitrary commands, for security reasons, |
2485 | 2342 | it must be owned by the superuser or the current user, and writable |
2486 | 2343 | by no one but its owner. |
2487 | 2344 | |
2488 | 2345 | =end original |
2489 | 2346 | |
2490 | 2347 | コードは C<DB> パッケージで実行されます。 |
2491 | 2348 | F<.perldb> は C<PERLDB_OPTS> の前に処理されることに注意してください。 |
2492 | 2349 | F<.perldb> で C<afterinit> サブルーチンが定義されていると、この関数は |
2493 | 2350 | デバッガの初期化終了後に呼び出されます。 |
2494 | 2351 | F<.perldb> はカレントディレクトリかホームディレクトリに置くことができます。 |
2495 | 2352 | このファイルは Perl によって実行され、任意のコマンドを含めることが |
2496 | 2353 | できるので、セキュリティ上の理由から、スーパーユーザーが現在のユーザーに |
2497 | 2354 | よって所有され、所有者以外には書込み禁止になっていなければなりません。 |
2498 | 2355 | |
2499 | 2356 | =begin original |
2500 | 2357 | |
2501 | 2358 | You can mock TTY input to debugger by adding arbitrary commands to |
2502 | 2359 | @DB::typeahead. For example, your F<.perldb> file might contain: |
2503 | 2360 | |
2504 | 2361 | =end original |
2505 | 2362 | |
2506 | 2363 | @DB::typeahead に任意のコマンドを追加することで、デバッガへの TTY 入力を |
2507 | 2364 | 模倣できます。 |
2508 | 2365 | 例えば、あなたの F<.perldb> ファイルに以下のように書くと: |
2509 | 2366 | |
2510 | 2367 | sub afterinit { push @DB::typeahead, "b 4", "b 6"; } |
2511 | 2368 | |
2512 | 2369 | =begin original |
2513 | 2370 | |
2514 | 2371 | Which would attempt to set breakpoints on lines 4 and 6 immediately |
2515 | 2372 | after debugger initialization. Note that @DB::typeahead is not a supported |
2516 | 2373 | interface and is subject to change in future releases. |
2517 | 2374 | |
2518 | 2375 | =end original |
2519 | 2376 | |
2520 | 2377 | デバッガ初期化の直後に 4 行目と 6 行目にブレークポイントを |
2521 | 2378 | 設定しようとします。 |
2522 | 2379 | @DB::typeahead はサポートしているインターフェースではなく、将来の |
2523 | 2380 | リリースでは変更されることがあることに注意してください。 |
2524 | 2381 | |
2525 | 2382 | =begin original |
2526 | 2383 | |
2527 | 2384 | If you want to modify the debugger, copy F<perl5db.pl> from the |
2528 | 2385 | Perl library to another name and hack it to your heart's content. |
2529 | 2386 | You'll then want to set your C<PERL5DB> environment variable to say |
2530 | 2387 | something like this: |
2531 | 2388 | |
2532 | 2389 | =end original |
2533 | 2390 | |
2534 | 2391 | デバッガを変更したい場合には、perl5db.pl を Perl ライブラリから |
2535 | 2392 | 別の名前にコピーし、修正してください。それから |
2536 | 2393 | 環境変数 C<PERL5DB> には、以下のように設定する必要があるでしょう: |
2537 | 2394 | |
2538 | 2395 | BEGIN { require "myperl5db.pl" } |
2539 | 2396 | |
2540 | 2397 | =begin original |
2541 | 2398 | |
2542 | 2399 | As a last resort, you could also use C<PERL5DB> to customize the debugger |
2543 | 2400 | by directly setting internal variables or calling debugger functions. |
2544 | 2401 | |
2545 | 2402 | =end original |
2546 | 2403 | |
2547 | 2404 | 最後の手段として、 C<PERL5DB> を、直接内部変数を設定したり |
2548 | 2405 | デバッガ関数を呼び出すことでデバッガをカスタマイズすることもできます。 |
2549 | 2406 | |
2550 | 2407 | =begin original |
2551 | 2408 | |
2552 | 2409 | Note that any variables and functions that are not documented in |
2553 | 2410 | this document (or in L<perldebguts>) are considered for internal |
2554 | 2411 | use only, and as such are subject to change without notice. |
2555 | 2412 | |
2556 | 2413 | =end original |
2557 | 2414 | |
2558 | 2415 | このドキュメント(や L<perldebguts>)に記述されていない変数や |
2559 | 2416 | 関数は内部使用専用として扱われ、予告なく変更されることがあります。 |
2560 | 2417 | |
2561 | =head2 Readline Support / History in the | |
2418 | =head2 Readline Support / History in the debugger | |
2562 | 2419 | |
2563 | 2420 | (readline 対応 / デバッガのヒストリ) |
2564 | 2421 | |
2565 | 2422 | =begin original |
2566 | 2423 | |
2567 | 2424 | As shipped, the only command-line history supplied is a simplistic one |
2568 | 2425 | that checks for leading exclamation points. However, if you install |
2569 | 2426 | the Term::ReadKey and Term::ReadLine modules from CPAN (such as |
2570 | 2427 | Term::ReadLine::Gnu, Term::ReadLine::Perl, ...) you will |
2571 | have full editing capabilities much like | |
2428 | have full editing capabilities much like GNU I<readline>(3) provides. | |
2572 | 2429 | Look for these in the F<modules/by-module/Term> directory on CPAN. |
2573 | 2430 | These do not support normal B<vi> command-line editing, however. |
2574 | 2431 | |
2575 | 2432 | =end original |
2576 | 2433 | |
2577 | 2434 | 出荷時の状態では、コマンドライン履歴参照機能として提供されるのは、 |
2578 | 2435 | エクスクラメーションマークを付けることによる単純なものだけです。 |
2579 | 2436 | しかし、(Term::ReadLine::Gnu, Term::ReadLine::Perl, ... のように) |
2580 | 2437 | CPAN から Term::ReadKey と Term::ReadLine のモジュールを |
2581 | 2438 | インストールすることで、GNU I<readline>(3) が提供するような |
2582 | 2439 | 完全な編集機能が使えるようになります。 |
2583 | 2440 | これらは CPAN の F<modules/by-module/Term> ディレクトリにあります。 |
2584 | 2441 | しかし、これらは通常の B<vi> コマンドライン編集は対応していません。 |
2585 | 2442 | |
2586 | 2443 | =begin original |
2587 | 2444 | |
2588 | 2445 | A rudimentary command-line completion is also available, including |
2589 | 2446 | lexical variables in the current scope if the C<PadWalker> module |
2590 | 2447 | is installed. |
2591 | 2448 | |
2592 | 2449 | =end original |
2593 | 2450 | |
2594 | 2451 | 基本的なパッケージ単位のメモリ使用量ダンプ; C<PadWalker> モジュールが |
2595 | 2452 | インストールされているなら現在のスコープのレキシカル変数も含みます。 |
2596 | 2453 | |
2597 | 2454 | =begin original |
2598 | 2455 | |
2599 | 2456 | Without Readline support you may see the symbols "^[[A", "^[[C", "^[[B", |
2600 | 2457 | "^[[D"", "^H", ... when using the arrow keys and/or the backspace key. |
2601 | 2458 | |
2602 | 2459 | =end original |
2603 | 2460 | |
2604 | 2461 | Readline 対応なしでは、矢印キーやバックスペースキーを使うと |
2605 | 2462 | "^[[A", "^[[C", "^[[B", "^[[D"", "^H" のような表示を見るかもしれません。 |
2606 | 2463 | |
2607 | 2464 | =head2 Editor Support for Debugging |
2608 | 2465 | |
2609 | 2466 | (デバッグのためのエディタ対応) |
2610 | 2467 | |
2611 | 2468 | =begin original |
2612 | 2469 | |
2613 | If you have the | |
2470 | If you have the FSF's version of B<emacs> installed on your system, | |
2614 | 2471 | it can interact with the Perl debugger to provide an integrated |
2615 | 2472 | software development environment reminiscent of its interactions |
2616 | 2473 | with C debuggers. |
2617 | 2474 | |
2618 | 2475 | =end original |
2619 | 2476 | |
2620 | ||
2477 | FSF 版の B<emacs> がシステムにインストールされている場合は、 | |
2621 | 2478 | C デバッガとの連携を連想させるような、Perl デバッガとの統合 |
2622 | 2479 | ソフトウェア開発環境を提供します。 |
2623 | 2480 | |
2624 | 2481 | =begin original |
2625 | 2482 | |
2626 | ||
2483 | Perl comes with a start file for making B<emacs> act like a | |
2627 | start file for making B<emacs> act like a | |
2628 | 2484 | syntax-directed editor that understands (some of) Perl's syntax. |
2629 | ||
2485 | Look in the I<emacs> directory of the Perl source distribution. | |
2630 | 2486 | |
2631 | 2487 | =end original |
2632 | 2488 | |
2633 | ||
2489 | Perl には B<emacs> を Perl の文法(の一部)を解釈する文法指向の | |
2634 | 2490 | エディタとして振舞わせるためのスタートファイルを同梱しています。 |
2635 | ||
2491 | Perl ソース配布の I<emacs> ディレクトリを参照してください。 | |
2636 | 2492 | |
2637 | 2493 | =begin original |
2638 | 2494 | |
2495 | A similar setup by Tom Christiansen for interacting with any | |
2496 | vendor-shipped B<vi> and the X11 window system is also available. | |
2497 | This works similarly to the integrated multiwindow support that | |
2498 | B<emacs> provides, where the debugger drives the editor. At the | |
2499 | time of this writing, however, that tool's eventual location in the | |
2500 | Perl distribution was uncertain. | |
2501 | ||
2502 | =end original | |
2503 | ||
2504 | ベンダー同梱の B<vi> および X11 ウィンドウシステムと相互作用させるための | |
2505 | Tom Christiansen による似たようなセットアップも利用可能です。 | |
2506 | これは B<emacs> が提供する統合マルチウィンドウサポートと同様に動作し、 | |
2507 | デバッガがエディタを制御します。 | |
2508 | しかし、これを記述している時点では、このツールの Perl 配布の中での | |
2509 | 最終的な位置は不確定です。 | |
2510 | ||
2511 | =begin original | |
2512 | ||
2639 | 2513 | Users of B<vi> should also look into B<vim> and B<gvim>, the mousey |
2640 | 2514 | and windy version, for coloring of Perl keywords. |
2641 | 2515 | |
2642 | 2516 | =end original |
2643 | 2517 | |
2644 | 2518 | B<vi> ユーザーは、Perl のキーワードを色付けする、マウスとウィンドウ対応の |
2645 | 2519 | B<vim> と B<gvim> を調べてみてください。 |
2646 | 2520 | |
2647 | 2521 | =begin original |
2648 | 2522 | |
2649 | 2523 | Note that only perl can truly parse Perl, so all such CASE tools |
2650 | 2524 | fall somewhat short of the mark, especially if you don't program |
2651 | 2525 | your Perl as a C programmer might. |
2652 | 2526 | |
2653 | 2527 | =end original |
2654 | 2528 | |
2655 | 2529 | perl のみが完全に Perl をパースできるので、これら全ての CASE ツールには |
2656 | 2530 | 足りないところがあることに注意してください; 特に C プログラマーが書くような |
2657 | 2531 | Perl プログラムを書いていない場合はそうです。 |
2658 | 2532 | |
2659 | 2533 | =head2 The Perl Profiler |
2660 | 2534 | X<profile> X<profiling> X<profiler> |
2661 | 2535 | |
2662 | 2536 | (Perl プロファイラ) |
2663 | 2537 | |
2664 | 2538 | =begin original |
2665 | 2539 | |
2666 | 2540 | If you wish to supply an alternative debugger for Perl to run, |
2667 | 2541 | invoke your script with a colon and a package argument given to the |
2668 | B<-d> flag. Perl's alternative debuggers include | |
2542 | B<-d> flag. Perl's alternative debuggers include the Perl profiler, | |
2669 | L<Devel:: | |
2543 | L<Devel::DProf>, which is included with the standard Perl | |
2670 | 2544 | distribution. To profile your Perl program in the file F<mycode.pl>, |
2671 | 2545 | just type: |
2672 | 2546 | |
2673 | 2547 | =end original |
2674 | 2548 | |
2675 | 2549 | Perl の実行に代替デバッガを使いたい場合は、B<-d> オプションに |
2676 | 2550 | コロンとパッケージからなる引数を付けてスクリプトを起動してください。 |
2677 | 2551 | Perl 用代替デバッガは Perl プロファイラを含む |
2678 | L<Devel::DProf> で、 | |
2552 | L<Devel::DProf> で、Perl 標準配布に含まれています。 | |
2679 | 2553 | ファイル F<mycode.pl> にある Perl プログラムをプロファイリングしたい |
2680 | 2554 | 場合、以下のようにします: |
2681 | 2555 | |
2682 | $ perl -d: | |
2556 | $ perl -d:DProf mycode.pl | |
2683 | 2557 | |
2684 | 2558 | =begin original |
2685 | 2559 | |
2686 | When the script terminates the profiler will | |
2560 | When the script terminates the profiler will dump the profile | |
2687 | ||
2561 | information to a file called F<tmon.out>. A tool like B<dprofpp>, | |
2688 | ||
2562 | also supplied with the standard Perl distribution, can be used to | |
2563 | interpret the information in that profile. More powerful profilers, | |
2564 | such as C<Devel::NYTProf> are available from the CPAN: see L<perlperf> | |
2565 | for details. | |
2689 | 2566 | |
2690 | 2567 | =end original |
2691 | 2568 | |
2692 | スクリプトが終了すると、プロファイラはプロファイ | |
2569 | スクリプトが終了すると、プロファイラはプロファイル情報を | |
2693 | ||
2570 | F<tmon.out> というファイルにダンプします。 | |
2694 | ||
2571 | Perl 標準配布に含まれている B<dprofpp> のようなツールが、この | |
2572 | プロファイルの情報を解釈するのに使えます。 | |
2573 | C<Devel::NYTProf> のような、より強力なプロファイラは CPAN から | |
2574 | 利用可能です: 詳しくは L<perlperf> を参照してください。 | |
2695 | 2575 | |
2696 | =head1 Debugging | |
2576 | =head1 Debugging regular expressions | |
2697 | 2577 | X<regular expression, debugging> |
2698 | 2578 | X<regex, debugging> X<regexp, debugging> |
2699 | 2579 | |
2700 | 2580 | (正規表現のデバッグ) |
2701 | 2581 | |
2702 | 2582 | =begin original |
2703 | 2583 | |
2704 | 2584 | C<use re 'debug'> enables you to see the gory details of how the Perl |
2705 | 2585 | regular expression engine works. In order to understand this typically |
2706 | 2586 | voluminous output, one must not only have some idea about how regular |
2707 | 2587 | expression matching works in general, but also know how Perl's regular |
2708 | 2588 | expressions are internally compiled into an automaton. These matters |
2709 | 2589 | are explored in some detail in |
2710 | L<perldebguts/"Debugging | |
2590 | L<perldebguts/"Debugging regular expressions">. | |
2711 | 2591 | |
2712 | 2592 | =end original |
2713 | 2593 | |
2714 | 2594 | C<use re 'debug'> を指定すると、Perl 正規表現エンジンがどのように |
2715 | 2595 | 動作するかの詳細を見ることができます。 |
2716 | 2596 | この、典型的には大量の出力を理解するためには、 |
2717 | 2597 | 一般的に正規表現マッチがどのように行われるかだけでなく、 |
2718 | 2598 | Perl の正規表現が内部的にどのようにオートマトンにコンパイルされるかを |
2719 | 2599 | 知らなければなりません。 |
2720 | 2600 | これらの事柄は詳細は |
2721 | L<perldebguts/"Debugging | |
2601 | L<perldebguts/"Debugging regular expressions"> にあります。 | |
2722 | 2602 | |
2723 | =head1 Debugging | |
2603 | =head1 Debugging memory usage | |
2724 | 2604 | X<memory usage> |
2725 | 2605 | |
2726 | 2606 | (メモリ使用のデバッグ) |
2727 | 2607 | |
2728 | 2608 | =begin original |
2729 | 2609 | |
2730 | 2610 | Perl contains internal support for reporting its own memory usage, |
2731 | 2611 | but this is a fairly advanced concept that requires some understanding |
2732 | 2612 | of how memory allocation works. |
2733 | See L<perldebguts/"Debugging Perl | |
2613 | See L<perldebguts/"Debugging Perl memory usage"> for the details. | |
2734 | 2614 | |
2735 | 2615 | =end original |
2736 | 2616 | |
2737 | Perl には自身のメモリ使用状況を報告するための内部機能があります | |
2617 | Perl には自身のメモリ使用状況を報告するための内部機能があります。 | |
2738 | 2618 | しかしこれはかなり上級の概念で、メモリ割り当てがどのように行われるかに |
2739 | 2619 | ついての理解が必要となります。 |
2740 | 2620 | 詳細については |
2741 | L<perldebguts/"Debugging Perl | |
2621 | L<perldebguts/"Debugging Perl memory usage"> を参照して下さい。 | |
2742 | 2622 | |
2743 | 2623 | =head1 SEE ALSO |
2744 | 2624 | |
2745 | 2625 | =begin original |
2746 | 2626 | |
2747 | You d | |
2627 | You did try the B<-w> switch, didn't you? | |
2748 | 2628 | |
2749 | 2629 | =end original |
2750 | 2630 | |
2751 | ||
2631 | B<-w> スイッチはもう使いましたよね? | |
2752 | 2632 | |
2753 | 2633 | =begin original |
2754 | 2634 | |
2755 | 2635 | L<perldebtut>, |
2756 | 2636 | L<perldebguts>, |
2757 | 2637 | L<re>, |
2758 | 2638 | L<DB>, |
2759 | L<Devel:: | |
2639 | L<Devel::DProf>, | |
2640 | L<dprofpp>, | |
2760 | 2641 | L<Dumpvalue>, |
2761 | 2642 | and |
2762 | 2643 | L<perlrun>. |
2763 | 2644 | |
2764 | 2645 | =end original |
2765 | 2646 | |
2766 | 2647 | L<perldebtut>, |
2767 | 2648 | L<perldebguts>, |
2768 | 2649 | L<re>, |
2769 | 2650 | L<DB>, |
2770 | 2651 | L<Devel::DProf>, |
2771 | 2652 | L<dprofpp>, |
2772 | 2653 | L<Dumpvalue>, |
2773 | 2654 | L<perlrun>. |
2774 | 2655 | |
2775 | 2656 | =begin original |
2776 | 2657 | |
2777 | 2658 | When debugging a script that uses #! and is thus normally found in |
2778 | 2659 | $PATH, the -S option causes perl to search $PATH for it, so you don't |
2779 | 2660 | have to type the path or C<which $scriptname>. |
2780 | 2661 | |
2781 | 2662 | =end original |
2782 | 2663 | |
2783 | 2664 | #! を使っているので普通は $PATH に見つかるスクリプトをデバッグするとき、 |
2784 | 2665 | -S オプションを付けると perl は $PATH からスクリプトを探すので、 |
2785 | 2666 | パスや C<which $scriptname> をタイプする必要がなくなります。 |
2786 | 2667 | |
2787 | 2668 | $ perl -Sd foo.pl |
2788 | 2669 | |
2789 | 2670 | =head1 BUGS |
2790 | 2671 | |
2791 | 2672 | =begin original |
2792 | 2673 | |
2793 | 2674 | You cannot get stack frame information or in any fashion debug functions |
2794 | 2675 | that were not compiled by Perl, such as those from C or C++ extensions. |
2795 | 2676 | |
2796 | 2677 | =end original |
2797 | 2678 | |
2798 | 2679 | C や C++ 拡張のような、Perl でコンパイルされていないものに対して |
2799 | 2680 | スタックフレーム情報やあらゆるデバッグ関数を使うことはできません。 |
2800 | 2681 | |
2801 | 2682 | =begin original |
2802 | 2683 | |
2803 | 2684 | If you alter your @_ arguments in a subroutine (such as with C<shift> |
2804 | 2685 | or C<pop>), the stack backtrace will not show the original values. |
2805 | 2686 | |
2806 | 2687 | =end original |
2807 | 2688 | |
2808 | 2689 | サブルーチン内で(C<shift> や C<pop> を使って) @_ 引数を変更した場合、 |
2809 | 2690 | スタックバックトレースで元の値を表示することはできません。 |
2810 | 2691 | |
2811 | 2692 | =begin original |
2812 | 2693 | |
2813 | 2694 | The debugger does not currently work in conjunction with the B<-W> |
2814 | 2695 | command-line switch, because it itself is not free of warnings. |
2815 | 2696 | |
2816 | 2697 | =end original |
2817 | 2698 | |
2818 | デバッガは現在のところ B<-W> コマンドラインスイッチと同時に | |
2699 | デバッガは現在のところ B<-W> コマンドラインスイッチと同時に | |
2819 | できません | |
2700 | 使うことはできません。これ自身が警告から逃れられないからです。 | |
2820 | 2701 | |
2821 | 2702 | =begin original |
2822 | 2703 | |
2823 | 2704 | If you're in a slow syscall (like C<wait>ing, C<accept>ing, or C<read>ing |
2824 | 2705 | from your keyboard or a socket) and haven't set up your own C<$SIG{INT}> |
2825 | 2706 | handler, then you won't be able to CTRL-C your way back to the debugger, |
2826 | 2707 | because the debugger's own C<$SIG{INT}> handler doesn't understand that |
2827 | 2708 | it needs to raise an exception to longjmp(3) out of slow syscalls. |
2828 | 2709 | |
2829 | 2710 | =end original |
2830 | 2711 | |
2831 | (キーボードやソケットからの C<wait>, C<accept>, C<read>などの) | |
2712 | (キーボードやソケットからの C<wait>, C<accept>, C<read>などの) | |
2832 | システムコールを実行中で、独自の C<$SIG{INT}> ハンドラを設定していない場合、 | |
2713 | 遅いシステムコールを実行中で、独自の C<$SIG{INT}> ハンドラを設定していない場合、 | |
2833 | デバッガに戻ってくるために CTRL-C を使うことはできません | |
2714 | デバッガに戻ってくるために CTRL-C を使うことはできません。 | |
2834 | これは、デバッガ自身の C<$SIG{INT}> ハンドラが | |
2715 | これは、デバッガ自身の C<$SIG{INT}> ハンドラが | |
2835 | longjmp(3) で出るための例外を発生させる必要性を | |
2716 | 遅いシステムコールから longjmp(3) で出るための例外を発生させる必要性を | |
2717 | 理解しないからです。 | |
2836 | 2718 | |
2837 | 2719 | =begin meta |
2838 | 2720 | |
2839 | 2721 | Translate: 吉村 寿人 <JAE00534@niftyserve.or.jp> (5.000) |
2840 | 2722 | Update: SHIRAKATA Kentaro <argrath@ub32.org> (5.6.1-) |
2841 | 2723 | Status: completed |
2842 | 2724 | |
2843 | 2725 | =end meta |