Skip to content

Commit

Permalink
Add ENTER_with_name and LEAVE_with_name to automaticly check for matc…
Browse files Browse the repository at this point in the history
…hing ENTER/LEAVE when debugging is enabled
  • Loading branch information
ggoossen authored and rgs committed Nov 12, 2009
1 parent af24cc9 commit d343c3e
Show file tree
Hide file tree
Showing 10 changed files with 130 additions and 86 deletions.
2 changes: 2 additions & 0 deletions embedvar.h
Expand Up @@ -265,6 +265,7 @@
#define PL_scopestack (vTHX->Iscopestack)
#define PL_scopestack_ix (vTHX->Iscopestack_ix)
#define PL_scopestack_max (vTHX->Iscopestack_max)
#define PL_scopestack_name (vTHX->Iscopestack_name)
#define PL_screamfirst (vTHX->Iscreamfirst)
#define PL_screamnext (vTHX->Iscreamnext)
#define PL_secondgv (vTHX->Isecondgv)
Expand Down Expand Up @@ -581,6 +582,7 @@
#define PL_Iscopestack PL_scopestack
#define PL_Iscopestack_ix PL_scopestack_ix
#define PL_Iscopestack_max PL_scopestack_max
#define PL_Iscopestack_name PL_scopestack_name
#define PL_Iscreamfirst PL_screamfirst
#define PL_Iscreamnext PL_screamnext
#define PL_Isecondgv PL_secondgv
Expand Down
3 changes: 3 additions & 0 deletions intrpvar.h
Expand Up @@ -43,6 +43,9 @@ PERLVAR(Istack_base, SV **)
PERLVAR(Istack_max, SV **)

PERLVAR(Iscopestack, I32 *) /* scopes we've ENTERed */
#ifdef DEBUGGING
PERLVAR(Iscopestack_name, const char * *) /* name of the scopes we've ENTERed */
#endif
PERLVAR(Iscopestack_ix, I32)
PERLVAR(Iscopestack_max,I32)

Expand Down
3 changes: 3 additions & 0 deletions perl.c
Expand Up @@ -3813,6 +3813,9 @@ Perl_init_stacks(pTHX)
SET_MARK_OFFSET;

Newx(PL_scopestack,REASONABLE(32),I32);
#ifdef DEBUGGING
Newx(PL_scopestack_name,REASONABLE(32),const char*);
#endif
PL_scopestack_ix = 0;
PL_scopestack_max = REASONABLE(32);

Expand Down
2 changes: 2 additions & 0 deletions perlapi.h
Expand Up @@ -566,6 +566,8 @@ END_EXTERN_C
#define PL_scopestack_ix (*Perl_Iscopestack_ix_ptr(aTHX))
#undef PL_scopestack_max
#define PL_scopestack_max (*Perl_Iscopestack_max_ptr(aTHX))
#undef PL_scopestack_name
#define PL_scopestack_name (*Perl_Iscopestack_name_ptr(aTHX))
#undef PL_screamfirst
#define PL_screamfirst (*Perl_Iscreamfirst_ptr(aTHX))
#undef PL_screamnext
Expand Down
16 changes: 8 additions & 8 deletions pp.c
Expand Up @@ -4523,9 +4523,9 @@ PP(pp_splice)
*MARK-- = SvTIED_obj(MUTABLE_SV(ary), mg);
PUSHMARK(MARK);
PUTBACK;
ENTER;
ENTER_with_name("call_SPLICE");
call_method("SPLICE",GIMME_V);
LEAVE;
LEAVE_with_name("call_SPLICE");
SPAGAIN;
RETURN;
}
Expand Down Expand Up @@ -4719,9 +4719,9 @@ PP(pp_push)
*MARK-- = SvTIED_obj(MUTABLE_SV(ary), mg);
PUSHMARK(MARK);
PUTBACK;
ENTER;
ENTER_with_name("call_PUSH");
call_method("PUSH",G_SCALAR|G_DISCARD);
LEAVE;
LEAVE_with_name("call_PUSH");
SPAGAIN;
}
else {
Expand Down Expand Up @@ -4768,9 +4768,9 @@ PP(pp_unshift)
*MARK-- = SvTIED_obj(MUTABLE_SV(ary), mg);
PUSHMARK(MARK);
PUTBACK;
ENTER;
ENTER_with_name("call_UNSHIFT");
call_method("UNSHIFT",G_SCALAR|G_DISCARD);
LEAVE;
LEAVE_with_name("call_UNSHIFT");
SPAGAIN;
}
else {
Expand Down Expand Up @@ -5330,9 +5330,9 @@ PP(pp_split)
}
else {
PUTBACK;
ENTER;
ENTER_with_name("call_PUSH");
call_method("PUSH",G_SCALAR|G_DISCARD);
LEAVE;
LEAVE_with_name("call_PUSH");
SPAGAIN;
if (gimme == G_ARRAY) {
I32 i;
Expand Down

0 comments on commit d343c3e

Please sign in to comment.