Introduce CVf_NODEBUG flag
authorGurusamy Sarathy <gsar@engin.umich.edu>
Wed, 1 Jan 1997 20:42:05 +0000 (15:42 -0500)
committerChip Salzenberg <chip@atlantic.net>
Sat, 4 Jan 1997 05:44:00 +0000 (17:44 +1200)
commita3d90dd510fe5a67ed9b80e603493d285c30aa97
tree0dabca893a0ebce18c291b35804a173c350df3d3
parent7cfe7857715f78206e6d7d6f7fd52983de4dec44
Introduce CVf_NODEBUG flag

Subject: Re: debugger and XSUBs

On Wed, 01 Jan 1997 13:45:32 EST, Chip Salzenberg wrote:
>According to Gurusamy Sarathy:
>> P.S:  Porters: Come to think of if, I can't seem to find a
>> good enough reason for why even XSUBs (like Alias::attr())
>> must be called by DB::sub() and not directly by perl (when
>> perldb).  Anyone else can?
>
>Nope.

Actually, there is a case for it, since you may want to profile
XSUBs.

>> I ask because the fix will be much simpler in perl (just skip the
>> OPpENTERSUB_DB indirection in pp_entersub() for XSUBs).
>
>I vote for this change.  It's even a performance improvement.

Here's a simple patch that offers the best of both worlds.  I have added
a new flag CVf_NODEBUG, that can be used to turn off the DB::sub
indirection for specific CVs.  This is most likely to be used
on XSUBs that must depend on the calling scope's structure
(which C<-d> alters), but can be used on the CV of plain subs
as well.

This facility will also be useful in Dprof, where one can conceivably
turn off the profiling of all subs except the target one in the
interest of accurately timing the target sub's performance.

I do the following now in the BOOT: section of Alias.xs to
disable debugging of Alias::attr():

    BOOT:
    {
     GV *gv = gv_fetchpv("Alias::attr", FALSE, SVt_PVCV);
     if (gv && GvCV(gv))
         CvNODEBUG_on(GvCV(gv));
    }

Perlanoids will be happy to note that this patch has no effect
unless the -d switch is used.

p5p-msgid: <199701012042.PAA25994@aatma.engin.umich.edu>
cv.h
pp_hot.c