develooper Front page | perl.perl5.porters | Postings from February 2001

[PATCH: perl@8935] -Dt padsv($var)

Thread Next
From:
David Mitchell
Date:
February 26, 2001 03:01
Subject:
[PATCH: perl@8935] -Dt padsv($var)
Message ID:
200102261101.LAA12915@tiree.fdgroup.co.uk
This trivial patch causes the output of -Dt to include the name of the
variable being accessed by pad[sah]v, eg

	(foo:6)	padav
becomes
	(foo:6)	padav(@a)

NB - this is my first Perl patch, so treat it as you would a rabid dog ;-)



--- run.c.old	Thu Feb 22 23:53:41 2001
+++ run.c	Sun Feb 25 20:35:38 2001
@@ -64,6 +64,7 @@
 {
 #ifdef DEBUGGING
     SV *sv;
+    SV **svp;
     STRLEN n_a;
     Perl_deb(aTHX_ "%s", PL_op_name[o->op_type]);
     switch (o->op_type) {
@@ -80,6 +81,16 @@
 	}
 	else
 	    PerlIO_printf(Perl_debug_log, "(NULL)");
+	break;
+    case OP_PADSV:
+    case OP_PADAV:
+    case OP_PADHV:
+	/* print the lexical's name */
+	svp = av_fetch(PL_comppad_name, o->op_targ, FALSE);
+	if (svp)
+	    PerlIO_printf(Perl_debug_log, "(%s)", SvPV(*svp,n_a));
+	else
+	    PerlIO_printf(Perl_debug_log, "[%"UVuf"]", o->op_targ);
 	break;
     default:
 	break;



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