Skip to content

Commit c0e07b3

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

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Parameters.xs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,24 @@ 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+
RStore_U32 *rs = p;
281+
*rs->where = rs->what;
282+
Safefree(rs);
283+
}
284+
285+
static void sentinel_save_u32(Sentinel sen, U32 *pu) {
286+
RStore_U32 *rs;
287+
Newx(rs, 1, RStore_U32);
288+
rs->where = pu;
289+
rs->what = *pu;
290+
sentinel_register(sen, rs, resource_store_u32);
291+
}
274292

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

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

2391+
PL_perldb |= prev_db_line;
2392+
23682393
/* finally let perl parse the actual subroutine body */
23692394
body = parse_block(0);
23702395

0 commit comments

Comments
 (0)