Skip Menu |
Report information
Id: 1522
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: Richard [at] waveney.demon.co.uk
Cc:
AdminCc:

Operating System: riscos
PatchStatus: (no value)
Severity: medium
Type: notabug
Perl Version: (no value)
Fixed In: (no value)



Date: Tue, 21 Sep 1999 18:58:36 +0100 (BST)
From: Richard Proctor <Richard [...] waveney.demon.co.uk>
Subject: Debugger loses record of last input filehandle
To: perlbug <perlbug [...] perl.com>
Cc: Perl 5 Porters <perl5-porters [...] perl.org>
Download (untitled) / with headers
text/plain 3.1k
This is a fault when using the debugger. Using eof to test the end file of the current input, works at full speed, but not when stepping through using the debugger. It attempts to read from the terminal when it encounters the eof. It is never eof on the terminal, and the CR is then buffered for the next debugger command. I suspect the fault would affect other things that depend on the notion of "Current input filehandle". ILLUSTRATION: *type BugTest open (IN,"BugTest"); while (<IN>) { print "Lines $.\n" if eof } *perl BugTest Lines 2 *perl -d BugTest Loading DB routines from perl5db.pl version 1.0402 Emacs support available. Enter h or `h h' for help. main::(BugTest:1): open (IN,"BugTest"); DB<1> s main::(BugTest:2): while (<IN>) { print "Lines $.\n" if eof } DB<1> main::(BugTest:2): while (<IN>) { print "Lines $.\n" if eof } DB<1> main::(BugTest:2): while (<IN>) { print "Lines $.\n" if eof } DB<1> main::(BugTest:2): while (<IN>) { print "Lines $.\n" if eof } DB<1> main::(BugTest:2): while (<IN>) { print "Lines $.\n" if eof } DB<1> Debugged program terminated. Use q to quit or R to restart, use O inhibit_exit to avoid stopping after program termination, h q, h R or h O to get additional info. DB<1> q * REASON The record of the last input filehandle is overridden, when the debugger gets the next command. PROBLEM / SOLUTION The output file handle can be found and restored by using select. There appears to be no direct equivalent method for the input filehandle. However according to the perlvar if "$." is localised this has the effect of localising perls notion of "last read file handle". Therefore the solution may be adding a "local $." at an appropriate point. I can't work out where, (I tried a few places with no apparent affect) nor am I sure that this will fix the bug. Ilya? *perl -V Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration: Platform: osname=riscos, osvers=3.7, archname=arm-riscos uname='riscos bagpuss.unfortu.net 3.7 ROMPatches2.04 arc arm StrongARM,riscpc' hint=recommended, useposix=true, d_sigaction=define usethreads=undef useperlio=undef d_sfio=undef Compiler: cc='gcc', optimize='-O2', gccversion=2.7.2 cppflags='' ccflags ='-O2 -mthrowback -munixlib -IUnix: -I. -ILib:Zlib -DCONSERVATIVE -DDEBUGGING -DNICK_SIG_HACK -DREQUIRE_CAN_UNZIP' stdchar='unsigned char', d_stdstdio=undef, usevfork=true intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8 alignbytes=4, usemymalloc=n, prototype=define Linker and Libraries: ld='drlink', ldflags ='-o $@ -rescan' libpth= libs= libc=, so=no, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=ro, d_dlsymun=undef, ccdlflags='' cccdlflags='', lddlflags='' Characteristics of this binary (from libperl): Compile-time options: DEBUGGING Built under riscos Compiled at Apr 17 1999 16:32:47 @INC: /PerlPrivLib:zip /PerlArchLib: /PerlPrivLib: /PerlSiteArchLib: /PerlSiteLib: . -- Richard@waveney.demon.co.uk
Date: Tue, 21 Sep 1999 18:58:36 +0100 (BST)
From: Richard Proctor <Richard [...] waveney.demon.co.uk>
Subject: Debugger loses record of last input filehandle
To: perlbug <perlbug [...] perl.com>
Cc: Perl 5 Porters <perl5-porters [...] perl.org>
Download (untitled) / with headers
text/plain 3.1k
This is a fault when using the debugger. Using eof to test the end file of the current input, works at full speed, but not when stepping through using the debugger. It attempts to read from the terminal when it encounters the eof. It is never eof on the terminal, and the CR is then buffered for the next debugger command. I suspect the fault would affect other things that depend on the notion of "Current input filehandle". ILLUSTRATION: *type BugTest open (IN,"BugTest"); while (<IN>) { print "Lines $.\n" if eof } *perl BugTest Lines 2 *perl -d BugTest Loading DB routines from perl5db.pl version 1.0402 Emacs support available. Enter h or `h h' for help. main::(BugTest:1): open (IN,"BugTest"); DB<1> s main::(BugTest:2): while (<IN>) { print "Lines $.\n" if eof } DB<1> main::(BugTest:2): while (<IN>) { print "Lines $.\n" if eof } DB<1> main::(BugTest:2): while (<IN>) { print "Lines $.\n" if eof } DB<1> main::(BugTest:2): while (<IN>) { print "Lines $.\n" if eof } DB<1> main::(BugTest:2): while (<IN>) { print "Lines $.\n" if eof } DB<1> Debugged program terminated. Use q to quit or R to restart, use O inhibit_exit to avoid stopping after program termination, h q, h R or h O to get additional info. DB<1> q * REASON The record of the last input filehandle is overridden, when the debugger gets the next command. PROBLEM / SOLUTION The output file handle can be found and restored by using select. There appears to be no direct equivalent method for the input filehandle. However according to the perlvar if "$." is localised this has the effect of localising perls notion of "last read file handle". Therefore the solution may be adding a "local $." at an appropriate point. I can't work out where, (I tried a few places with no apparent affect) nor am I sure that this will fix the bug. Ilya? *perl -V Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration: Platform: osname=riscos, osvers=3.7, archname=arm-riscos uname='riscos bagpuss.unfortu.net 3.7 ROMPatches2.04 arc arm StrongARM,riscpc' hint=recommended, useposix=true, d_sigaction=define usethreads=undef useperlio=undef d_sfio=undef Compiler: cc='gcc', optimize='-O2', gccversion=2.7.2 cppflags='' ccflags ='-O2 -mthrowback -munixlib -IUnix: -I. -ILib:Zlib -DCONSERVATIVE -DDEBUGGING -DNICK_SIG_HACK -DREQUIRE_CAN_UNZIP' stdchar='unsigned char', d_stdstdio=undef, usevfork=true intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8 alignbytes=4, usemymalloc=n, prototype=define Linker and Libraries: ld='drlink', ldflags ='-o $@ -rescan' libpth= libs= libc=, so=no, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=ro, d_dlsymun=undef, ccdlflags='' cccdlflags='', lddlflags='' Characteristics of this binary (from libperl): Compile-time options: DEBUGGING Built under riscos Compiled at Apr 17 1999 16:32:47 @INC: /PerlPrivLib:zip /PerlArchLib: /PerlPrivLib: /PerlSiteArchLib: /PerlSiteLib: . -- Richard@waveney.demon.co.uk


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org