From 04a3127569b266951b2daef440b6dd525b1b5ca5 Mon Sep 17 00:00:00 2001 From: Vadim Belman Date: Wed, 27 Sep 2023 17:44:00 -0400 Subject: [PATCH] Fix Backtrace view on what frames it considers "interesting" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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`. --- src/core.c/Backtrace.rakumod | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/core.c/Backtrace.rakumod b/src/core.c/Backtrace.rakumod index fe20cd4cfe7..74f45ff0256 100644 --- a/src/core.c/Backtrace.rakumod +++ b/src/core.c/Backtrace.rakumod @@ -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") } @@ -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 @@ -195,7 +200,6 @@ my class Backtrace { my $line := $annotations; next unless $line; - my $name := nqp::p6box_s(nqp::getcodename($do)); if $name eq 'handle-begin-time-exceptions' { $!bt-next = $elems; last;