You have the source code. Why don't you take a look at it? Your requested feature is dang simple to add. For example (skipping the re-indenting of some lines in order to make the 'diff' smaller):
--- perl-5.10.1/lib/perl5db.pl +++ ~/lib/perl5db.pl @@ -1957,9 +1957,14 @@ for ( my $n = 0 ; $n <= $#to_watch ; $n++ ) { $evalarg = $to_watch[$n]; + my $val; + if( ref $evalarg ) { + $val = $$evalarg; + } else { local $onetimeDump; # Tell DB::eval() to not output re +sults # Fix context DB::eval() wants to return an array, but # we need a scalar here. - my ($val) = join( "', '", &eval ); + ($val) = join( "', '", &eval ); + } $val = ( ( defined $val ) ? "'$val'" : 'undef' ); @@ -5289,5 +5294,12 @@ # ... save it. - push @to_watch, $expr; + my $val; + if( $expr =~ /^\$\w+$/ ) { + $evalarg = "\\$expr"; + ( $val ) = &eval; + push @to_watch, $val; + $val = $$val; + } else { + push @to_watch, $expr; # Parameterize DB::eval and call it to get the expression's v +alue @@ -5295,5 +5307,6 @@ # return a list value. $evalarg = $expr; - my ($val) = join( ' ', &eval ); + ($val) = join( ' ', &eval ); + } $val = ( defined $val ) ? "'$val'" : 'undef';
If you ask for the list of watch expressions, the simple ones will be displayed in a rather useless manner. And you should probably weaken the reference taken as otherwise adding a watch point could prevent a destructor from firing.
On the plus side, I suspect that the new simple watch points will have less of a performance impact than the previous implementation imposed.
- tye
In reply to Re: Debugger Questions - Variable Scope (source++)
by tye
in thread Debugger Questions - Variable Scope
by GotToBTru
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |