Change 34693 by [EMAIL PROTECTED] 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 <[EMAIL PROTECTED]>

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) ====
Index: perl/lib/perl5db.pl
--- perl/lib/perl5db.pl#135~34312~      2008-09-07 14:46:18.000000000 -0700
+++ perl/lib/perl5db.pl 2008-11-01 07:51:05.000000000 -0700
@@ -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) ====
Index: perl/perl.h
--- perl/perl.h#841~34630~      2008-10-29 01:09:06.000000000 -0700
+++ perl/perl.h 2008-11-01 07:51:05.000000000 -0700
@@ -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) ====
Index: perl/pp_ctl.c
--- perl/pp_ctl.c#705~34679~    2008-10-31 01:55:20.000000000 -0700
+++ perl/pp_ctl.c       2008-11-01 07:51:05.000000000 -0700
@@ -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);
End of Patch.

Reply via email to