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

%{"_<..."} acts on @DB::dbline #13259

Closed
p5pRT opened this issue Sep 15, 2013 · 8 comments
Closed

%{"_<..."} acts on @DB::dbline #13259

p5pRT opened this issue Sep 15, 2013 · 8 comments

Comments

@p5pRT
Copy link

p5pRT commented Sep 15, 2013

Migrated from rt.perl.org#119799 (status was 'resolved')

Searchable as RT119799$

@p5pRT
Copy link
Author

p5pRT commented Sep 15, 2013

From @cpansprout

perldebguts says​:

  o Each hash "%{"_<$filename"}" contains breakpoints and actions keyed
  by line number. Individual entries (as opposed to the whole hash)
  are settable.

This implies that breakpoints set on %{"_<..."} apply to the named file. That is not actually true, as every %{"_<..."} hash sets breakpoints on lines in @​DB​::dbline, regardless of which file it refers to. The assumption is that debuggers will alias *DB​::dbline to *{"_<..."} before setting any breakpoints.

Hence, all %{"_<..."} hashes are the same.

Is this a case where the documentation should be expanded to match the implementation? Or should we change the implementation to make each %{"_<..."} hash work on its corresponding @​{"_<..."} array? The latter seems more useful to me.

Demonstration​:

Run this with the -d switch and with PERL5DB set to 1​:

#!perl
sub DB​::DB { $DB​::single = 0, return if $DB​::single; print "ok\n"; exit }
${"_<".__FILE__}{5}=1; # set a breakpoint
sub foo {
  die; # line 5
}
foo();

$ PERL5DB=1 ./perl -Ilib -d foo
Died at foo line 5.

If I change the script to alias @​DB​::dbline to @​{"_<".__FILE__} first, it works​:

#!perl
sub DB​::DB { $DB​::single = 0, return if $DB​::single; print "ok\n"; exit }
*DB​::dbline = \@​{"_<".__FILE__}; ${"_<".__FILE__}{5}=1; # set a breakpoint
sub foo {
  die; # line 5
}
foo();

$ PERL5DB=1 ./perl -Ilib -d foo
ok


Flags​:
  category=core
  severity=low


Site configuration information for perl 5.19.4​:

Configured by sprout at Sun Sep 8 12​:35​:32 PDT 2013.

Summary of my perl5 (revision 5 version 19 subversion 4) configuration​:
  Local Commit​: 8bdbe21
  Ancestor​: 343e716
  Platform​:
  osname=darwin, osvers=12.2.0, archname=darwin-thread-multi-2level
  uname='darwin pint.local 12.2.0 darwin kernel version 12.2.0​: sat aug 25 00​:48​:52 pdt 2012; root​:xnu-2050.18.24~1release_x86_64 x86_64 '
  config_args='-de -Accflags=-DPERL_NO_COW -Dmad -Aoptimize=-O0 -DDEBUGGING -Duseithreads -Dusedevel -Dcc=g++ -Duse64bitint'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=define, usemultiplicity=define
  useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
  use64bitint=define, use64bitall=define, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='g++', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -DPERL_NO_COW -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include',
  optimize='-O3 -O0 -g',
  cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -DPERL_NO_COW -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
  ccversion='', gccversion='4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)', gccosandvers=''
  intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -fstack-protector -L/usr/local/lib'
  libpth=/usr/local/lib /usr/lib
  libs=-ldbm -ldl -lm -lutil -lc
  perllibs=-ldl -lm -lutil -lc
  libc=, so=dylib, useshrplib=false, libperl=libperl.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
  cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector'

Locally applied patches​:
  1261f9a
  c2ee494
  21c314c
  7a7c28d
  0d72ebc
  8bdbe21


@​INC for perl 5.19.4​:
  lib
  /usr/local/lib/perl5/site_perl/5.19.4/darwin-thread-multi-2level
  /usr/local/lib/perl5/site_perl/5.19.4
  /usr/local/lib/perl5/5.19.4/darwin-thread-multi-2level
  /usr/local/lib/perl5/5.19.4
  /usr/local/lib/perl5/site_perl
  .


Environment for perl 5.19.4​:
  DYLD_LIBRARY_PATH (unset)
  HOME=/Users/sprout
  LANG=en_US.UTF-8
  LANGUAGE (unset)
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/usr/bin​:/bin​:/usr/sbin​:/sbin​:/usr/local/bin​:/usr/local/bin
  PERL_BADLANG (unset)
  SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Sep 16, 2013

From @rjbs

* Father Chrysostomos <perlbug-followup@​perl.org> [2013-09-15T15​:01​:58]

Hence, all %{"_<..."} hashes are the same.

Is this a case where the documentation should be expanded to match the
implementation? Or should we change the implementation to make each
%{"_<..."} hash work on its corresponding @​{"_<..."} array? The latter seems
more useful to me.

I agree​: the latter seems more useful.

--
rjbs

@p5pRT
Copy link
Author

p5pRT commented Sep 16, 2013

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Sep 23, 2013

From @nwc10

On Mon, Sep 16, 2013 at 06​:25​:56PM -0400, Ricardo Signes wrote​:

* Father Chrysostomos <perlbug-followup@​perl.org> [2013-09-15T15​:01​:58]

Hence, all %{"_<..."} hashes are the same.

Is this a case where the documentation should be expanded to match the
implementation? Or should we change the implementation to make each
%{"_<..."} hash work on its corresponding @​{"_<..."} array? The latter seems
more useful to me.

I agree​: the latter seems more useful.

I really don't have much of an opinion of this.

The latter seems more useful. It seems somewhat wasteful that there is a
need to keep (re)aliasing *DB​::dbline just to set breakpoints on a different
file.

There are so few debuggers on CPAN that I suspect that there's almost no
debugger-like code elsewhere, so if there is any breakage, it will be
minimal and manageable.

Nicholas Clark

@p5pRT
Copy link
Author

p5pRT commented Oct 29, 2013

From @cpansprout

On Mon Sep 16 15​:26​:35 2013, perl.p5p@​rjbs.manxome.org wrote​:

* Father Chrysostomos <perlbug-followup@​perl.org> [2013-09-
15T15​:01​:58]

Hence, all %{"_<..."} hashes are the same.

Is this a case where the documentation should be expanded to match
the
implementation? Or should we change the implementation to make each
%{"_<..."} hash work on its corresponding @​{"_<..."} array? The
latter seems
more useful to me.

I agree​: the latter seems more useful.

I have changed it in commit 43e4250.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Oct 29, 2013

From [Unknown Contact. See original ticket]

On Mon Sep 16 15​:26​:35 2013, perl.p5p@​rjbs.manxome.org wrote​:

* Father Chrysostomos <perlbug-followup@​perl.org> [2013-09-
15T15​:01​:58]

Hence, all %{"_<..."} hashes are the same.

Is this a case where the documentation should be expanded to match
the
implementation? Or should we change the implementation to make each
%{"_<..."} hash work on its corresponding @​{"_<..."} array? The
latter seems
more useful to me.

I agree​: the latter seems more useful.

I have changed it in commit 43e4250.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Oct 29, 2013

@cpansprout - Status changed from 'open' to 'resolved'

@p5pRT p5pRT closed this as completed Oct 29, 2013
@p5pRT
Copy link
Author

p5pRT commented Jun 21, 2017

From @KES777

Hi. After this commit it seems this section in DOC is meaningless. https://perldoc.perl.org/perldebguts.html#Debugger-Internal-Variables

Anybody can use %{ _< ... } directly

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

1 participant