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

Re: How to tell if Perl has -DDEBUGGING?

Thread Previous | Thread Next
Nicholas Clark
October 25, 2003 02:54
Re: How to tell if Perl has -DDEBUGGING?
Message ID:
On Fri, Oct 24, 2003 at 04:15:05PM -0600, Jim Cromie wrote:
> and without $^D set, its difficult to get at hidden/obfuscated code.
> If they do monkey with $^D on a non-debugging perl, it still wouldnt
> give them what they want.

I'm not so sure about that. The perl debugger works on a non-"debugging"
perl. If you run under the -d switch this code in toke.c is activated:

        /* debugger active and we're not compiling the debugger code,
         * so store the line into the debugger's array of lines
        if (PERLDB_LINE && PL_curstash != PL_debstash) {
            SV *sv = NEWSV(85,0);

            sv_upgrade(sv, SVt_PVMG);
            SvIVX(sv) = 0;

You don't even have to use the perl debugger - you can write your own
which would dump source back out from the array of source lines.

It can't be this easy. If it is I'm surprised that no-one has commented
on this before.

Nicholas Clark

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About