在调试器中传递参数到perl文件,并在系统执行的文件中设置断点
所以我使用perl -d file.pl在perl调试器中运行一个文件。但是,file.pl应该也是参数。如何为file.pl
提供参数还有一个问题:file.pl中有这行:
So I run a file in the perl debugger using perl -d file.pl. But then the file.pl is supposed to take arguments also. How do I supply arguments to the file.pl One more question: file.pl has this line in it:
system("./file2.pl");
有没有办法在file2.pl中设置断点,如果它以系统
?我在perl调试器上花费了7天时间,我无法在file2.pl设置断点请帮助
Is there a way to set a breakpoint in file2.pl if it is running as system
? I have spent 7 days on perl debugger and I am not able to set a breakpoint at file2.pl Please help
编辑:从DVK获得一个令人敬畏的响应添加DB: :单= 1。我测试了一些文件,它的工作。但是我有超过100个文件,如果我手动这样做,这将需要很多时间。我使用.perldb并使用afterinit来打开所有命令。我已经建立了一个算法,找到断点需要去的每个文件的行号。我无法随机(自动使用可执行文件)打开所有这些文件,并将DB :: single = 1添加到我喜欢的地方。整个系统可能会崩溃。我想设置断点,因为它更安全
Got an awesome response from DVK to add DB::single=1. I tested that on some files and it worked. But I have more than a 100 files and if I do this manually, it will take me a lot of time. I use .perldb and use afterinit to typeahead all commands. I have put in place an algorithm which finds the line number of each file where the breakpoint needs to go. I just can't randomly (automatically using an executable) open all those files and add DB::single=1 to where I like. The whole system can crash then. I want to set breakpoint as it more secure
是的,你可以。
将以下代码添加到您想在 file2.pl
中打破的行:
Add the following code to the line where you want to break in file2.pl
:
$DB::single = 1;
为了自动控制调试,您需要操作 @DB :: typahead
数组。从 perldoc :
To control the debugging automatically from that point, you need to manipulate @DB::typeahead
array. From perldoc:
您可以通过向@DB :: typeahead添加任意命令来模拟TTY输入到调试器。例如,.perldb文件可能包含:
You can mock TTY input to debugger by adding arbitrary commands to @DB::typeahead. For example, your .perldb file might contain:
sub afterinit { push @DB::typeahead, "b 4", "b 6"; }
此代码可以是 BEGIN {}
阻止,或特殊 .perldb
配置文件。
This code can be either in a BEGIN {}
block, or a special .perldb
config file.