From: Blair Zajac Date: Wed, 8 Jan 2003 12:28:35 +0000 (-0800) Subject: Re: When Storable and Devel::DProf mix, core dump [perl #19385] X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ae7638f4d1ab4edf2eef64922c6d042904d21153;p=p5sagit%2Fp5-mst-13.2.git Re: When Storable and Devel::DProf mix, core dump [perl #19385] Message-ID: <3E1C89F3.2B4759C@orcaware.com> p4raw-id: //depot/perl@18526 --- diff --git a/ext/Devel/DProf/Changes b/ext/Devel/DProf/Changes index 216498b..09b2250 100644 --- a/ext/Devel/DProf/Changes +++ b/ext/Devel/DProf/Changes @@ -1,3 +1,12 @@ +2003 Jan 8 + + Blair Zajac: + DProf.xs: + - To avoid core dumps, increase stack size by 10 instead of 5. + - Assert that g_profstack is large enough when DEBUGGING is defined + DProf.pm: + - Bump VERSION. + 1999 Jan 8 Ilya Zakharevich: diff --git a/ext/Devel/DProf/DProf.pm b/ext/Devel/DProf/DProf.pm index d5d8a82..15fc93a 100644 --- a/ext/Devel/DProf/DProf.pm +++ b/ext/Devel/DProf/DProf.pm @@ -188,7 +188,7 @@ sub DB { use XSLoader (); # Underscore to allow older Perls to access older version from CPAN -$Devel::DProf::VERSION = '20000000.00_01'; # this version not authorized by +$Devel::DProf::VERSION = '20030108.00_00'; # this version not authorized by # Dean Roehrich. See "Changes" file. XSLoader::load 'Devel::DProf', $Devel::DProf::VERSION; diff --git a/ext/Devel/DProf/DProf.xs b/ext/Devel/DProf/DProf.xs index 78ea3c9..caa0729 100644 --- a/ext/Devel/DProf/DProf.xs +++ b/ext/Devel/DProf/DProf.xs @@ -9,6 +9,12 @@ /* define DBG_TIMER to cause a warning when the timer is turned on and off. */ /*#define DBG_TIMER 1 */ +#ifdef DEBUGGING +#define ASSERT(x) assert(x) +#else +#define ASSERT(x) +#endif + #ifdef DBG_SUB # define DBG_SUB_NOTIFY(A) dprof_dbg_sub_notify(A) void @@ -297,7 +303,7 @@ prof_mark(pTHX_ opcode ptype) SV *Sub = GvSV(PL_DBsub); /* name of current sub */ if (g_SAVE_STACK) { - if (g_profstack_ix + 5 > g_profstack_max) { + if (g_profstack_ix + 10 > g_profstack_max) { g_profstack_max = g_profstack_max * 3 / 2; Renew(g_profstack, g_profstack_max, PROFANY); } @@ -309,6 +315,7 @@ prof_mark(pTHX_ opcode ptype) sdelta = t.tms_stime - g_otms_stime; if (rdelta || udelta || sdelta) { if (g_SAVE_STACK) { + ASSERT(g_profstack_ix + 4 <= g_profstack_max); g_profstack[g_profstack_ix++].ptype = OP_TIME; g_profstack[g_profstack_ix++].tms_utime = udelta; g_profstack[g_profstack_ix++].tms_stime = sdelta; @@ -343,6 +350,7 @@ prof_mark(pTHX_ opcode ptype) if (CvXSUB(cv) == XS_Devel__DProf_END) return; if (g_SAVE_STACK) { /* Store it for later recording -JH */ + ASSERT(g_profstack_ix + 4 <= g_profstack_max); g_profstack[g_profstack_ix++].ptype = OP_GV; g_profstack[g_profstack_ix++].id = id; g_profstack[g_profstack_ix++].name = pname; @@ -365,6 +373,7 @@ prof_mark(pTHX_ opcode ptype) g_total++; if (g_SAVE_STACK) { /* Store it for later recording -JH */ + ASSERT(g_profstack_ix + 2 <= g_profstack_max); g_profstack[g_profstack_ix++].ptype = ptype; g_profstack[g_profstack_ix++].id = id; diff --git a/ext/Devel/DProf/Makefile.PL b/ext/Devel/DProf/Makefile.PL index 667cc52..b3eb6c5 100644 --- a/ext/Devel/DProf/Makefile.PL +++ b/ext/Devel/DProf/Makefile.PL @@ -1,3 +1,7 @@ +BEGIN { + require 5.006; +} + use ExtUtils::MakeMaker; WriteMakefile(