On Sat, Jun 13, 2009 at 09:27:57AM +0100, Martin J. Evans wrote:
>>
>> I have the theory that this has something to do with a use() line
>> since my real theory is that no dbstate or nextstate ops have fired
>> yet and therefor you have no "current" line yet.
Or, similarly, perl uses 0 as the 'line number' of code that 'executes'
use statements from the command line. That kind'a makes sense.
For my tests I've used a file called m.pm that just contains: 1;
NYTPROF=trace=9:blocks=0:subs=0 perl -d:NYTProf -Dt -Mm -e 1
Opened nytprof.out
NYTProf enable_profile (previously disabled) to nytprof.out at
/usr/local/perl58-i/lib/site_perl/5.8.6/darwin-thread-multi-2level/Devel/NYTProf.pm
line 43.
(-e:0) nextstate
(-e:0) nextstate
(-e:0) pushmark
(-e:0) const(PV("Devel::NYTProf"\0))
(-e:0) method_named
(-e:0) entersub
(-e:0) leavesub
(-e:0) nextstate
Unable to determine line number in -e.
NYTProf pid 28932: first statement line 0 of -e.
New fid 1 (after 0:1 ) 32 e0:0 -e has src,save src
@1:1 .
(-e:0) const(PV("m.pm"\0))
(-e:0) require
(m.pm:0) nextstate
Wrote 1:1 371 ticks (0, 0)
New fid 2 (after 1:1 ) 02 e0:0 m.pm
/Users/timbo/perl/mods/nytprof-trunk/m.pm no src,nosave src
@2:1 at m.pm line 1.
(m.pm:1) const(IV(1))
(m.pm:1) leaveeval
Wrote 2:1 101 ticks (0, 0)
Unable to determine line number in -e.
fid 1: -e
@1:1 .
left 2:1 via 409ac0leaveeval back to nextstate at 1:1 (b0 s0) - discounting
next statement
(-e:0) nextstate
So I think the "Unable to determine line number" warning, which is
triggered if CopLINE(cop) returns 0, is inappropriate *in this case*.
> You are right, I've no idea how I did not notice this. The startup line has
> had -MCarp=verbose added to it. If this is removed I get no "unable to
> determine line number" output at all.
Great.
I wonder if/how we can distinguish this situation from any other
(unknown) situations that CopLINE(cop) might yield a 0.
The -M option injects code into PL_preambleav, which is also used for
things like -V and sitecustomize.pl. The contents of PL_preambleav get
injected into the first line the parser sees, in the same way that
things like -p, -n. [Reproduced with perl -d:NYTProf -n -e 1 </dev/null]
I've checked in a very basic fudge that just checks if the package is
"main" and has a few notes in comments about possible better checks.
Tim.
--~--~---------~--~----~------------~-------~--~----~
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]
-~----------~----~----~----~------~----~------~--~---