[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
[PATCH 5.005_62] File switching in debugger
This should better demystify which file is considered 'active' by the
debugger.
Enjoy,
Ilya
P.S. Would local *glob = *glob protect the global value the same way
local $var = $var does?
--- ./lib/perl5db.pl.ini Wed Oct 13 02:05:26 1999
+++ ./lib/perl5db.pl Sat Jan 29 15:04:52 2000
@@ -591,6 +591,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;
@@ -777,8 +779,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;
@@ -868,6 +870,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 =~ /::/;
@@ -1779,7 +1785,13 @@ B<l> List next window of lines.
B<-> List previous window of lines.
B<w> [I<line>] List window around I<line>.
B<.> Return to the executed line.
-B<f> I<filename> Switch to viewing I<filename>. Must be loaded.
+B<f> I<filename> Switch to viewing I<filename>. File must be already loaded.
+ I<filename> may be either the full name of the file, or a regular
+ expression matching the full file name:
+ B<f> I</home/me/foo.pl> and B<f> I<oo\\.> may access the same file.
+ Evals (with saved bodies) are considered to be filenames:
+ B<f> I<(eval 7)> and B<f> I<eval 7\\b> access the body of the 7th eval
+ (in the order of execution).
B</>I<pattern>B</> Search forwards for I<pattern>; final B</> is optional.
B<?>I<pattern>B<?> Search backwards for I<pattern>; final B<?> is optional.
B<L> List all breakpoints and actions.
--- ./pod/perldebug.pod.ini Tue Jul 20 12:18:08 1999
+++ ./pod/perldebug.pod Sat Jan 29 15:11:52 2000
@@ -174,6 +174,12 @@ Switch to viewing a different file or ev
is not a full filename as found in values of %INC, it is considered as
a regexp.
+C<eval>ed strings (when accessible) are considered to be filenames:
+C<f (eval 7)> and C<f eval 7\b> access the body of the 7th C<eval>ed string
+(in the order of execution). The bodies of currently executed C<eval>
+and of C<eval>ed strings which define subroutines are saved, thus are
+accessible by this mechanism.
+
=item /pattern/
Search forwards for pattern; final / is optional.
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]