diff options
-rw-r--r-- | lib/perl5db.pl | 66 |
1 files changed, 35 insertions, 31 deletions
diff --git a/lib/perl5db.pl b/lib/perl5db.pl index d32e1cbf4a..7bf7177d62 100644 --- a/lib/perl5db.pl +++ b/lib/perl5db.pl @@ -6463,45 +6463,49 @@ stack frame. Each has the following keys and values: =cut -sub _dump_trace_calc_save_args { - my ($nothard) = @_; +sub _dump_trace_calc_saved_single_arg +{ + my ($nothard, $arg) = @_; - my @a; - for my $arg (@args) { - my $type; - if ( not defined $arg ) { # undefined parameter - push @a, "undef"; - } + my $type; + if ( not defined $arg ) { # undefined parameter + return "undef"; + } - elsif ( $nothard and tied $arg ) { # tied parameter - push @a, "tied"; - } - elsif ( $nothard and $type = ref $arg ) { # reference - push @a, "ref($type)"; - } - else { # can be stringified - local $_ = - "$arg"; # Safe to stringify now - should not call f(). + elsif ( $nothard and tied $arg ) { # tied parameter + return "tied"; + } + elsif ( $nothard and $type = ref $arg ) { # reference + return "ref($type)"; + } + else { # can be stringified + local $_ = + "$arg"; # Safe to stringify now - should not call f(). - # Backslash any single-quotes or backslashes. - s/([\'\\])/\\$1/g; + # Backslash any single-quotes or backslashes. + s/([\'\\])/\\$1/g; - # Single-quote it unless it's a number or a colon-separated - # name. - s/(.*)/'$1'/s - unless /^(?: -?[\d.]+ | \*[\w:]* )$/x; + # Single-quote it unless it's a number or a colon-separated + # name. + s/(.*)/'$1'/s + unless /^(?: -?[\d.]+ | \*[\w:]* )$/x; - # Turn high-bit characters into meta-whatever. - s/([\200-\377])/sprintf("M-%c",ord($1)&0177)/eg; + # Turn high-bit characters into meta-whatever. + s/([\200-\377])/sprintf("M-%c",ord($1)&0177)/eg; - # Turn control characters into ^-whatever. - s/([\0-\37\177])/sprintf("^%c",ord($1)^64)/eg; + # Turn control characters into ^-whatever. + s/([\0-\37\177])/sprintf("^%c",ord($1)^64)/eg; - push( @a, $_ ); - } ## end else [ if (not defined $arg) - } ## end for $arg (@args) + return $_; + } +} + +sub _dump_trace_calc_save_args { + my ($nothard) = @_; - return \@a; + return [ + map { _dump_trace_calc_saved_single_arg($nothard, $_) } @args + ]; } sub dump_trace { |