Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the devel-nytprof CPAN distribution.

Report information
The Basics
Id: 51149
Status: resolved
Priority: 0/
Queue: devel-nytprof

People
Owner: Nobody in particular
Requestors: cpan [...] chmrr.net
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: (no value)



Subject: NYTProf fails with Carp
Carp (in everything except blead) pulls weird tricks with delay-loading in Carp::Heavy. This can cause CopFILE(PL_curcop) to be null, which leads even the following simple snippet to segfault: perl -d:NYTProf -e 'require Carp; Carp::longmess("whoops")' Attached is a simplistic fix, and an appropriate test.
Subject: 0001-Avoid-a-segfault-when-CopFILE-is-null-like-Carp-Heav.patch
From 3fd12f48f7ee26ae3f42ef98ab727a8021a2eb89 Mon Sep 17 00:00:00 2001 From: Alex Vandiver <alex@chmrr.net> Date: Thu, 5 Nov 2009 16:59:23 -0500 Subject: [PATCH] Avoid a segfault when CopFILE() is null, like Carp::Heavy causes --- NYTProf.xs | 2 ++ t/test18-carp.p | 14 ++++++++++++++ t/test18-carp.t | 6 ++++++ 3 files changed, 22 insertions(+), 0 deletions(-) create mode 100644 t/test18-carp.p create mode 100644 t/test18-carp.t diff --git a/NYTProf.xs b/NYTProf.xs index fa0f224..70b1245 100644 --- a/NYTProf.xs +++ b/NYTProf.xs @@ -2529,6 +2529,8 @@ subr_entry_setup(pTHX_ COP *prev_cop, subr_entry_t *clone_subr_entry, OPCODE op_ } file = OutCopFILE(prev_cop); + if (file == NULL) + file = "(null)"; subr_entry->caller_fid = (file == last_executed_fileptr) ? last_executed_fid : get_file_id(aTHX_ file, strlen(file), NYTP_FIDf_VIA_SUB); diff --git a/t/test18-carp.p b/t/test18-carp.p new file mode 100644 index 0000000..a0b2f8c --- /dev/null +++ b/t/test18-carp.p @@ -0,0 +1,14 @@ +# Test Carp::Heavy's "swap subs out from under you with goto &sub" + +package Carp; + +sub longmess { goto &longmess_jmp } + +sub longmess_jmp { + local($@, $!); + eval { require Carp::Heavy }; + return $@ if $@; + goto &longmess_real; +} + +longmess("Oops"); diff --git a/t/test18-carp.t b/t/test18-carp.t new file mode 100644 index 0000000..bbfeb78 --- /dev/null +++ b/t/test18-carp.t @@ -0,0 +1,6 @@ +use strict; +use Test::More; +use lib qw(t/lib); +use NYTProfTest; + +run_test_group; -- 1.6.3.3.473.gb74fc4.dirty
Thanks! This seems to be fixed in the repository now due to other changes.
Subject: Re: [rt.cpan.org #51149] NYTProf fails with Carp
Date: Sun, 15 Nov 2009 15:39:07 -0500
To: bug-devel-nytprof <bug-devel-nytprof [...] rt.cpan.org>
From: Alex Vandiver <chmrr [...] chmrr.net>
At Sat Nov 14 18:35:15 -0500 2009, Tim_Bunce via RT wrote: Show quoted text
> Thanks! This seems to be fixed in the repository now due to other changes.
The test still fails for me -- apparently Carp::Heavy in 5.8.8 is different enough that it didn't segfault there, which may have caused some of the confusion. I've attached an updated patch whose test doesn't rely in any way on Carp or Carp::Heavy. Note that I don't believe the change to NYTPRof.xs is at all correct -- for instance, it causes NYTProf to go looking for a file called "./(null)" -- but hopefully at least helps to show where GDB says the freakout is coming from. - Alex -- Networking -- only one letter away from not working

Message body is not shown because sender requested not to inline it.

Yeap, still has problems: $ foreachperl perl -d:NYTProf -e 'require Carp; Carp::longmess("whoops")' ok: /usr/local/perl511-i/bin FAILED: /usr/local/perl510-pure/bin FAILED: /usr/local/perl510-thr64/bin FAILED: /usr/local/perl510/bin ok: /usr/local/perl58-i/bin ok: /usr/local/perl588-64/bin ok: /usr/local/perl588-thr/bin FAILED: /usr/local/perl589-i/bin ok: /usr/local/perl589/bin Thanks!
Fixed in r909! Thanks again.