From: Gurusamy Sarathy Date: Wed, 2 Feb 2000 07:58:35 +0000 (+0000) Subject: fixes for switching files in the debugger (from Ilya Zakharevich) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bee32ff8f5fb3bbd86101dcb039642bf5fde9142;p=p5sagit%2Fp5-mst-13.2.git fixes for switching files in the debugger (from Ilya Zakharevich) p4raw-id: //depot/perl@4955 --- diff --git a/lib/perl5db.pl b/lib/perl5db.pl index b463dec..aff5c68 100644 --- a/lib/perl5db.pl +++ b/lib/perl5db.pl @@ -607,6 +607,8 @@ EOP $subrange = pop @pieces; $file = join(':', @pieces); if ($file ne $filename) { + print $OUT "Switching to file '$file'.\n" + unless $emacs; *dbline = $main::{'_<' . $file}; $max = $#dbline; $filename = $file; @@ -793,8 +795,8 @@ EOP ($file,$i) = (find_sub($subname) =~ /^(.*):(.*)$/); $i += 0; if ($i) { - $filename = $file; - *dbline = $main::{'_<' . $filename}; + local $filename = $file; + local *dbline = $main::{'_<' . $filename}; $had_breakpoints{$filename} = 1; $max = $#dbline; ++$i while $dbline[$i] == 0 && $i < $max; @@ -884,6 +886,10 @@ EOP $cmd =~ /^c\b\s*([\w:]*)\s*$/ && do { end_report(), next CMD if $finished and $level <= 1; $subname = $i = $1; + # Probably not needed, since we finish an interactive + # sub-session anyway... + # local $filename = $filename; + # local *dbline = *dbline; # XXX Would this work?! if ($i =~ /\D/) { # subroutine name $subname = $package."::".$subname unless $subname =~ /::/; @@ -1811,7 +1817,13 @@ B List next window of lines. B<-> List previous window of lines. B [I] List window around I. B<.> Return to the executed line. -B I Switch to viewing I. Must be loaded. +B I Switch to viewing I. File must be already loaded. + I may be either the full name of the file, or a regular + expression matching the full file name: + B I and B I may access the same file. + Evals (with saved bodies) are considered to be filenames: + B I<(eval 7)> and B I access the body of the 7th eval + (in the order of execution). BIB Search forwards for I; final B is optional. BIB Search backwards for I; final B is optional. B List all breakpoints and actions. diff --git a/pod/perldebug.pod b/pod/perldebug.pod index 5699732..65a07e2 100644 --- a/pod/perldebug.pod +++ b/pod/perldebug.pod @@ -174,6 +174,12 @@ Switch to viewing a different file or eval statement. If C is not a full filename as found in values of %INC, it is considered as a regexp. +Ced strings (when accessible) are considered to be filenames: +C and C access the body of the 7th Ced string +(in the order of execution). The bodies of currently executed C +and of Ced strings which define subroutines are saved, thus are +accessible by this mechanism. + =item /pattern/ Search forwards for pattern; final / is optional.