Perl デバッガーを で呼び出すと、デバッガーは起動しますが、 (次へ) または(続行)perl -d myscript.pl
を押すまでコードを実行しません。n
c
デバッガーを呼び出して、ブレークポイントに到達するまでデフォルトでコードを実行する方法はありますか?
もしそうなら、デバッガーがヒットしたときに停止させるためのブレークポイントとしてコードで使用できるステートメントはありますか?
アップデート:
これが私の.perldb
ファイルにあるものです:
print "Reading ~/.perldb options.\n";
push @DB::typeahead, "c";
parse_options("NonStop=1");
これが私のhello_world.pl
ファイルです:
use strict;
use warnings;
print "Hello world.\n";
$DB::single=1;
print "How are you?";
実行中のデバッグ セッションは次のとおりperl -d hello_world.pl
です。
Reading ~/.perldb options.
Hello world
main::(hello_world.pl:6): print "How are you?";
auto(-1) DB<1> c
Debugged program terminated. Use q to quit or R to restart,
use o inhibit_exit to avoid stopping after program termination,
h q, h R or h o to get additional info.
DB<1> v
9563 9564
9565 sub at_exit {
9566==> "Debugged program terminated. Use `q' to quit or `R' to restart.";
9567 }
9568
9569 package DB; # Do not trace this 1; below!
DB<1>
つまり、私のデバッガーは をスキップprint "How are you?"
し、代わりにプログラムが終了すると停止します。これは私が望んでいるものではありません。
私が望むのは、明示的にステートメントがない限り、どこでも (スクリプトの最初でも最後でも)停止せずにデバッガーにコードを実行させることです。その場合、次の行を実行する前に停止させたいと思います。これを行う方法はありますか?$DB::single=1;
参考までに、私は以下を使用しています:
$perl --version
This is perl 5, version 14, subversion 1 (v5.14.1) built for x86_64-linux