Revision: 1215
Author: [email protected]
Date: Thu May  6 15:39:37 2010
Log: Added CXt_LOOP to cx_block_type and the ability to show the int value for unknown types.

http://code.google.com/p/perl-devel-nytprof/source/detail?r=1215

Modified:
 /trunk/NYTProf.xs

=======================================
--- /trunk/NYTProf.xs   Mon May  3 13:49:06 2010
+++ /trunk/NYTProf.xs   Thu May  6 15:39:37 2010
@@ -966,6 +966,7 @@

 static const char *
 cx_block_type(PERL_CONTEXT *cx) {
+    char buf[20];
     switch (CxTYPE(cx)) {
     case CXt_NULL:              return "CXt_NULL";
     case CXt_SUB:               return "CXt_SUB";
@@ -979,6 +980,9 @@
 #ifdef CXt_GIVEN
     case CXt_GIVEN:             return "CXt_GIVEN";
 #endif
+#ifdef CXt_LOOP
+    case CXt_LOOP:              return "CXt_LOOP";
+#endif
 #ifdef CXt_LOOP_FOR
     case CXt_LOOP_FOR:          return "CXt_LOOP_FOR";
 #endif
@@ -992,7 +996,11 @@
     case CXt_LOOP_LAZYIV:       return "CXt_LOOP_LAZYIV";
 #endif
     }
-    return "CXt_???";
+    /* short-lived and not thread safe but we only use this for tracing
+     * and it should never be reached anyway
+     */
+    sprintf(buf, "CXt_%d", CxTYPE(cx));
+    return buf;
 }


@@ -1077,8 +1085,12 @@
                     OutCopFILE((COP*)o));
             return (COP*)o;
         }
+        if (CxTYPE(cx) == CXt_LOOP) {
+            return NULL;
+        }
         /* should never get here but we do */
-        if (trace_level >= trace) {
+        if (trace_level >= trace || 1) {
+            warn("not a cop");
             logwarn("\tstart_cop_of_context %s op '%s' isn't a cop\n",
                 cx_block_type(cx), OP_NAME(o));
             if (trace_level >  trace)

--
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.

Group hosted at:  http://groups.google.com/group/develnytprof-dev
Project hosted at:  http://perl-devel-nytprof.googlecode.com
CPAN distribution:  http://search.cpan.org/dist/Devel-NYTProf

To post, email:  [email protected]
To unsubscribe, email:  [email protected]

Reply via email to