Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$&, @+, @- not handled "correctly" in debugger command line #6635

Open
p5pRT opened this issue Jul 17, 2003 · 3 comments
Open

$&, @+, @- not handled "correctly" in debugger command line #6635

p5pRT opened this issue Jul 17, 2003 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Jul 17, 2003

Migrated from rt.perl.org#23016 (status was 'stalled')

Searchable as RT23016$

@p5pRT
Copy link
Author

p5pRT commented Jul 17, 2003

From david.dyck@fluke.com

Created by david.dyck@fluke.com

Given the interactive debugger invoked by

$ perl -d -e 42
  > $_=qw(abc);s/b//;print $&
will print "b" as expected but
if the x command doesn't display it, e.g.
  > x $&
0 undef

but if the same code is part of the evaluated program
as in

$ perl -lde '$_=qw(abc);s/b//;print $& ; 42'

main​::(-e​:1)​: $_=qw(abc);s/b//;print $& ; 42
  DB<1> n
main​::(-e​:1)​: $_=qw(abc);s/b//;print $&amp; ; 42
  DB<1> n
main​::(-e​:1)​: $_=qw(abc);s/b//;print $&amp; ; 42
  DB<1> n
b
main​::(-e​:1)​: $_=qw(abc);s/b//;print $&amp; ; 42
  DB<1> x $&
0 'b'

then $& can be examined from the debugger command line.

If I modify $& from the debugger command line like
  DB<2> $_=qw(def);s/e//; print $&amp;
e

so now $&amp; eq "e", when I try to display $&amp; I still get

  DB<3> x $&
0 'b'

even tho $_ is set to 'df'

  DB<4> x $_
0 'df'

It is confusing to say the least to see some variables
being restored from the command line evaluation, and other
not.

Perl Info

Flags:
    category=core
    severity=low

Site configuration information for perl v5.9.0:

Configured by dcd at Fri Jul 11 16:39:38 PDT 2003.

Summary of my perl5 (revision 5.0 version 9 subversion 0 patch 20156) configuration:
  Platform:
    osname=linux, osvers=2.4.22-pre5, archname=i686-linux
    uname='linux dd 2.4.22-pre5 #1 fri jul 11 15:45:10 pdt 2003 i686 '
    config_args='-Dmksymlinks -Dinstallusrbinperl -Uversiononly -Dusedevel -Doptimize=-O3 -g -de -Dcf_email=david.dyck@fluke.com'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O3 -g',
    cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='egcs-2.91.66.1 19990314/Linux (egcs-1.1.2 release)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lgdbm -ldbm -ldb -ldl -lm -lc
    perllibs=-ldl -lm -lc
    libc=/lib/libc.so.5.4.44, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    DEVEL18374


@INC for perl v5.9.0:
    /usr/local/lib/perl5/5.9.0/i686-linux
    /usr/local/lib/perl5/5.9.0
    /usr/local/lib/perl5/site_perl/5.9.0/i686-linux
    /usr/local/lib/perl5/site_perl/5.9.0
    /usr/local/lib/perl5/site_perl/5.8.0/i686-linux
    /usr/local/lib/perl5/site_perl/5.8.0
    /usr/local/lib/perl5/site_perl
    .


Environment for perl v5.9.0:
    HOME=/home/dcd
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/dcd/bin:/sbin:/usr/local/bin:/bin:/usr/bin:/usr/X11/bin:/usr/games:/usr/local/samba:/home/hobbes/tools/scripts:/home/hobbes/tools/linux:/usr0/hobbes/tools/scripts:/usr0/dcd/bin:/apps/general/bin:/usr/public
    PERL5_CPANPLUS_CONFIG=/home/dcd/.cpanplus/config
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Jul 17, 2003

From @tamias

On Thu, Jul 17, 2003 at 12​:58​:06AM -0000, David Dyck wrote​:

$ perl -d -e 42

$_=qw(abc);s/b//;print $&amp;
will print "b" as expected but
if the x command doesn't display it, e.g.
x $&
0 undef

This happens because the special regex variables are always locally scoped
to the enclosing block. It would be nice if this worked as expected in the
debugger, though.

Ronald

@p5pRT
Copy link
Author

p5pRT commented Apr 12, 2010

@chorny - Status changed from 'open' to 'stalled'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants