[comp.lang.perl] BUG: Debugger loses file/lineno stepping into eval'd routines

gnb@bby.oz.au (Gregory N. Bond) (05/28/91)

I came a cross this bug while playing with Randal's chat2 package.
When using the debugger, and stepping into a subroutine defined with
eval, the debugger looses all knowledge of files and line numbers.
Witness the following script:

Script started on Tue May 28 11:28:55 1991
leo% perl -v

This is perl, version 4.0

$RCSfile: perl.c,v $$Revision: 4.0.1.1 $$Date: 91/04/11 17:49:05 $
Patch level: 3

Copyright (c) 1989, 1990, 1991, Larry Wall

Perl may be copied only under the terms of the GNU General Public License,
a copy of which can be found with the Perl 4.0 distribution kit.
leo% perl -d t.perl

Loading DB routines from perldb.pl 4.0 91/03/20

Enter h for help.

main'(t.perl:4):	$str = 'sub foo { 
(t.perl:5):		print "In Foo\n"; 
  DB<1> l 1-20
1:	#
2:	# Show the bug with the eval'd subroutine definition
3:	
4:	$str = 'sub foo { 
5:		print "In Foo\n"; 
6:	}
7:	';
8:	
9:	print "In main\n";
10:	
11:	eval $str;
12:	
13:	print "Have eval'd function foo.\n";
14:	
15:	&foo();
16:	
17:	print "Still in main.\n";
18:	
19:	print "Still in main again.\n";
  DB<2> s
main'(t.perl:9):	print "In main\n";
  DB<2> s
In main
main'(t.perl:11):	eval $str;
  DB<2> s
DB'((eval):1):	sub\foo { 
((eval):2):		print "In Foo\n"; 
  DB<2> s
DB'((eval):1):	#
  DB<2> s
Have eval'd function foo.
DB'((eval):1):	sub\foo { 
((eval):2):		print "In Foo\n"; 
  DB<2> s
DB'((eval):1):	#
  DB<2> s
In Foo
DB'((eval):1):	sub\foo { 
((eval):2):		print "In Foo\n"; 
  DB<2> s
DB'((eval):1):	#
  DB<2> s
Still in main.
DB'((eval):1):	sub\foo { 
((eval):2):		print "In Foo\n"; 
  DB<2> s
DB'((eval):1):	#
  DB<2> s
Still in main again.
leo% ^D
script done on Tue May 28 11:29:28 1991

This is on a Sun 4, SunOs 4.03 (actually a Solboure + OS/MP 4.0D) as
well as a Sun 3/80, sunOs 4.1.

Once the eval defines a subroutine, no more line numbers and file names.

On a related note, if you step past a require statement using n, it
shouldn't show any of the "global" statements inside the require'd
file.  Currently, it n is identical to s for require statments.

Greg.
--
Gregory Bond, Burdett Buckeridge & Young Ltd, Melbourne, Australia
Internet: gnb@melba.bby.oz.au    non-MX: gnb%melba.bby.oz@uunet.uu.net
Uucp: {uunet,pyramid,ubc-cs,ukc,mcvax,prlb2,nttlab...}!munnari!melba.bby.oz!gnb

lwall@jpl-devvax.jpl.nasa.gov (Larry Wall) (06/01/91)

In article <GNB.91May28113114@leo.bby.oz.au> gnb@bby.oz.au (Gregory N. Bond) writes:
: I came a cross this bug while playing with Randal's chat2 package.
: When using the debugger, and stepping into a subroutine defined with
: eval, the debugger looses all knowledge of files and line numbers.

Already fixed in patch 4, whenever I get a chance to get it out...

Larry