develooper Front page | perl.perl5.changes | Postings from August 2022

[Perl/perl5] 6dacde: deb.c - when PL_copline is NOLINE show 0 not2^32-1.

From:
Yves Orton via perl5-changes
Date:
August 28, 2022 07:07
Subject:
[Perl/perl5] 6dacde: deb.c - when PL_copline is NOLINE show 0 not2^32-1.
Message ID:
Perl/perl5/push/refs/heads/yves/deb_c_noline_fix/03352f-6dacde@github.com
  Branch: refs/heads/yves/deb_c_noline_fix
  Home:   https://github.com/Perl/perl5
  Commit: 6dacde6e70aa89d33e9b44e2c00050775261d8fb
      https://github.com/Perl/perl5/commit/6dacde6e70aa89d33e9b44e2c00050775261d8fb
  Author: Yves Orton <demerphq@gmail.com>
  Date:   2022-08-28 (Sun, 28 Aug 2022)

  Changed paths:
    M deb.c

  Log Message:
  -----------
  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





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About