develooper Front page | perl.perl5.porters | Postings from October 2015

Re: [perl #126273] [PATCH] WIP add save stack caller tracing

Thread Previous
From:
Dave Mitchell
Date:
October 6, 2015 10:22
Subject:
Re: [perl #126273] [PATCH] WIP add save stack caller tracing
Message ID:
20151006102151.GY16789@iabyn.com
On Mon, Oct 05, 2015 at 11:51:43AM -0700, bulk88 wrote:
> See attached patch. This patch was created since 
> https://rt.perl.org/Public/Bug/Display.html?id=40565 took too much time 
> for me to debug, and Test::Stream is revealing more psuedofork save 
> stack related panic/assert fails/heap corruption/segvs in 2015 (that is 
> another bug ticket for me to file). So this patch decrease the amount of 
> time to diagnose save stack problems.

Um, this seems a bit invasive. Would it be possible instead, to

1. If you're just interested in finding when a particular SS frame of
interest was pushed:

On debugging builds, have a var, PL_savestack_serial say, which is
incremented and pushed onto the SS at the same time the SS action is.
Then to find where a particular frame comes from, look at the serial
number, then rerun the program with a watchppoint to trigger when
PL_savestack_serial gets that value.

2. If you need to do more general introspection (e.g. a full stack dump
showing where each frame came from):

On debugging builds, have a fake save type, SAVEt_DEBUGINFO say, along with
an associated save function and macro, that can be used to push that info
on the savestack; e.g.

    #ifdef DEBUGGING
    #  define SAVEDEBUGINFO() save_debuginfo(__LINE__, __FILE__)

    Perl_save_debuginfo(pTHX_ char *file, int line)
    {
        dSS_ADD;
        SS_ADD_PTR(file);
        SS_ADD_INT(line);
        SS_ADD_UV(SAVEt_DEBUGINFO);
        SS_ADD_END(3);
    }

    #else
    #  define SAVEDEBUGINFO() NOOP;
    #endif

Then just update the SAVEFOO macros to be, e.g.

#define SAVEI8(i)	save_I8((I8*)&(i)); SAVEDEBUGINFO


-- 
In England there is a special word which means the last sunshine
of the summer. That word is "spring".

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