diff options
author | Yves Orton <demerphq@gmail.com> | 2022-08-27 13:57:05 +0200 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2022-08-29 20:50:54 +0200 |
commit | e772cf349a3609ba583f441d10e1e92c5e338377 (patch) | |
tree | 488210df2ef1f12ab29edb000d343ca6cee436e3 /deb.c | |
parent | f603e191e0bea582034a16f05909a56bcc05a564 (diff) | |
download | perl-e772cf349a3609ba583f441d10e1e92c5e338377.tar.gz |
deb.c - when PL_copline is NOLINE show 0 not 2^32-1.
NOLINE is defined to be U32_MAX (not sure why it is not 0,
as lines in files by convention are numbered from 1 so 0 should
be an illegal line number), some parts of our code explicitly
set the cop_line to be NOLINE. When we debug we should show this
as line 0, the U32_MAX value is somewhat confusing. We could also
just not show a line at all, but for now this makes more sense,
especially as the deb.c logic was using 0 when there is no curcop.
Without this patch:
$ ./perl -Dl -e'eval "1+;"x10'
(-e:0) ENTER scope 2 (savestack=38) at op.c:10897
(-e:4294967295) LEAVE scope 2 (savestack=46) at op.c:10937
(-e:4294967295) savestack: releasing items 46 -> 38
(-e:0) ENTER scope 2 (savestack=40) at perly.c:289
(-e:1) ENTER scope 3 (savestack=78) at toke.c:4868
With this patch:
$ ./perl -Dl -e'eval "1+;"x10'
(-e:0) ENTER scope 2 (savestack=38) at op.c:10897
(-e:0) LEAVE scope 2 (savestack=46) at op.c:10937
(-e:0) savestack: releasing items 46 -> 38
(-e:0) ENTER scope 2 (savestack=40) at perly.c:289
(-e:1) ENTER scope 3 (savestack=78) at toke.c:4868
This fixes GH Issue #20175
Diffstat (limited to 'deb.c')
-rw-r--r-- | deb.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -87,7 +87,9 @@ Perl_vdeb(pTHX_ const char *pat, va_list *args) #ifdef DEBUGGING const char* const file = PL_curcop ? OutCopFILE(PL_curcop) : "<null>"; const char* const display_file = file ? file : "<free>"; - const long line = PL_curcop ? (long)CopLINE(PL_curcop) : 0; + long line = PL_curcop ? (long)CopLINE(PL_curcop) : NOLINE; + if (line == NOLINE) + line = 0; PERL_ARGS_ASSERT_VDEB; |