Skip to content

Commit

Permalink
Fix Backtrace view on what frames it considers "interesting"
Browse files Browse the repository at this point in the history
What is coming from 'NQPCORE.setting' and 'BOOTSTRAP/v6?' is now
considered part of the setting. The former fixes uses of `NQPLock`.
The latter – frames from withing dispatchers, for example.

Don't stop building trace when any `NQP::` file is encountered. Relying
on the prefix alone was causing frames, following calls to
`NQPLock.protect` in the trace, to be skipped until (if we are lucky) a
`SETTING::` prefix found. This fix (and I hope this is a fix, not a
regression) makes the trace to skip only frames after method `eval` in
`NQPHLL/Compiler.nqp`.
  • Loading branch information
vrurg committed Sep 27, 2023
1 parent 7a43c12 commit 04a3127
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/core.c/Backtrace.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ my class Backtrace::Frame {
|| $!file ~~ / "CORE." \w+ ".setting" $ /
#?endif
#?if !jvm
|| $!file ~~ / "CORE." \w+ ".setting.{ Rakudo::Internals.PRECOMP-EXT }" $ /
|| $!file ~~ / [ "CORE." \w+ ".setting"
| "NQPCORE.setting"
| "BOOTSTRAP/v6" \w ]
".{ Rakudo::Internals.PRECOMP-EXT }" $ /
#?endif
|| $!file.ends-with(".nqp")
}
Expand Down Expand Up @@ -171,9 +174,11 @@ my class Backtrace {
next if $file.ends-with('BOOTSTRAP.nqp')
|| $file.ends-with('QRegex.nqp')
|| $file.ends-with('Perl6/Ops.nqp');
if $file.ends-with('NQPHLL.nqp')

my $name := nqp::p6box_s(nqp::getcodename($do));

if ($file.starts-with('NQP::') && $file.ends-with('Compiler.nqp') && $name eq 'eval')
|| $file.ends-with('NQPHLL.moarvm')
|| $file.starts-with('NQP::')
{
# This could mean we're at the end of the interesting backtrace,
# or it could mean that we're in something like sprintf (which
Expand All @@ -195,7 +200,6 @@ my class Backtrace {
my $line := $annotations<line>;
next unless $line;

my $name := nqp::p6box_s(nqp::getcodename($do));
if $name eq 'handle-begin-time-exceptions' {
$!bt-next = $elems;
last;
Expand Down

0 comments on commit 04a3127

Please sign in to comment.