X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDB.pm;h=efb903557a748b71d006d29fdb1dce139dd97f5c;hb=826e305c121e97f2805978bb1fece36c68f57daa;hp=257542359334e90c0b774743e16b314ce84762be;hpb=6e2389900607e3ba1246245908fb3c54e7e4c763;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/DB.pm b/lib/DB.pm index 2575423..efb9035 100644 --- a/lib/DB.pm +++ b/lib/DB.pm @@ -41,7 +41,7 @@ BEGIN { $DB::subname = ''; # currently executing sub (fullly qualified name) $DB::lineno = ''; # current line number - $DB::VERSION = $DB::VERSION = '1.0'; + $DB::VERSION = $DB::VERSION = '1.02'; # initialize private globals to avoid warnings @@ -63,8 +63,7 @@ sub sub { push(@stack, $DB::single); $DB::single &= 1; $DB::single |= 4 if $#stack == $deep; -# print $DB::sub, "\n"; - if ($DB::sub =~ /(?:^|::)DESTROY$/ or not defined wantarray) { + if ($DB::sub eq 'DESTROY' or substr($DB::sub, -9) eq '::DESTROY' or not defined wantarray) { &$DB::sub; $DB::single |= pop(@stack); $DB::ret = undef; @@ -93,6 +92,16 @@ sub DB { $usrctxt = "package $DB::package;"; # this won't let them modify, alas local(*DB::dbline) = "::_<$DB::filename"; + + # we need to check for pseudofiles on Mac OS (these are files + # not attached to a filename, but instead stored in Dev:Pseudo) + # since this is done late, $DB::filename will be "wrong" after + # skippkg + if ($^O eq 'MacOS' && $#DB::dbline < 0) { + $DB::filename = 'Dev:Pseudo'; + *DB::dbline = "::_<$DB::filename"; + } + my ($stop, $action); if (($stop,$action) = split(/\0/,$DB::dbline{$DB::lineno})) { if ($stop eq '1') { @@ -406,8 +415,7 @@ sub _find_subline { $name = "main" . $name if substr($name,0,2) eq "::"; my($fname, $from, $to) = ($DB::sub{$name} =~ /^(.*):(\d+)-(\d+)$/); if ($from) { - # XXX this needs local()-ization of some sort - *DB::dbline = "::_<$fname"; + local *DB::dbline = "::_<$fname"; ++$from while $DB::dbline[$from] == 0 && $from < $to; return $from; } @@ -547,17 +555,16 @@ __END__ =head1 NAME -DB - programmatic interface to the Perl debugging API (draft, subject to -change) +DB - programmatic interface to the Perl debugging API =head1 SYNOPSIS package CLIENT; use DB; @ISA = qw(DB); - + # these (inherited) methods can be called by the client - + CLIENT->register() # register a client package name CLIENT->done() # de-register from the debugging API CLIENT->skippkg('hide::hide') # ask DB not to stop in this package @@ -585,7 +592,7 @@ change) # These methods will be called at the appropriate times. # Stub versions provided do nothing. # None of these can block. - + CLIENT->init() # called when debug API inits itself CLIENT->stop(FILE,LINE) # when execution stops CLIENT->idle() # while stopped (can be a client event loop)