develooper Front page | perl.perl5.porters | Postings from July 2000

[ID 20000725.005] Debugger thinks closure variable isn't there

From:
Peter Scott
Date:
July 25, 2000 18:44
Subject:
[ID 20000725.005] Debugger thinks closure variable isn't there
Message ID:
4.3.2.7.2.20000725183527.00af3ea0@psdt.com
I strongly suspect a bug around here, but exactly where I dunno.

Step through this in the debugger:

#!/usr/bin/perl -wd

{
   my $x = 'yyy';

   sub foo {
     print "\$x quite okay here\n";
     if (1) {
       print "\$x = $x\n";
     }
   }
}
foo();


main::(./foo:4):    my $x = 'yyy';
   DB<1> c foo
main::foo(./foo:7):     print "\$x quite okay here\n";
   DB<2> p $x
yyy
   DB<3> n
$x quite okay here
main::foo(./foo:8):     if (1) {
   DB<3> p $x
Use of uninitialized value in print at (eval 
18)[/usr/lib/perl5/5.6.0/perl5db.pl:1510] line 2.
# *** Say what??? ***
   DB<4> n
main::foo(./foo:9):       print "\$x = $x\n";
   DB<4> p $x
yyy


Also happens in 5.005_03.


Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
   Platform:
     osname=linux, osvers=2.2.14-5.0, archname=i586-linux
     uname='linux psdt.com 2.2.14-5.0 #1 tue mar 7 20:53:41 est 2000 i586 
unknown '
     config_args=''
     hint=recommended, useposix=true, d_sigaction=define
     usethreads=undef use5005threads=undef useithreads=undef 
usemultiplicity=undef
     useperlio=undef d_sfio=undef uselargefiles=define
     use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
   Compiler:
     cc='cc', optimize='-g', gccversion=egcs-2.91.66 19990314/Linux 
(egcs-1.1.2 release)
     cppflags='-DDEBUGGING -fno-strict-aliasing'
     ccflags ='-DDEBUGGING -fno-strict-aliasing -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64'
     stdchar='char', d_stdstdio=define, usevfork=false
     intsize=4, longsize=4, ptrsize=4, doublesize=8
     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
     ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', 
lseeksize=8
     alignbytes=4, usemymalloc=n, prototype=define
   Linker and Libraries:
     ld='cc', ldflags =' -L/usr/local/lib'
     libpth=/usr/local/lib /lib /usr/lib
     libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
     libc=/lib/libc-2.1.3.so, so=so, useshrplib=false, libperl=libperl.a
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
     cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
   Compile-time options: DEBUGGING USE_LARGE_FILES
   Built under linux
   Compiled at May  3 2000 12:54:39
   @INC:
     /usr/lib/perl5/5.6.0/i586-linux
     /usr/lib/perl5/5.6.0
     /usr/lib/perl5/site_perl/5.6.0/i586-linux
     /usr/lib/perl5/site_perl/5.6.0
     /usr/lib/perl5/site_perl/5.005
     /usr/lib/perl5/site_perl
     .




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About