Revision: 850
Author: tim.bunce
Date: Wed Aug  5 15:57:22 2009
Log: Add gotobug directory containing a test case for a significant problem  
affecting perl <5.8.8.
** I'd welcome any help I can get with this **

http://code.google.com/p/perl-devel-nytprof/source/detail?r=850

Added:
  /trunk/gotobug
  /trunk/gotobug/A.pm
  /trunk/gotobug/Devel
  /trunk/gotobug/Devel/stub.pm
  /trunk/gotobug/E.pm
  /trunk/gotobug/README
  /trunk/gotobug/trial

=======================================
--- /dev/null
+++ /trunk/gotobug/A.pm Wed Aug  5 15:57:22 2009
@@ -0,0 +1,2 @@
+require E;
+E::export_tags();
=======================================
--- /dev/null
+++ /trunk/gotobug/Devel/stub.pm        Wed Aug  5 15:57:22 2009
@@ -0,0 +1,3 @@
+package Devel::debug;
+sub DB::DB {}
+1;
=======================================
--- /dev/null
+++ /trunk/gotobug/E.pm Wed Aug  5 15:57:22 2009
@@ -0,0 +1,13 @@
+package E;
+
+sub as_heavy {
+  my $c = (caller(1))[3];
+  if ($c =~ /eval/) { require Carp; Carp::confess($c); }
+  exit 0;
+}
+
+sub export_tags {
+  as_heavy();
+}
+
+1;
=======================================
--- /dev/null
+++ /trunk/gotobug/README       Wed Aug  5 15:57:22 2009
@@ -0,0 +1,33 @@
+For some versions of perl 5.8.x NYTProf has a problem.
+
+When profiling some code, like "perldoc", the Exporter croaks with
+an error:
+
+$ perl -d:NYTProf -S perldoc perldoc
+Goto undefined subroutine &Exporter::Heavy::heavy_(eval) at  
/usr/local/perl58-i/lib/5.8.6/Exporter.pm line 85.
+Compilation failed in require at  
/usr/local/perl58-i/lib/5.8.6/Pod/Perldoc.pm line 1475.
+
+It seems that caller() returns "(eval)" when it normally wouldn't.
+
+I have seen this before in relation to the Readonly and NEXT modules.
+
+http://search.cpan.org/~timb/Devel-NYTProf-2.10/lib/Devel/NYTProf.pm#For_perl_%3C_5.8.8_it_may_change_what_caller()_returns
+Says:
+
+    For perl < 5.8.8 it may change what caller() returns
+
+    For example, the Readonly module croaks with "Invalid tie" when  
profiled
+    with perl versions before 5.8.8. That's because Readonly explicitly  
checking
+    for certain values from caller(). The NEXT module is also affected.
+
+but I hadn't seen it affect Exporter.
+
+NYTProf triggers the problem, and running perl -d:stub, where Devel::stub  
just
+contains "sub DB::DB { }" also triggers the problem.
+
+What's really puzzling me is that the normal perl debugger doesn't!
+So it seems like there's some way to work around it, but I don't know what  
it is.
+
+This directory contains a test case to reproduce the problem.
+
+Any investigation would be most welcome!
=======================================
--- /dev/null
+++ /trunk/gotobug/trial        Wed Aug  5 15:57:22 2009
@@ -0,0 +1,26 @@
+#!/bin/sh -v
+
+perl="perl -I ."
+do="require A;"
+
+export PERL5LIB=".:$PERL5LIB"
+$perl -v | grep 'This is perl'
+
+# these should pass
+
+: standard perl
+$perl            -e "$do" || { echo "probe failed unexpectedly!"; exit 1; }
+
+: perl with debugger in NonStop mode
+export PERLDB_OPTS="NonStop"
+$perl -d         -e "$do" || { echo "probe failed unexpectedly!"; exit 1; }
+
+# these currently fail with perl 5.8.6
+
+: perl with stub debugger
+$perl -d:stub    -e "$do" && { echo "probe passed unexpectedly!"; exit 1; }
+
+: perl with NYTProf
+export  
NYTPROF=${NYTPROF}:stmts=0:blocks=0:start=no:subs=0:slowops=0:leave=0
+$perl -d:NYTProf -e "$do" && { echo "probe passed unexpectedly!"; exit 1; }
+

--~--~---------~--~----~------------~-------~--~----~
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.

Group hosted at:  http://groups.google.com/group/develnytprof-dev
Project hosted at:  http://perl-devel-nytprof.googlecode.com
CPAN distribution:  http://search.cpan.org/dist/Devel-NYTProf

To post, email:  [email protected]
To unsubscribe, email:  [email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to