[perl #118305] make dtrace sub-entry probe support lexsubs
authorFather Chrysostomos <sprout@cpan.org>
Thu, 20 Jun 2013 21:07:19 +0000 (14:07 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 21 Jun 2013 13:26:44 +0000 (06:26 -0700)
No tests, because I don’t know how to write them.

See also <https://rt.perl.org/rt3/Ticket/Display.html?id=118305#txn-1221543>.

I have tested this manually, so I know it works and no longer crashes.

Hopefully someone else can follow this up with tests.

cop.h

diff --git a/cop.h b/cop.h
index 94a1267..122e2d7 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -581,7 +581,9 @@ struct block_format {
  * decremented by LEAVESUB, the other by LEAVE. */
 
 #define PUSHSUB_BASE(cx)                                               \
-       ENTRY_PROBE(GvENAME(CvGV(cv)),                                  \
+       ENTRY_PROBE(CvNAMED(cv)                                         \
+                       ? HEK_KEY(CvNAME_HEK(cv))                       \
+                       : GvENAME(CvGV(cv)),                            \
                CopFILE((const COP *)CvSTART(cv)),                      \
                CopLINE((const COP *)CvSTART(cv)),                      \
                CopSTASHPV((const COP *)CvSTART(cv)));                  \
@@ -646,7 +648,9 @@ struct block_format {
 
 #define POPSUB(cx,sv)                                                  \
     STMT_START {                                                       \
-       RETURN_PROBE(GvENAME(CvGV((const CV*)cx->blk_sub.cv)),          \
+       RETURN_PROBE(CvNAMED(cx->blk_sub.cv)                            \
+                       ? HEK_KEY(CvNAME_HEK(cx->blk_sub.cv))           \
+                       : GvENAME(CvGV(cx->blk_sub.cv)),                \
                CopFILE((COP*)CvSTART((const CV*)cx->blk_sub.cv)),      \
                CopLINE((COP*)CvSTART((const CV*)cx->blk_sub.cv)),      \
                CopSTASHPV((COP*)CvSTART((const CV*)cx->blk_sub.cv)));  \