Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reapply squashed "avoid identical stack traces" patches
This reapplies two reverted patches as a single squashed commit. Revert "Revert "avoid identical stack traces"" This reverts commit 79f75ea which itself reverted f2f32cd Revert "Revert "fixup to "avoid identical stack traces" - try 2"" This reverts commit 2abf7ef which itself reverted ad89278 Original Author: David Mitchell <davem@iabyn.com> Original Date: Fri Dec 13 13:48:25 2019 +0000 avoid identical stack traces GH #15109 The output of caller() (e.g. as produced by carp::Confess) produces multiple identical outputs when within a nested use/require. This is because at the time of calling the 'BEGIN { require ... }', PL_curcop is set to &PL_compiling, which is a fixed buffer within the interpreter, whose individual file and line fields are saved and restored when doing a new require/eval. This means that within the innermost require, PL_compiling has file:lineno of the innermost source file, and multiple saved PL_curcop values in the context stack frames all point to the same &PL_copmpiling. So all levels of the stack trace appear to come from the innermost file. This commit fixes this (after a fashion) by, at the start of calling a BEGIN, making PL_curcop point to a temporary copy of PL_compiling instead. This is all a bit of a hack.
- Loading branch information
Showing
7 changed files
with
87 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# for use by caller.t for GH #15109 | ||
package Apack; | ||
use Bpack; | ||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# for use by caller.t for GH #15109 | ||
package Bpack; | ||
use Cpack; | ||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# for use by caller.t for GH #15109 | ||
package Cpack; | ||
|
||
|
||
my $i = 0; | ||
|
||
while (my ($package, $file, $line) = caller($i++)) { | ||
push @Cpack::callers, "$file:$line"; | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# for use by caller.t for GH #15109 | ||
|
||
package Foo; | ||
|
||
sub import { | ||
use warnings; # restore default warnings | ||
() = caller(1); # this used to cause valgrind errors | ||
} | ||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters