Revision: 882 Author: tim.bunce Date: Mon Oct 26 15:56:52 2009 Log: Added emulation of gv_fetchfile_flags that null-terminates the string. (Probably cause of RT#49835 and string eval src being missing in some older perls)
http://code.google.com/p/perl-devel-nytprof/source/detail?r=882 Modified: /trunk/Changes /trunk/NYTProf.xs ======================================= --- /trunk/Changes Sat Oct 24 08:56:24 2009 +++ /trunk/Changes Mon Oct 26 15:56:52 2009 @@ -9,6 +9,7 @@ XXX subroutine profiler docs need update XXX note here and doc goto behaviour XXX OP_SUBSTCONT +XXX should add test for embedded src code, incl string eval Note: The file format has changed. Old files can't be read. @@ -17,6 +18,7 @@ Fixed risk of infinite recursion if trace enabled and $SIG{__WARN__} was set to a code reference. Fixed subroutine recursion depth measurement. + Fixed missing embedded eval source code for some older perls. Changed ReadStream SUB_LINE_RANGE tag to SUB_INFO. ======================================= --- /trunk/NYTProf.xs Mon Oct 26 15:01:29 2009 +++ /trunk/NYTProf.xs Mon Oct 26 15:56:52 2009 @@ -30,8 +30,20 @@ #if !defined(OutCopFILE) # define OutCopFILE CopFILE #endif -#ifndef gv_fetchfile_flags -#define gv_fetchfile_flags(str, len, flags) gv_fetchfile(str) + +#ifndef gv_fetchfile_flags /* added in perl 5.009005 */ +/* we know our uses don't contain embedded nulls, so we just need to copy to a + * buffer so we can add a trailing null byte */ +#define gv_fetchfile_flags(a,b,c) Perl_gv_fetchfile_flags(aTHX_ a,b,c) +static GV * +Perl_gv_fetchfile_flags(pTHX_ const char *const name, const STRLEN namelen, const U32 flags) { + char buf[2000]; + if (namelen >= sizeof(buf)-1) + croak("panic: gv_fetchfile_flags overflow"); + memcpy(buf, name, namelen); + buf[namelen] = '\0'; /* null-terminate */ + return gv_fetchfile(buf); +} #endif #ifndef OP_SETSTATE --~--~---------~--~----~------------~-------~--~----~ 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] -~----------~----~----~----~------~----~------~--~---
