develooper Front page | perl.perl5.porters | Postings from September 2023

Re: Native stack traces?

Thread Previous
From:
Dave Mitchell
Date:
September 8, 2023 11:19
Subject:
Re: Native stack traces?
Message ID:
ZPsDN5pnk+yB/EcV@iabyn.com
On Fri, Sep 08, 2023 at 11:56:00AM +0100, Dave Mitchell wrote:
> Most of the value that Carp adds is around sanely displaying weird
> arguments (undef, long strings, typeglobs, tied/overloaded for example).

I forgot to mention that perl's introspection of caller args is inherently
flaky. It will be better once PERL_RC_STACK becomes the norm, but it
can still return weird rubbish.

The biggest issue is that caller() tries to reconstruct the original $_[0]
etc even after a shift; so in:

    sub f { my $self = shift; ... }

it actually inspects back before the current $_[0] looking for something
which might have been an argument. What it finds might actually have been
freed and/or reallocated in the meantime.

-- 
Wesley Crusher gets beaten up by his classmates for being a smarmy git,
and consequently has a go at making some friends of his own age for a
change.
    -- Things That Never Happen in "Star Trek" #18

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About