Revision: 908
Author: tim.bunce
Date: Sun Nov 15 13:42:01 2009
Log: Limit the damage when a confused NYTProf stack is detected.
(So "PERL5OPT=-d:NYTProf prove" works for modules that include thread  
tests, like Scope::Upper, no longer aborts)

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

Modified:
  /trunk/NYTProf.xs

=======================================
--- /trunk/NYTProf.xs   Sun Nov 15 13:11:36 2009
+++ /trunk/NYTProf.xs   Sun Nov 15 13:42:01 2009
@@ -2503,10 +2503,16 @@
      prev_subr_entry_ix = subr_entry_ix;
      subr_entry_ix = SSNEWa(sizeof(*subr_entry), MEM_ALIGNBYTES);
      subr_entry = subr_entry_ix_ptr(subr_entry_ix);
+    Zero(subr_entry, 1, subr_entry_t);
+
      if (subr_entry_ix <= prev_subr_entry_ix) {
+        /* one cause of this is running NYTProf with threads */
          logwarn("NYTProf panic: stack is confused!\n");
-    }
-    Zero(subr_entry, 1, subr_entry_t);
+        /* limit the damage */
+        disable_profile(aTHX);
+        subr_entry->already_counted++;
+        return subr_entry_ix;
+    }

      subr_entry->prev_subr_entry_ix = prev_subr_entry_ix;
      caller_subr_entry = subr_entry_ix_ptr(prev_subr_entry_ix);

-- 
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