Invisible variables in Perl debugger II

V

vnick

Hi,

following my posting (Invisible variables in Perl debugger)
started on 3. Feb. 2005 I have now a runable
version of the problem that some vars are invisible in the Perl
debugger:
(I ran Perl with setenv PERLDB_OPTS NonStop)

---------------------------------------------------debug_visibility_problem_1.pl:

#!/usr/local/bin/perl -w

$DB::single = 1;
my $abc = 7;
$efg = 6;
print "$abc + 1 = $efg\n";

require "debug_visibility_problem_2.pl" ;

exit 0;
---------------------------------------------------
debug_visibility_problem_2.pl:

#!/usr/local/bin/perl -w

$DB::single = 1;
my $a = 8;
$debug = 1;

print "Local: $a Global: $debug\n";

1;

---------------------------------------------------

If I run debug_visibility_problem_1.pl in the debugger I see this:

DB<20> l
4==> my $abc = 7;
5: $efg = 6;
6: print "$abc + 1 = $efg\n";
7
8: require "debug_visibility_problem_2.pl" ;
9
10: exit 0;
11
DB<20> s
main::(debug_visibility_problem_1.pl:5):
5: $efg = 6;
DB<20> s
main::(debug_visibility_problem_1.pl:6):
6: print "$abc + 1 = $efg\n";
DB<20> p $abc
7
DB<21> s
7 + 1 = 6
main::(debug_visibility_problem_1.pl:8):
8: require "debug_visibility_problem_2.pl" ;
DB<21> s
main::(debug_visibility_problem_2.pl:3):
3: $DB::single = 1;
DB<21> l
3==> $DB::single = 1;
4: my $a = 8;
5: $debug = 1;
6
7: print "Local: $a Global: $debug\n";
8
9: 1;
DB<21> s
main::(debug_visibility_problem_2.pl:4):
4: my $a = 8;
DB<21> s
main::(debug_visibility_problem_2.pl:5):
5: $debug = 1;
DB<21> p $a
Use of uninitialized value in print at (eval 25)
<<<<<<<[/cadappl/perl/5.6.1/lib/5.6.1/perl5db.pl:1521] line 2.

DB<22> s
main::(debug_visibility_problem_2.pl:7):
7: print "Local: $a Global: $debug\n";
DB<22> p $debug
1
---------------------------------------------------

I can not see the lexical var(s) ($a) whereas I can see the global
one(s) ($debug) in the second script included with the require command.

Am I missing a major point here or can I regard this as a debugger
"feature"(bug?).

Thanks
Volker
 
P

Peter Scott

I have now a runable
version of the problem that some vars are invisible in the Perl
debugger:
(I ran Perl with setenv PERLDB_OPTS NonStop)

---------------------------------------------------debug_visibility_problem_1.pl:

#!/usr/local/bin/perl -w

$DB::single = 1;
my $abc = 7;
$efg = 6;
print "$abc + 1 = $efg\n";

require "debug_visibility_problem_2.pl" ;

exit 0;
---------------------------------------------------
debug_visibility_problem_2.pl:

#!/usr/local/bin/perl -w

$DB::single = 1;
my $a = 8;
$debug = 1;

print "Local: $a Global: $debug\n";

1;
[snip]
main::(debug_visibility_problem_2.pl:4):
4: my $a = 8;
DB<21> s
main::(debug_visibility_problem_2.pl:5):
5: $debug = 1;
DB<21> p $a
Use of uninitialized value in print at (eval 25)
<<<<<<<[/cadappl/perl/5.6.1/lib/5.6.1/perl5db.pl:1521] line 2.
I can not see the lexical var(s) ($a) whereas I can see the global
one(s) ($debug) in the second script included with the require command.

Am I missing a major point here or can I regard this as a debugger
"feature"(bug?).

It looks like a bug except I cannot reproduce it on my perl 5.8.5. What
version are you on?
 
P

Peter Scott

This is perl, v5.8.5 built for i686-linux-thread-multi [snip]
DB<1> p $a
Use of uninitialized value in print at (eval
5)[/usr/lib/perl5/5.8.0/perl5db.pl:17] line 2.

Firstly, this is a bug. I was able to reproduce it in perl 5.8.0 on OS X
and Linux. I have not checked to see if it was reported.

Secondly, I was unable to reproduce it in perl 5.8.5. The perl5db.pl has
changed so much between the two versions I felt disinclined to hunt for
what might have fixed this problem or to look in change logs; you can do
that if you like.

Note that while you are running a 5.8.5 perl, you are referencing a 5.8.0
perl5db.pl. Fix @INC or otherwise do what you need to get at the
perl5db.pl that comes with 5.8.5.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top