debugging 如何在Perl模块的函数中设置断点?

vcudknz3  于 2023-05-29  发布在  Perl
关注(0)|答案(1)|浏览(239)

根据我的期望和https://stackoverflow.com/a/26875706/6607497,以下应该可以工作,但没有:

### complex test program using Test::More
### ...
ok 5 - use Auth::KeyStore::SQLite;
### ...
### So the module has been loaded
  DB<9> b Auth::KeyStore::SQLite:827
Line 827 of 'Auth::KeyStore::SQLite' not breakable.
### OK, that would mean there is no valid instruction on that line, BUT:
  DB<10> l Auth::KeyStore::SQLite::get_key
Switching to file 'lib/Auth/KeyStore/SQLite.pm'.
818     {
819:        my ($self, $id, $PIN) = @_;
820:        my $key_struct = $self->get_keystruct($id, $PIN);
821:        my $result = defined $key_struct ? $key_struct->key_data() : undef;
822
823:        $self->add_error(EB_NOT_FOUND, "key data not found for $id")
824             unless (defined $result);
825:        print "XXX: get_key: ", $result->as_string(), "\n"
826             if (defined $result);
827:        return $result
828     }
  DB<11> b 827
  DB<12>
### So line 827 is actually breakable!

这是x86-64(perl5 (revision 5 version 18 subversion 2)perl-5.18.2-12.23.1.x86_64)上SLES 12 SP 5的当前Perl。

kiayqfof

kiayqfof1#

没有名为Auth::KeyStore::SQLite的文件,因此无法在该文件中创建断点。
命令应该是

b lib/Auth/KeyStore/SQLite.pm:827

相关问题