From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Thompson, David" Newsgroups: gmane.lisp.guile.user Subject: Re: Entering the interactive debugger Date: Tue, 2 Sep 2014 15:57:03 -0400 Message-ID: References: <82egvtdeul.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1409687894 9598 80.91.229.3 (2 Sep 2014 19:58:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 2 Sep 2014 19:58:14 +0000 (UTC) Cc: Guile User To: Carlos Pita Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Sep 02 21:58:04 2014 Return-path: Envelope-to: guile-user@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 1XOuDL-0008Ix-TF for guile-user@m.gmane.org; Tue, 02 Sep 2014 21:58:04 +0200 Original-Received: from localhost ([::1]:39986 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOuDL-0007rL-IJ for guile-user@m.gmane.org; Tue, 02 Sep 2014 15:58:03 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37679) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOuCW-0006tk-U9 for guile-user@gnu.org; Tue, 02 Sep 2014 15:57:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOuCP-0004Dq-EV for guile-user@gnu.org; Tue, 02 Sep 2014 15:57:12 -0400 Original-Received: from na3sys009aog111.obsmtp.com ([74.125.149.205]:59436) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOuCP-0004DW-7t for guile-user@gnu.org; Tue, 02 Sep 2014 15:57:05 -0400 Original-Received: from mail-pa0-f52.google.com ([209.85.220.52]) (using TLSv1) by na3sys009aob111.postini.com ([74.125.148.12]) with SMTP ID DSNKVAYhEOqgF76gxK2zibysH6XJstXehQ0u@postini.com; Tue, 02 Sep 2014 12:57:04 PDT Original-Received: by mail-pa0-f52.google.com with SMTP id eu11so15557001pac.11 for ; Tue, 02 Sep 2014 12:57:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=XoIzkYliHxbclF1aosc2NwQLsdlJuiJhuuoTMb3hfvY=; b=jJH08sONDPoVnHsHPi6+jey6k4QJkGVC0eO8eg5S8iiH2LxA31tiuWZeSSIEyQx15S a3pKaRF8BsIBNIMRmWP4RpbcysI3MRV5zyshudkUjz/VppNnW7+nK9Rs1VFk5GQetu6G uqSU4S8M9fyQqtaUJyP9wM/ubNMrkDnTCfpOmjiyiEtS7aWDXgi7s/DyJzuvKMqiHhdt mDWuPOf3sKya6jsb3h4+J1JFVue8eU11qsICQqSQVWdsoI8lvvgMuA/lbnhXhmfyOH7C FgwKTUEOhaLuXgdvnu3lg+1+3MdIEhlw8Hsmcx93Zb/BJGtTRkRFDPGUvLst7/MoH1Z4 yBBQ== X-Gm-Message-State: ALoCoQmABd/Y5wGkPirKcp77Iv/PVTPfnbqIONpLi9txA6doLn6aeGN6wOCVwc1OY2XzDD8Hmbm0ANBDR3oopUnUB9gElcFV3VKBl/5e7sdTEKOzIGf+zsv0TitcJZpxYV68rFjPq5qWutbvC+HSuRGiawXtgH6voQ== X-Received: by 10.70.91.35 with SMTP id cb3mr11214804pdb.127.1409687823441; Tue, 02 Sep 2014 12:57:03 -0700 (PDT) X-Received: by 10.70.91.35 with SMTP id cb3mr11214792pdb.127.1409687823276; Tue, 02 Sep 2014 12:57:03 -0700 (PDT) Original-Received: by 10.70.33.237 with HTTP; Tue, 2 Sep 2014 12:57:03 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 74.125.149.205 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 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-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:11445 Archived-At: On Tue, Sep 2, 2014 at 3:20 PM, Thompson, David wrote: > On Tue, Sep 2, 2014 at 3:03 PM, Carlos Pita wrote: >> Hi all, although I have some experience with lisps, I'm still new to >> guile and I'm having some trouble figuring out how to invoke the >> interactive debugger at some arbitrary point in my code. Something like: >> >> ; code here >> (debug) >> ; more code here >> >> The closer solution I could find in the manual is: >> >> add-trap-at-source-location! file user-line >> >> Any suggestion? > > I don't know of any straightforward solution, but I would also like > such a feature. I don't think it would be too difficult to write a > 'debug' procedure using the 'debug-trap-handler' procedure in (system > repl error-handling) as inspiration. Basically, you'd need to capture > the current stack and spawn a new REPL in debug mode that uses that > stack. > The stack isn't properly narrowed because I couldn't figure out how to make narrow-stack->vector do what I wanted, but here's a 'debug' procedure that worked for me. (use-modules (system repl repl) (system repl debug)) (define (debug) (let ((stack (narrow-stack->vector (make-stack #t)))) (start-repl #:debug (make-debug stack 0 "Entered debugger" #f)))) - Dave