Description
Context
PERLDB_OPTS="white_box" PERL5DB="use DB::Hooks qw'::Terminal ::TraceVariable NonStop'" perl -d $(which morbo) -w /home/kes/work/projects/modal_window/app/public/invoice/api-v1.yaml \
-w lib/ -w templates/ -w etc/ -w ext/ /home/kes/work/projects/modal_window/app/script/invoice
Use of uninitialized value $_[1] in string ne at /home/kes/work/projects/modal_window/app/local/lib/perl5/DB/Hooks.pm line 196.
Use of uninitialized value $_[1] in string ne at /home/kes/work/projects/modal_window/app/local/lib/perl5/DB/Hooks.pm line 196.
Web application available at http://127.0.0.1:3000
^C
Dumping new frames SUB:Syntax::SourceHighlight::DESTROY
main - /home/kes/work/projects/modal_window/app/local/bin/morbo - 0 - DB::__ANON__[/home/kes/work/projects/modal_window/app/local/lib/perl5/DB/Hooks.pm:615]
main - /home/kes/work/projects/modal_window/app/local/bin/morbo - 0 - (eval)
(in cleanup) Modification of non-creatable array value attempted, subscript -1 at /home/kes/work/projects/modal_window/app/local/lib/perl5/DB/Hooks.pm line 196 during global destruction.
Dumping new frames SUB:Syntax::SourceHighlight::LangMap::DESTROY
main - /home/kes/work/projects/modal_window/app/local/bin/morbo - 0 - DB::__ANON__[/home/kes/work/projects/modal_window/app/local/lib/perl5/DB/Hooks.pm:615]
main - /home/kes/work/projects/modal_window/app/local/bin/morbo - 0 - (eval)
(in cleanup) Modification of non-creatable array value attempted, subscript -1 at /home/kes/work/projects/modal_window/app/local/lib/perl5/DB/Hooks.pm line 196 during global destruction.
Dumping new frames SUB:Syntax::SourceHighlight::DESTROY
main - /home/kes/work/projects/modal_window/app/local/bin/morbo - 0 - DB::__ANON__[/home/kes/work/projects/modal_window/app/local/lib/perl5/DB/Hooks.pm:615]
main - /home/kes/work/projects/modal_window/app/local/bin/morbo - 0 - (eval)
(in cleanup) Modification of non-creatable array value attempted, subscript -1 at /home/kes/work/projects/modal_window/app/local/lib/perl5/DB/Hooks.pm line 196 during global destruction.
Dumping new frames SUB:Syntax::SourceHighlight::LangMap::DESTROY
main - /home/kes/work/projects/modal_window/app/local/bin/morbo - 0 - DB::__ANON__[/home/kes/work/projects/modal_window/app/local/lib/perl5/DB/Hooks.pm:615]
main - /home/kes/work/projects/modal_window/app/local/bin/morbo - 0 - (eval)
(in cleanup) Modification of non-creatable array value attempted, subscript -1 at /home/kes/work/projects/modal_window/app/local/lib/perl5/DB/Hooks.pm line 196 during global destruction.
DB/Hooks.pm
...
sub sub {
DB::state( 'ddd' ); <<< here is line 615
...
sub dbstate {
my( $name, $value ) = @;
return @>1 ? $DB::state[-1]{ ddd } = $value : $DB::state[-1]{ ddd } // 0
if $name eq 'ddd';
Description
I am using Syntax::SourceHighlight
to highlight code at my debugger. This module is loaded from my debugger like this:
package DB::Commands;
...
my $hl; << I expect to see these package lines when `caller` dumps frames when `DESTROY` sub is called
my $lm; <<
sub highlighting {
require Syntax::SourceHighlight;
$hl = Syntax::SourceHighlight->new('esc.outlang');
$lm = Syntax::SourceHighlight::LangMap->new();
$hl->setStyleFile('esc256.style');
return 1;
}
my $highlight = $is_exists && !$ENV{ DEBUGGER_NO_COLOR } ? highlighting() : 0;
I do not see DESTROY
subs at Syntax::SourceHighlight
or Syntax::SourceHighlight::LangMap
files.
Because these modules are loaded before debugger they are destroyed later, after debugger. Stack looks like this:
Syntax::* are loaded
debugger is loaded
... body of a debugged script
debugger is destroyed << error happened somewhere here, I assume.
Syntax::* are destroyed
During destruction at DB::state
sub when I perl tries to run $DB::state[-1]
code, the @DB::state
array does not exists already (or empty?). And error is occurred.
I dumped from DB::state
frames to check from which part of code this call was done
my $lvl;
my $count //= -1; # infinite
my @frames;
local $" = ' - ';
while( $count-- && (my @frame = caller( ++$lvl )) ) {
push @frames, [ @frame[0..3] ];
}
print $DB::OUT "\n\nDumping new frames SUB:$_[2] \n";
print $DB::OUT "@$_\n" for @frames;
I found this line:
main - /home/kes/work/projects/modal_window/app/local/bin/morbo - 0 - (eval)
We see this, because perl adds debuger loading into the source of the debugged script as use DB::Hooks....
as line 0.
It looks like it makes sense, because everything should be destroyed when program is finished, but
$hm
and $lm
are not located at the main script, but these variables actually are located at DB::Commands
module. So I expect to see path to DB::Commands
package and line where $hm
, $lm
were defined.
Steps to Reproduce
None. You do not have sources for this debugger. By I tried to describe in details what is going on here.
Expected behavior
When DESTROY
is called caller
should dump package:line from where these objects were destroyed, or, as another solution, where they were created: $hl = ->new()
and $lm =
->new()` lines.
Perl configuration
Summary of my perl5 (revision 5 version 41 subversion 2) configuration:
Platform:
osname=linux
osvers=6.5.0-1027-oem
archname=x86_64-linux
uname='linux work 6.5.0-1027-oem #28-ubuntu smp preempt_dynamic thu jul 25 13:32:46 utc 2024 x86_64 x86_64 x86_64 gnulinux '
config_args='-de -Dprefix=/home/kes/perl5/perlbrew/perls/perl-5.41.2 -Dusedevel -Aeval:scriptdir=/home/kes/perl5/perlbrew/perls/perl-5.41.2/bin'
hint=recommended
useposix=true
d_sigaction=define
useithreads=undef
usemultiplicity=undef
use64bitint=define
use64bitall=define
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
Compiler:
cc='cc'
ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
optimize='-O2'
cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
ccversion=''
gccversion='13.1.0'
gccosandvers=''
intsize=4
longsize=8
ptrsize=8
doublesize=8
byteorder=12345678
doublekind=3
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=16
longdblkind=3
ivtype='long'
ivsize=8
nvtype='double'
nvsize=8
Off_t='off_t'
lseeksize=8
alignbytes=8
prototype=define
Linker and Libraries:
ld='cc'
ldflags =' -fstack-protector-strong -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib/x86_64-linux-gnu /usr/lib /usr/lib64
libs=-lpthread -ldl -lm -lcrypt -lutil -lc
perllibs=-lpthread -ldl -lm -lcrypt -lutil -lc
libc=/lib/x86_64-linux-gnu/libc.so.6
so=so
useshrplib=false
libperl=libperl.a
gnulibc_version='2.35'
Dynamic Linking:
dlsrc=dl_dlopen.xs
dlext=so
d_dlsymun=undef
ccdlflags='-Wl,-E'
cccdlflags='-fPIC'
lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'
Characteristics of this binary (from libperl):
Compile-time options:
HAS_LONG_DOUBLE
HAS_STRTOLD
HAS_TIMES
PERLIO_LAYERS
PERL_COPY_ON_WRITE
PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_SIPHASH13
PERL_HASH_USE_SBOX32
PERL_MALLOC_WRAP
PERL_OP_PARENT
PERL_PRESERVE_IVUV
PERL_USE_DEVEL
PERL_USE_SAFE_PUTENV
USE_64_BIT_ALL
USE_64_BIT_INT
USE_LARGE_FILES
USE_LOCALE
USE_LOCALE_COLLATE
USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC
USE_LOCALE_TIME
USE_PERLIO
USE_PERL_ATOF
Built under linux
Compiled at Aug 17 2024 19:35:18
%ENV:
PERLBREW="command perlbrew"
PERLBREW_HOME="/home/kes/.perlbrew"
PERLBREW_MANPATH="/home/kes/perl5/perlbrew/perls/perl-5.41.2/man"
PERLBREW_PATH="/home/kes/perl5/perlbrew/bin:/home/kes/perl5/perlbrew/perls/perl-5.41.2/bin"
PERLBREW_PERL="perl-5.41.2"
PERLBREW_ROOT="/home/kes/perl5/perlbrew"
PERLBREW_SHELLRC_VERSION="0.98"
PERLBREW_VERSION="0.98"
@INC:
/home/kes/perl5/perlbrew/perls/perl-5.41.2/lib/site_perl/5.41.2/x86_64-linux
/home/kes/perl5/perlbrew/perls/perl-5.41.2/lib/site_perl/5.41.2
/home/kes/perl5/perlbrew/perls/perl-5.41.2/lib/5.41.2/x86_64-linux
/home/kes/perl5/perlbrew/perls/perl-5.41.2/lib/5.41.2