Skip to content

Commit 7ca8d03

Browse files
committed
disable line debugging for generated code
1 parent 13f4c96 commit 7ca8d03

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Parameters.xs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,25 @@ static SV *sentinel_mortalize(Sentinel sen, SV *sv) {
271271
return sv;
272272
}
273273

274+
DEFSTRUCT(RStore_U32) {
275+
U32 *where;
276+
U32 what;
277+
};
278+
279+
static void resource_store_u32(pTHX_ void *p) {
280+
PERL_UNUSED_CONTEXT;
281+
RStore_U32 *rs = p;
282+
*rs->where = rs->what;
283+
Safefree(rs);
284+
}
285+
286+
static void sentinel_save_u32(Sentinel sen, U32 *pu) {
287+
RStore_U32 *rs;
288+
Newx(rs, 1, RStore_U32);
289+
rs->where = pu;
290+
rs->what = *pu;
291+
sentinel_register(sen, rs, resource_store_u32);
292+
}
274293

275294
#if HAVE_PERL_VERSION(5, 17, 2)
276295
#define MY_OP_SLABBED(O) ((O)->op_slabbed)
@@ -1773,6 +1792,11 @@ static int parse_fun(pTHX_ Sentinel sen, OP **pop, const char *keyword_ptr, STRL
17731792
Perl_croak(aTHX_ "In %"SVf": I was expecting a function body, not \"%c\"", SVfARG(declarator), (int)c);
17741793
}
17751794

1795+
/* turn off line debugging for generated code */
1796+
sentinel_save_u32(sen, &PL_perldb);
1797+
const U32 prev_db_line = PL_perldb & PERLDBf_LINE;
1798+
PL_perldb &= ~PERLDBf_LINE;
1799+
17761800
/* surprise predeclaration! */
17771801
if (saw_name && !spec->install_sub && !(spec->flags & FLAG_RUNTIME)) {
17781802
/* 'sub NAME (PROTO);' to make name/proto known to perl before it
@@ -2365,6 +2389,8 @@ static int parse_fun(pTHX_ Sentinel sen, OP **pop, const char *keyword_ptr, STRL
23652389
}
23662390
}
23672391

2392+
PL_perldb |= prev_db_line;
2393+
23682394
/* finally let perl parse the actual subroutine body */
23692395
body = parse_block(0);
23702396

0 commit comments

Comments
 (0)