From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Amirouche Newsgroups: gmane.lisp.guile.user Subject: Re: Stack traces Date: Sat, 18 Feb 2017 20:59:46 +0100 Message-ID: References: <87h93wto3y.fsf_-_@gnu.org> <87mvdn4gam.fsf@dustycloud.org> <641f554a-3672-d71a-78cd-f32f5287f98d@hypermove.net> <34F40DF4-899A-4400-A2F6-820EFB3C66FD@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1487448024 17369 195.159.176.226 (18 Feb 2017 20:00:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 18 Feb 2017 20:00:24 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 Cc: guile-user@gnu.org To: Matt Wette Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Feb 18 21:00:20 2017 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cfBB4-0003rQ-WB for guile-user@m.gmane.org; Sat, 18 Feb 2017 21:00:19 +0100 Original-Received: from localhost ([::1]:59696 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cfBB8-0000d6-Tw for guile-user@m.gmane.org; Sat, 18 Feb 2017 15:00:22 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cfBAc-0000bi-16 for guile-user@gnu.org; Sat, 18 Feb 2017 14:59:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cfBAb-0006IL-2W for guile-user@gnu.org; Sat, 18 Feb 2017 14:59:50 -0500 Original-Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:47797) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cfBAa-0006Hj-TN for guile-user@gnu.org; Sat, 18 Feb 2017 14:59:49 -0500 Original-Received: from [IPv6:2a01:e35:2ef3:d930:b81a:1aa8:923d:8c5b] (unknown [IPv6:2a01:e35:2ef3:d930:b81a:1aa8:923d:8c5b]) (Authenticated sender: amirouche@hypermove.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id C974C17209B; Sat, 18 Feb 2017 20:59:45 +0100 (CET) In-Reply-To: <34F40DF4-899A-4400-A2F6-820EFB3C66FD@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4b98:c:538::196 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:13292 Archived-At: Le 18/02/2017 à 17:58, Matt Wette a écrit : >> On Feb 18, 2017, at 7:53 AM, Amirouche wrote: >> Le 18/02/2017 à 16:50, Amirouche a écrit : >>> Le 18/02/2017 à 01:13, Matt Wette a écrit : >>>> (use-modules (system repl repl)) >>>> (use-modules (system repl debug)) >>>> >>>> (define-syntax-rule (trap-here) >>>> (start-repl >>>> #:debug (make-debug (stack->vector (make-stack #t)) 0 "trap!" #t))) >>>> >>>> (define (foo) >>>> (let iter ((sum 0) (vals '(1 2 3 5 8 2))) >>>> (trap-here) >>>> (if (null? vals) sum >>>> (iter (+ sum (car vals)) (cdr vals))))) >>>> >>>> (foo) >>> It looks like that. Except `iter` should be defined in the namespace of the REPL. >> Maybe iter is complicated, but at least sum and vals. > Hmm. The procedure “foo” without the "(trap-here)” is just a simple program (using named let) that I want to debug. > So I add the “(trap-here)” to get into the debugger at that spot in the program, like I would add “pdb.set_trace()” in python. > > Matt > How do you access variables in the REPL?