Debugger code does &SvIVX(...)

[email protected] (Nicholas Clark) Fri, 8 Apr 2005 14:20:56 +0100
Newsgroups perl.perl5.porters,perl.ponie.dev
Message-ID <[email protected]>
Does anyone understand why/how the debugger code wants to save the value
of the IV slot inside an IV? Both are conditional on PERLDB_SUB_NN being
true:

#define PERLDB_SUB_NN    (PL_perldb && (PL_perldb & (PERLDBf_NONAME)))

Offending lines are:

pp_hot.c line 2596:

    else {
        (void)SvUPGRADE(dbsv, SVt_PVIV);
        (void)SvIOK_on(dbsv);
        SAVEIV(SvIVX(dbsv));
        SvIV_set(dbsv, PTR2IV(cv));     /* Do it the quickest way  */
    }

pp_ctl.c line 2432:

                    if (PERLDB_SUB_NN) {
                        (void)SvUPGRADE(sv, SVt_PVIV);
                        (void)SvIOK_on(sv);
                        SAVEIV(SvIVX(sv));
                        SvIV_set(sv, PTR2IV(cv)); /* Do it the quickest way */
                    } else {

The pp_ctl.c lines were added in patch 20034:

http://public.activestate.com/cgi-bin/perlbrowse?patch=20034

	Subject: [PATCH @19834] DProf fixes
	From: Radu Greab <[email protected]>
	Date: Sun, 6 Jul 2003 20:09:12 +0300
	Message-ID: <[email protected]>


For me the trail on pp_hot.c goes cold in change 969
"Integrate win32 branch into mainline"

Is doing this even legal? Can the SV * in question get upgraded further, and
thus that saved memory location stop being the location of SV's IV?

Should we add a new save type that takes the pointer to an SV and saves/
restores the IV slot?

Nicholas Clark