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

[ID 20000320.002] Heisenbugs with exists[] and the debugger

From:
Matthias Urlichs
Date:
March 20, 2000 06:05
Subject:
[ID 20000320.002] Heisenbugs with exists[] and the debugger
Message ID:
38D62FF1.24694.qmail@play.smurf.noris.de
This is a bug report for perl from smurf@noris.net,
generated with the help of perlbug 1.26 running under perl 5.006.


-----------------------------------------------------------------
[Please enter your report here]

*Sigh* I hate Heisenbugs. Or in this case, reverse heisenbugs
which _appear_ when you look at them.

> require 'dumpvar.pl'; # used by perl5db.pl
> $foo[1]="whatever";
> dumpValue(\@foo);
> die if exists $foo[0];

$foo[0] springs into existence because it's passed
to various subroutines, which proceed to ask "ref \$[0]"
(among other nefarious things).

Index: dev.60/lib/dumpvar.pl
--- dev.60/lib/dumpvar.pl Sun, 19 Mar 2000 12:14:48 +0100 smurf (gnu_perl/e/32_dumpvar.pl 1.7.1.5 444)
+++ exp.14(w)/lib/dumpvar.pl Mon, 20 Mar 2000 15:01:52 +0100 smurf (gnu_perl/e/32_dumpvar.pl 1.7.1.5 444)
@@ -195,8 +195,9 @@
 	  if ($#$v >= 0) {
 	    $short = $sp . "0..$#{$v}  " . 
 	      join(" ", 
-		   map {stringify $_} @{$v}[0..$tArrayDepth])
-		. "$shortmore";
+		   #map {stringify $_} @{$v}[0..$tArrayDepth]
+		   map {exists $v->[$_] ? stringify $v->[$_] : "empty"} ($[..$tArrayDepth)
+		) . "$shortmore";
 	  } else {
 	    $short = $sp . "empty array";
 	  }
@@ -209,7 +210,11 @@
 	for $num ($[ .. $tArrayDepth) {
 	    return if $DB::signal;
 	    print "$sp$num  ";
-	    DumpElem $v->[$num], $s;
+	    if (exists $v->[$num]) {
+	        DumpElem $v->[$num], $s;
+	    } else {
+	    	print "empty slot\n";
+	    }
 	}
 	print "$sp  empty array\n" unless @$v;
 	print "$sp$more" if defined $more ;  

[Please do not change anything below this line]
-----------------------------------------------------------------

---
This perlbug was built using Perl 5.00503 - Mon Aug 30 23:08:56 EDT 1999
It is being executed now by  Perl 5.006 - Mon Mar 20 13:56:34 CET 2000.

Site configuration information for perl 5.006:

Configured by smurf at Mon Mar 20 13:56:34 CET 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.3.99s-noris-pre2, archname=i686-linux-thread-multi-64all
    uname='linux play.smurf.noris.de 2.3.99s-noris-pre2 #39 smp sat mar 18 20:29:32 cet 2000 i686 unknown '
    config_args='-Uusenm -Duseshrplib=true -Dman1dir=/usr/man/man1 -Dman3dir=/usr/man/man3 -Dstartperl=#!/usr/bin/perl -Dprefix=/usr/lib/perl -d -e -Dcf_email=smurf@noris.net -Dman1ext=1p -Dman3ext=3p -Dusemultiplicity -Dusethreads -Duseithreads -Duse64bitall -Duselargefiles -Dd_dosuid -Duselongdouble'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=define use64bitall=define uselongdouble=define usesocks=undef
  Compiler:
    cc='cc', optimize='-O2 -g', gccversion=2.95.2 19991024 (release)
    cppflags='-D_REENTRANT -fno-strict-aliasing'
    ccflags ='-D_REENTRANT -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 long', ivsize=8, nvtype='long double', nvsize=12, 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 -lpthread -lc -lposix -lcrypt
    libc=/lib/libc-2.1.2.so, so=so, useshrplib=true, libperl=libperl.so
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl/lib/5.6.0/i686-linux-thread-multi-64all/CORE'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl 5.006:
    /usr/lib/perl/lib/5.6.0/i686-linux-thread-multi-64all
    /usr/lib/perl/lib/5.6.0
    /usr/lib/perl/lib/site_perl/5.6.0/i686-linux-thread-multi-64all
    /usr/lib/perl/lib/site_perl/5.6.0
    /usr/lib/perl/lib/site_perl/5.005
    /usr/lib/perl/lib/site_perl
    .

---
Environment for perl 5.006:
    HOME=/smurf/home
    LANG=en_US
    LANGUAGE (unset)
    LC_ALL=en_US
    LC_CTYPE=C
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/pop/bin:/pop/bin:/usr/src/STATUS/bin:/smurf/home/bin:/usr/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/X11R6/bin:/usr/X11R6/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash



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