Camelcade / Devel-Camelcadedb

Perl module for debugging with Perl5 plugin for IntelliJ
Other
23 stars 9 forks source link

Debugger displays wrong lexical and global variables #58

Open hurricup opened 3 years ago

hurricup commented 3 years ago

Because of references mess, we show @_ and lexicals/globals differently.

Reproduction example (put a breakpoint at say 1;

use strict;
use warnings FATAL => 'all';
use v5.10;

my $scalar = 'test';
say $scalar;
my $scalar_ref = \$scalar;
say $scalar_ref;
my $scalar_ref_ref = \$scalar_ref;
say $scalar_ref_ref;

my @array = ('tests');
say @array;
my $array_ref = \@array;
say $array_ref;
my $array_ref_ref = \$array_ref;
say $array_ref_ref;

my %hash = (key => 'val');
say %hash;
my $hash_ref = \%hash;
say $hash_ref;
my $hash_ref_ref = \$hash_ref;
say $hash_ref_ref;

my $glob = *STDOUT;
say STDOUT $glob;
my $glob_ref = \$glob;
say $glob_ref;
my $glob_ref_ref = \$glob_ref;
say $glob_ref_ref;

my $code = sub{}; # actually a ref
say $code;
my $code_ref = \$code;
say $code_ref;
my $code_ref_ref = \$code_ref;
say $code_ref_ref;

sub something {
    say 1;
}

something(
    $scalar, $scalar_ref, $scalar_ref_ref,
    @array, $array_ref, $array_ref_ref,
    %hash, $hash_ref, $hash_ref_ref,
    $glob, $glob_ref, $glob_ref_ref,
    $code, $code_ref, $code_ref_ref
);

Expected: same results for lexical vars and something arguments. Actually: lexical and globals has another level of reference. Because peek_my and peek_our returns names and references, not values (not possible to return value of array or hash.