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>