[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: @{"_<$filename"} is unreasonably tied to use of DB::DB ($^P & 0x2)



On Fri, Oct 31, 2008 at 09:52:56PM +0000, Tim Bunce wrote:
> On Fri, Oct 31, 2008 at 03:05:03PM +0000, Nicholas Clark wrote:

> > A very minimal patch that arrives within 24 hours is likely to get into
> > 5.8.9-RC1, because I can't see anything that scary about just splitting
> > that one bit into two new ones.

I thought a bit further and realised that we don't actually *have* to split
the two functions into two new bits, because right now no-one is asking for
only the other function. Assuming it's never needed, it would just be creating
a legacy API to support.

Also, there as never a stable release with 0x400 used, so I used that.

> I'm off to Dublin for the weekend so that's not going to happen, sadly.
> Would Monday afternoon GMT work?

No. Too late, assuming that David gets File::Path out this weekend, and
Andreas explains where I was being daft with CPAN.pm

So I did the appended. It's good?

Nicholas Clark

Change 34693 by nicholas@nicholas-pecuchet on 2008/11/01 14:51:05

	Add a flag PERLDBf_SAVESRC, which enables the saved lines part of
	PERLDBf_LINE, so that profilers (such as NYTProf) have access to the
	lines of the eval, without the speed impact of other parts of the
	debugger infrastructure. PERLDBf_LINE is unchanged. Based largely on a
	patch by Tim Bunce in <20081028152749.GA12500@timac.local>

Affected files ...

... //depot/perl/lib/perl5db.pl#136 edit
... //depot/perl/perl.h#842 edit
... //depot/perl/pp_ctl.c#706 edit

Differences ...

==== //depot/perl/lib/perl5db.pl#136 (text) ====

@@ -8703,8 +8703,12 @@
         PERLDBf_GOTO      => 0x80,     # Report goto: call DB::goto
         PERLDBf_NAMEEVAL  => 0x100,    # Informative names for evals
         PERLDBf_NAMEANON  => 0x200,    # Informative names for anon subs
+        PERLDBf_SAVESRC   => 0x400,    # Save source lines into @{"_<$filename"}
         PERLDB_ALL        => 0x33f,    # No _NONAME, _GOTO
     );
+    # PERLDBf_LINE also enables the actions of PERLDBf_SAVESRC, so the debugger
+    # doesn't need to set it. It's provided for the benefit of profilers and
+    # other code analysers.
 
     %DollarCaretP_flags_r = reverse %DollarCaretP_flags;
 }

==== //depot/perl/perl.h#842 (text) ====

@@ -5323,7 +5323,8 @@
 #define PERLDB_ALL		(PERLDBf_SUB	| PERLDBf_LINE	|	\
 				 PERLDBf_NOOPT	| PERLDBf_INTER	|	\
 				 PERLDBf_SUBLINE| PERLDBf_SINGLE|	\
-				 PERLDBf_NAMEEVAL| PERLDBf_NAMEANON )
+				 PERLDBf_NAMEEVAL| PERLDBf_NAMEANON |   \
+				 PERLDBf_SAVESRC)
 					/* No _NONAME, _GOTO, _ASSERTION */
 #define PERLDBf_SUB		0x01	/* Debug sub enter/exit */
 #define PERLDBf_LINE		0x02	/* Keep line # */
@@ -5336,6 +5337,7 @@
 #define PERLDBf_GOTO		0x80	/* Report goto: call DB::goto */
 #define PERLDBf_NAMEEVAL	0x100	/* Informative names for evals */
 #define PERLDBf_NAMEANON	0x200	/* Informative names for anon subs */
+#define PERLDBf_SAVESRC  	0x400	/* Save source lines into @{"_<$filename"} */
 
 #define PERLDB_SUB	(PL_perldb && (PL_perldb & PERLDBf_SUB))
 #define PERLDB_LINE	(PL_perldb && (PL_perldb & PERLDBf_LINE))
@@ -5348,6 +5350,7 @@
 #define PERLDB_NAMEEVAL	(PL_perldb && (PL_perldb & PERLDBf_NAMEEVAL))
 #define PERLDB_NAMEANON	(PL_perldb && (PL_perldb & PERLDBf_NAMEANON))
 #define PERLDB_ASSERTION (PL_perldb && (PL_perldb & PERLDBf_ASSERTION))
+#define PERLDB_SAVESRC 	(PL_perldb && (PL_perldb & PERLDBf_SAVESRC))
 
 #ifdef USE_LOCALE_NUMERIC
 

==== //depot/perl/pp_ctl.c#706 (text) ====

@@ -3725,11 +3725,12 @@
 
     /* prepare to compile string */
 
-    if (PERLDB_LINE && PL_curstash != PL_debstash)
+    if (PERLDB_SAVESRC && PL_curstash != PL_debstash)
 	save_lines(CopFILEAV(&PL_compiling), PL_parser->linestr);
     PUTBACK;
     ok = doeval(gimme, NULL, runcv, seq);
-    if (PERLDB_INTER && was != (I32)PL_sub_generation /* Some subs defined here. */
+    if ((PERLDB_LINE || PERLDB_SAVESRC)
+	&& was != (I32)PL_sub_generation /* Some subs defined here. */
 	&& ok) {
 	/* Copy in anything fake and short. */
 	my_strlcpy(safestr, fakestr, fakelen);


Follow-Ups from:
Tim Bunce <Tim.Bunce@pobox.com>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]