From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Noah Lavine Newsgroups: gmane.lisp.guile.devel Subject: Broken Backtraces, and Part of a Solution Date: Wed, 18 Apr 2012 20:02:07 -0400 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1334793740 19374 80.91.229.3 (19 Apr 2012 00:02:20 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 19 Apr 2012 00:02:20 +0000 (UTC) To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Apr 19 02:02:19 2012 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SKepE-000866-BC for guile-devel@m.gmane.org; Thu, 19 Apr 2012 02:02:16 +0200 Original-Received: from localhost ([::1]:46647 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKepD-0004ks-L1 for guile-devel@m.gmane.org; Wed, 18 Apr 2012 20:02:15 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58041) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKepB-0004kn-AU for guile-devel@gnu.org; Wed, 18 Apr 2012 20:02:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SKep8-0000Km-K7 for guile-devel@gnu.org; Wed, 18 Apr 2012 20:02:12 -0400 Original-Received: from mail-iy0-f169.google.com ([209.85.210.169]:39053) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKep8-0000Ke-Bn for guile-devel@gnu.org; Wed, 18 Apr 2012 20:02:10 -0400 Original-Received: by iajr24 with SMTP id r24so13860856iaj.0 for ; Wed, 18 Apr 2012 17:02:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=bYeAq6Mb3AUuQyzo8k/QZWpMJQlsLR3QBpX5JTACgEA=; b=te2I9lgzQKK5aAIWl8rM/+MsxPf2oW9mNEudhU50XWVT03vIL87QWnKNhIKt8OtkyR Ru+DJ8XPFukoxZDEoD2T4oM11zzCAPbshMQ9G/q3s5IyvOFOLZTEJsQoUZIAMYrPyTxQ G/TDW+nJbZCTCMNml02efxSReJFteEMqbZdFXrOSQvEU1ffIFoS+k3NiOsEglYGj5UTt OVE0ml8pPND91cg429WrmTF1K7vw4ZPyDoseFlIxUwyJFwxHVDrVyBc8WfnyYpmuRnvQ asgrbYnQKgikWt83cNbNUsDxq32rabBDDr75gERJU04k1wetxektjUXgBzPp8jDmO/s3 XZSA== Original-Received: by 10.50.154.169 with SMTP id vp9mr18364igb.71.1334793727768; Wed, 18 Apr 2012 17:02:07 -0700 (PDT) Original-Received: by 10.42.29.200 with HTTP; Wed, 18 Apr 2012 17:02:07 -0700 (PDT) X-Google-Sender-Auth: oZKL7V33DrG9uZ-BdaWwFPWFTgU X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.210.169 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:14281 Archived-At: Hello all, I recently realized that backtraces weren't working for me in the most recent build of Guile master. Specifically, I could get to a debug prompt fine, but when I tried to get a backtrace, it always came up empty. The problem happens in this code in module/system/repl/error-handling.scm: (let* ((tag (and (pair? (fluid-ref %stacks)) (cdar (fluid-ref %stacks)))) (stack (narrow-stack->vector (make-stack #t) ;; Cut three frames from the top of the stack: ;; make-stack, this one, and the throw handler. 3 ;; Narrow the end of the stack to the most recent ;; start-stack. tag ;; And one more frame, because %start-stack invoking ;; the start-stack thunk has its own frame too. 0 (and tag 1))) (error-msg (error-string stack key args)) (debug (make-debug stack 0 error-msg #f))) (note: there are two instances of almost exactly the same code. the problem I see happens at the second instance, but the first would probably be the same) The problem is that narrow-stack->vector returns #(). It does this because the stack is narrowed to nothing. The narrowing really happens in the functions scm_make_stack and narrow_stack, in stacks.c. The reason it narrows to nothing is the third argument to narrow-stack->vector, tag. On my Guile build, tag evaluates to '("start-stack"). The code is trying to use the tag to trim extra frames off of the stack, but we can only trim with procedures, symbols, and integers. The fallback behavior is to eliminate the entire stack, which is what we see here. It's possible to solve this problem by using %start-stack instead of '("start-stack"), but that doesn't seem to be as general as the solution in this function. Instead, here's a question - why are we using (cdar (fluid-ref %stacks)) to get the stack tag, and what was someone expecting that to return when they wrote it? Thanks, Noah