develooper Front page | perl.perl5.porters | Postings from May 2002

Re: [ID 20020513.015] Seg-fault running t/io/fs.t under Devel::DProf

Thread Previous | Thread Next
From:
Sam Tregar
Date:
May 13, 2002 18:03
Subject:
Re: [ID 20020513.015] Seg-fault running t/io/fs.t under Devel::DProf
Message ID:
Pine.LNX.4.44.0205132050030.4356-100000@localhost.localdomain
On Tue, 14 May 2002, Jarkko Hietaniemi wrote:

> Well, dereferencing that (as CvGV() would do) leads nowhere.  Or, as
> the Ten Commandments for C Programmers quoth, "Thou shalt not follow
> the NULL pointer, for chaos and madness await thee at its end."

Amen brother.  Preach it.

I've experimented with patches that just return() from prof_mark() if (cv
== NULL).  It seems to work, but I worry about the implications for the
profiling output if we just start dropping subs.

> > And, if you're wondering where cv, came from - it resulted from a
> > INT2PTR(CV*,SvIVX(Sub)).  Sub is:
>
> If I knew ::DProf enough to what is supposed to be in the SvIVX
> I would knowingly nod my head here.

Well, Sub comes from:

  SV *Sub = GvSV(PL_DBsub);  /* name of current sub */

And PL_DBsub is just a funny name for $DB::sub, I think.  And $DB::sub is
some kind of funny dual-var that's supposed to have both the name of the
sub and its address.  Except that I've never seen it have the name, at
least not while Devel::DProf is around.  On calls when doesn't crash
SvIVX(Sub) is the address of the CV currently being entered or left.

So does that ring any bells?

> > I think the PV value is an artifact of my having turned on DBG_SUB in
> > DProf.xs.  I think it's also 0 with DBG_SUB off.  I'd be happy to run the
> > test again with DBG_SUB off if that would help you.
>
> Yes, please.

Ok.  Here's Sub with DBG_SUB off:

(gdb) call Perl_sv_dump(Sub)
SV = PVIV(0x8166c90) at 0x81666b8
  REFCNT = 1
  FLAGS = (IOK,pIOK)
  IV = 0
  PV = 0


And in case you're curious, here's PL_DBsub too:

(gdb) call Perl_sv_dump(PL_DBsub)
SV = PVGV(0x816edc0) at 0x81666ac
  REFCNT = 1
  FLAGS = (GMG,SMG,MULTI)
  IV = 0
  NV = 0
  MAGIC = 0x816ee30
    MG_VIRTUAL = &PL_vtbl_glob
    MG_TYPE = PERL_MAGIC_glob(*)
    MG_OBJ = 0x81666ac
  NAME = "sub"
  NAMELEN = 3
  GvSTASH = 0x8166598	"DB"
  GP = 0x816edf8
    SV = 0x81666b8
    REFCNT = 1
    IO = 0x0
    FORM = 0x0
    AV = 0x0
    HV = 0x81666c4
    CV = 0x8183b4c
    CVGEN = 0x0
    GPFLAGS = 0x0
    LINE = 0
    FILE = ""
    FLAGS = 0x2
    EGV = 0x81666ac	"sub"

-sam



Thread Previous | Thread Next


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