From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrew Whatson Newsgroups: gmane.lisp.guile.devel Subject: [PATCH] Avoid 'frame-local-ref' errors when printing backtrace. Date: Thu, 22 Sep 2022 23:53:59 +1000 Message-ID: <20220922135358.22139-1-whatson@gmail.com> References: <56d1283b-ac09-8f62-8657-de99578e1a6c@telenet.be> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23972"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Andrew Whatson To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Thu Sep 22 16:43:50 2022 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1obNQb-000608-0W for guile-devel@m.gmane-mx.org; Thu, 22 Sep 2022 16:43:49 +0200 Original-Received: from localhost ([::1]:53558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obNQZ-0004Or-QA for guile-devel@m.gmane-mx.org; Thu, 22 Sep 2022 10:43:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obMfG-0000Uo-DV for guile-devel@gnu.org; Thu, 22 Sep 2022 09:54:54 -0400 Original-Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:35388) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obMfD-0008Cg-71 for guile-devel@gnu.org; Thu, 22 Sep 2022 09:54:54 -0400 Original-Received: by mail-pl1-x62f.google.com with SMTP id t3so8869084ply.2 for ; Thu, 22 Sep 2022 06:54:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=1LTPUt/kHpM8fdP18rojTfdfS2yC0X8Itd8OQ1XA2P8=; b=TIC4rtyc8M7oYOgb+rULKZvGWy3kS/rjKbEGU9JzF96NBdLs2dnaaCPFA+PJWbB8br +xjFHpscvDwczLWx/PW50Rple34vW/7jQ6ETupJ3VbY6TGvDT86yOTpDKak1iN75rHfj Yw88egxUsskJh/3cv8qCcv1sIQwx+UZ7/+aECFSKfb0tPTct7fnikRjcCQ1EZ9wHuznO PsVtyTOD2QQrggTqM5GDNiyi/anEl2JUkexai1GHRUnIV/qcPiq24epygq2koo6mB32B YhoQ/bw5Mk6RgXQJE711X9k8isJiE22h4gYBOh8WAyEC0BEx/5rW9maG1HZq8JNDEEV9 AK4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=1LTPUt/kHpM8fdP18rojTfdfS2yC0X8Itd8OQ1XA2P8=; b=ns9Md1zrxdeUYF6gzIetijK/8nmrYCloTYVTi1l+260xuakyjH1oNkzQzZELSYouoH bKGnppQJCce9qFJqVO+fdu2yoehP8pJXLvBoEHRKr3ePhrX8kIdNOJumpt9g6BJcnjV/ omhrM2gPoxi6lH5cxsmbr8YZJT4NMvfKvEq8qRneam/dyBgU07SYVze5xk54HwvCkBaV kUjRKuHobCOMwpd4fsFoy3UaTZ2WUf4NiLiiDyOUfilPxZZFzKjCFKHRT2RO2BQI/+ic DAjboHZQ9hJeR2oz68g/1DeFZ7aKSCeReboH/OxavsdNLsQgiIlja8xIGS6cV/AaMH0G DXLw== X-Gm-Message-State: ACrzQf2lKzlFXLnAoogOPMQpq7yCTYHrxgpdMLDTUierI9AwLx1bczAC ZQmPsDw+DYOAJAqCSnpnCIzvQ1jYzGA= X-Google-Smtp-Source: AMsMyM5MWdG9OBNOnxEyAP2OX7aRzV0Haopzc9ld0mPU+1Qm4ghDKQiK5dWdmOSUd0Mw+MsKs/o3BQ== X-Received: by 2002:a17:90a:db8b:b0:203:1de7:eaaf with SMTP id h11-20020a17090adb8b00b002031de7eaafmr15778278pjv.168.1663854886174; Thu, 22 Sep 2022 06:54:46 -0700 (PDT) Original-Received: from fumo.fritz.box (eft1854679.lnk.telstra.net. [101.187.131.186]) by smtp.gmail.com with ESMTPSA id x20-20020aa78f14000000b00540dbae6272sm4397198pfr.213.2022.09.22.06.54.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 06:54:45 -0700 (PDT) X-Mailer: git-send-email 2.37.3 In-Reply-To: <56d1283b-ac09-8f62-8657-de99578e1a6c@telenet.be> Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=whatson@gmail.com; helo=mail-pl1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:21364 Archived-At: Workaround for . * module/system/vm/frame.scm (frame-call-representation): Treat a binding as "unspecified" if its slot exceeds 'frame-num-locals'. --- module/system/vm/frame.scm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/module/system/vm/frame.scm b/module/system/vm/frame.scm index 3be73e29c..e36eb797c 100644 --- a/module/system/vm/frame.scm +++ b/module/system/vm/frame.scm @@ -381,8 +381,16 @@ (frame-local-ref frame i 'scm)) ((find-slot i bindings) => (lambda (binding) - (let ((val (frame-local-ref frame (binding-slot binding) - (binding-representation binding)))) + (let* ((slot (binding-slot binding)) + ;; HACK: Avoid out-of-range from frame-local-ref. + ;; Some frames have bindings beyond nlocals. That + ;; is probably a bug somewhere else, but at least + ;; this workaround allows them to be printed. + ;; See . + (val (if (< slot nlocals) + (frame-local-ref frame slot + (binding-representation binding)) + *unspecified*))) ;; It could be that there's a value that isn't clobbered ;; by a call but that isn't live after a call either. In ;; that case, if GC runs during the call, the value will -- 2.37.3