summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2010-09-23 01:38:10 -0700
committerFather Chrysostomos <sprout@cpan.org>2010-09-23 01:38:10 -0700
commit5a9a79a4cd93fcfb7398dd4e99030923446e8b08 (patch)
treedc2e12537b1b63f77e60b3f19dfbdb3a39e0b2c4 /t
parenta5763045776ca8ceaf2c78fa074b0f8a1dbe6e9e (diff)
downloadperl-5a9a79a4cd93fcfb7398dd4e99030923446e8b08.tar.gz
[perl #71806] perldb does not setup %dbline with the shebang option -d
The first time gv_fetchfile is called for a particular file, it creates the glob and, if debugging is on, creates an AV. If the glob already exists (i.e., in subsequent calls), the AV is not created. The attached patch moves the check for debugging mode and the creation of the AV outside the if-block that checks whether the glob exists. This bug seems to have existed for a very long time and has been intermittent. It seems that many different things can change the order in which #!perl -d and gv_fetchfile occur. Whether compilation options affect it I do not know. I can reproduce it in 5.6.2, 5.8.[123456] (non-threaded) and 5.11.3 (both threaded and non-threaded), but not 5.8.[789] or 5.10.[01] (threaded).
Diffstat (limited to 't')
-rw-r--r--t/run/switchd.t15
1 files changed, 14 insertions, 1 deletions
diff --git a/t/run/switchd.t b/t/run/switchd.t
index 921b966073..f937093809 100644
--- a/t/run/switchd.t
+++ b/t/run/switchd.t
@@ -9,7 +9,7 @@ BEGIN { require "./test.pl"; }
# This test depends on t/lib/Devel/switchd.pm.
-plan(tests => 2);
+plan(tests => 3);
my $r;
@@ -44,3 +44,16 @@ __SWDTEST__
like($r, qr/^sub<Devel::switchd::import>;import<Devel::switchd a 42>;DB<main,$::tempfile_regexp,9>;sub<Foo::foo>;DB<Foo,$::tempfile_regexp,5>;DB<Foo,$::tempfile_regexp,6>;DB<Foo,$::tempfile_regexp,6>;sub<Bar::bar>;DB<Bar,$::tempfile_regexp,2>;sub<Bar::bar>;DB<Bar,$::tempfile_regexp,2>;sub<Bar::bar>;DB<Bar,$::tempfile_regexp,2>;$/);
}
+# [perl #71806]
+cmp_ok(
+ runperl( # less is useful for something :-)
+ switches => [ '"-Mless ++INC->{q-Devel/_.pm-}"' ],
+ progs => [
+ '#!perl -d:_',
+ 'sub DB::DB{} print scalar @{q/_</.__FILE__}',
+ ],
+ ),
+ '>',
+ 0,
+ 'The debugger can see the lines of the main program under #!perl -d',
+);