我之前已经成功地将 Perl EPIC 的调试器与 Eclipse 3.7 一起使用,但几个月前升级到了 Eclipse Kepler,从那时起直到今天都不需要调试任何 Perl。今天 EPIC 忽略了我的一些断点,输出如下:
[Tue Sep 16 15:05:37 2014] perl5db.pl:640]: Use of uninitialized value $path in hash element at [...]/epic_breakpoints.pm line 73, <DATA> line 429.
[Tue Sep 16 15:05:37 2014] perl5db.pl:640]: Use of uninitialized value $path in pattern match (m//) at C:/Program Files/Perl/lib/Cwd.pm line 627, <DATA> line 429.
[Tue Sep 16 15:05:37 2014] perl5db.pl:640]: Use of uninitialized value in string ne at [...]/epic_breakpoints.pm line 94, <DATA> line 429.
请注意,这不是为 Windows 记录的众所周知的Cwd.pm 问题,而是似乎添加断点本身不再起作用。来自提到的 epic_breakpoints.pm 的相关代码如下:
8: use Cwd 'abs_path';
36: sub add_breakpoint
37: {
38: eval { _add_breakpoint(@_); };
39: # note/TODO: $@ ne '' here if the line was not breakable
40: }
69: sub _abs_path
70: {
71: my $path = shift;
72:
73: my $cached = $abs_path_cache{$path};
74: return $cached if $cached;
75:
76: eval { $cached = $abs_path_cache{$path} = abs_path($path); };
77: return defined($cached) ? $cached : $path;
78: }
79:
80: sub _add_breakpoint
81: {
82: my $source_path = _abs_path(_trim(shift));
[...]
问题似乎是 $path 未定义,当然不应该是这种情况。我激活了 EPIC 的调试器控制台并得到以下输出:
Loading DB routines from perl5db.pl version 1.33
Editor support available.
Enter h or `h h' for help, or `perldoc perldebug' for more help.
Attribute::Handlers::CODE(0x29c75e8)(C:/Program Files/Perl/lib/Attribute/Handlers.pm:246):
246: $global_phase++;
DB<1> printf $DB::OUT "%vd", $^V;
5.14.4
DB<2> print $DB::OUT eval { require PadWalker; PadWalker->VERSION(0.08) }
1.96
DB<3> ;{
my $file = <<'EOT';
C:/Users/tschoening/Documents/Eclipse/Perl/Perl-Bibliotheken/stmodul/amsoft_warn_filter.pm
EOT
my $line = <<'EOT';
106
EOT
my $cond = '';
epic_breakpoints::add_breakpoint($file, $line, $cond);
};
显然,调试器似乎获得了可用的路径并调用了正确的函数,但不知何故,提供的 args 似乎不再通过。EPIC 似乎总是从它的 Eclipse 包中提取 epic_breakpoints.pm 的不良行为,因此我似乎无法调试 add_breakpoint 以及提供的参数(如果有)。
现在有趣的是,我拥有的一些非常琐碎的 Perl 测试文件,没有任何包之类的,只有一些 Perl 行,仍然可以成功调试,包括添加断点。所以总的来说,调试应该可以工作,这再次表明我没有遇到Cwd.pm 问题。
你知道我在我的 Perl 包中可能做错了什么,这些错误似乎会干扰调试代码吗?我可以对 eval 等的一般 args 处理做些什么?我想调试的应用程序有点大,我目前不知道要照顾什么,因此我很感激你提供的任何提示,我应该照顾什么。
谢谢!