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