Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!munnari.oz.au!mel.dit.csiro.au!yarra!melba.bby.oz.au!gnb From: gnb@bby.oz.au (Gregory N. Bond) Newsgroups: comp.lang.perl Subject: BUG: Debugger loses file/lineno stepping into eval'd routines Message-ID: Date: 28 May 91 01:31:14 GMT Sender: usenet@melba.bby.oz.au (news READER id) Organization: Burdett, Buckeridge and Young Ltd. Lines: 92 Nntp-Posting-Host: leo-gw 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