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:20:12 -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 1409685666 12623 80.91.229.3 (2 Sep 2014 19:21:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 2 Sep 2014 19:21:06 +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:20:58 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 1XOtdR-0004dL-SQ for guile-user@m.gmane.org; Tue, 02 Sep 2014 21:20:57 +0200 Original-Received: from localhost ([::1]:39866 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOtdR-0004wm-FE for guile-user@m.gmane.org; Tue, 02 Sep 2014 15:20:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOtcz-0004tO-KP for guile-user@gnu.org; Tue, 02 Sep 2014 15:20:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOtcq-00019H-NR for guile-user@gnu.org; Tue, 02 Sep 2014 15:20:29 -0400 Original-Received: from na3sys009aog103.obsmtp.com ([74.125.149.71]:50868) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOtcq-00015d-Ff for guile-user@gnu.org; Tue, 02 Sep 2014 15:20:20 -0400 Original-Received: from mail-pa0-f45.google.com ([209.85.220.45]) (using TLSv1) by na3sys009aob103.postini.com ([74.125.148.12]) with SMTP ID DSNKVAYYbBcJWSoSztZlIQsQy5bckZWeINU7@postini.com; Tue, 02 Sep 2014 12:20:19 PDT Original-Received: by mail-pa0-f45.google.com with SMTP id bj1so15326239pad.4 for ; Tue, 02 Sep 2014 12:20:12 -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=3m3D0p7GipeqJqtkY74m9PIc6HrMhu7XIjYUZOOpJiM=; b=l5tqyyq/ZRBvoTNargijdxngpdVeIKiAk64BfRvrjn7YrSGapfU2B+Y7LMwet5r+bO MqPD+8IG3qLCelsgYwLB3xzE9g7Kd7lNPF9McNOwYGhh2vLETO7XQFznhfnADS7vCKN0 /yalUY3+f74606DDbt9qipzwvNWjbyD/PnOtrvJwqMSsRFs5lO/SqXwOn1k6FnRaV+Il tf0Q2LT7hCikUsZW/PexX2nvNqCdCGDljMuE3M6KNMb/IDOObu+RRgwqQUyHAVo+lBqc C1Mb+wLgLlnO+wk8cNQ4YcMAXexc8mzsFqDOsKfaQQtC4iTWaHl8vx3t9qXWU+Sw4lXh YwzA== X-Gm-Message-State: ALoCoQm4pzqhQrdvT/LqkzoC0Z4mfybKgFutTFKersyWRPktZOwoLESN3HDQ6iUtb4WRnj3fiyPDHNbP9M7M9Ih9NWqz+asX3+P2IKNSOk01FiWJm7EWeH5E+iJ7XuRz4NBlZ6fvHgEf89nA4Qxbnt3hfKiYvKn96w== X-Received: by 10.68.65.36 with SMTP id u4mr22624893pbs.127.1409685612253; Tue, 02 Sep 2014 12:20:12 -0700 (PDT) X-Received: by 10.68.65.36 with SMTP id u4mr22624873pbs.127.1409685612129; Tue, 02 Sep 2014 12:20:12 -0700 (PDT) Original-Received: by 10.70.33.237 with HTTP; Tue, 2 Sep 2014 12:20:12 -0700 (PDT) In-Reply-To: <82egvtdeul.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 74.125.149.71 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:11444 Archived-At: 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. Additionally, I noticed that the (system repl debug) module has this at the bottom of the file: ;; (define (debug) ;; (run-debugger ;; (narrow-stack->vector ;; (make-stack #t) ;; ;; Narrow the `make-stack' frame and the `debug' frame ;; 2 ;; ;; Narrow the end of the stack to the most recent start-stack. ;; (and (pair? (fluid-ref %stacks)) ;; (cdar (fluid-ref %stacks)))))) I'm guess it no longer functions, but maybe it will help you! - Dave