From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Matt Wette Newsgroups: gmane.lisp.guile.devel,gmane.lisp.guile.user Subject: Break-when [was GNU Guile 2.1.7 released (beta)] Date: Thu, 23 Feb 2017 16:52:08 -0800 Message-ID: <9137232F-0A6A-4E77-B14F-C1367F5AA72E@gmail.com> References: <87y3x3zt6v.fsf@pobox.com> <87tw7kviu6.fsf@pobox.com> <1253648402.3519089.1487880266545@mail.yahoo.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_0141792C-9C60-45E1-B16B-C5FB707F1A54" X-Trace: blaine.gmane.org 1487897553 7920 195.159.176.226 (24 Feb 2017 00:52:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 24 Feb 2017 00:52:33 +0000 (UTC) To: guile-devel , guile-user@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Feb 24 01:52:25 2017 Return-path: Envelope-to: guile-devel@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 1ch47S-0000wg-Hy for guile-devel@m.gmane.org; Fri, 24 Feb 2017 01:52:22 +0100 Original-Received: from localhost ([::1]:33923 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ch47W-0004zJ-TZ for guile-devel@m.gmane.org; Thu, 23 Feb 2017 19:52:26 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43053) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ch47P-0004l3-3v for guile-devel@gnu.org; Thu, 23 Feb 2017 19:52:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ch47M-0002hX-3s for guile-devel@gnu.org; Thu, 23 Feb 2017 19:52:19 -0500 Original-Received: from mail-pg0-x236.google.com ([2607:f8b0:400e:c05::236]:35908) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ch47L-0002gi-Rh; Thu, 23 Feb 2017 19:52:16 -0500 Original-Received: by mail-pg0-x236.google.com with SMTP id s67so3372738pgb.3; Thu, 23 Feb 2017 16:52:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:mime-version:subject:date:references:to:in-reply-to:message-id; bh=YBJ0ykBlEIjiAgLcrAw0+N+3ZcSZNSXsNK43DxtPW8Q=; b=l9tezZrvPDGxr8K4hnO0CuTRfWUa0sK954/E0oinwhQVp+spCjO0xWKcoWeiTl8aB0 57K8K0R4cdnrUby8LKQ2INBd9y7LeD+lv8vTlFqFyI1B3hZX2OlhttCjW/FKMxtMXBHh RsdduE1x922OLq5SHrMKiM/8TRBZ0WrdRKfbbyUvny5JNm06WBz+rSKcrfBXR3xAi2KG 8IOfzdVIwq4ttQsMfaiE4lqhIpeq5g0Y9MogLGwMWmN4zBvPYbzatWS1hEL6fSs+5Ick XTk0VO4wFRNwOGrgOf9QrBkGFJvg9nW8O+ks7vyVshtuBwgjUeWNA/xL2QWqqBjkOkyE m/VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:date:references:to :in-reply-to:message-id; bh=YBJ0ykBlEIjiAgLcrAw0+N+3ZcSZNSXsNK43DxtPW8Q=; b=PdBF8K39Hf9+W6B1LCy2HU5ePw4g8boS2CTKZrxDKvs975DTJcYEFpvtQcx7z6/Gjv VKGPj/ASCwH1HZh3g3zLiGL+GagfR2pRpXaOMuvU9rdsjtMSdMMvmBDyeUHJjX002tF0 jOFnsiJGwWTbFbKP+KtPGg4FQk7H7EeAFantgHEwxIQw/9wX/CB9gJMQHNi0l7jgoZuc hAFHhXFFYnlwr53KDtQiW1MoOHGqbWXgKqfXrNpira99DUqFWzf7wYp97a1yhJiAeTTq TCMXNRfeFxLDKiGIub28epELLgOCBFhPbWxe+TZWgWUuKJcaMs8hpY2BWcauhMZIbpyM iA/Q== X-Gm-Message-State: AMke39nHJ3QC4Irebc4UZe8nNZ24D60bJptX3+j1BKbKXifRvsK440EZ4YxV84FNtX5/fg== X-Received: by 10.84.209.204 with SMTP id y70mr57867426plh.69.1487897532730; Thu, 23 Feb 2017 16:52:12 -0800 (PST) Original-Received: from nautilus.championbroadband.com (216-165-246-244.championbroadband.com. [216.165.246.244]) by smtp.gmail.com with ESMTPSA id f66sm8188291pfj.132.2017.02.23.16.52.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Feb 2017 16:52:11 -0800 (PST) In-Reply-To: <1253648402.3519089.1487880266545@mail.yahoo.com> X-Mailer: Apple Mail (2.3259) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::236 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.lisp.guile.devel:18946 gmane.lisp.guile.user:13318 Archived-At: --Apple-Mail=_0141792C-9C60-45E1-B16B-C5FB707F1A54 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Feb 23, 2017, at 12:04 PM, Mike Gran wrote: >=20 > * Some helper funcs for debugging. For example, I just found > out (after a decade) that Guile comes with its own pk. Also, > a "break REPL here when condition is true" procedure would > be great. I've sometimes rolled my own with ",break acos" and > adding (acos 0.0) for the location in question. >=20 I am playing with this. Now reading through system/repl/* and = system/vm/* to understand the debugger. Try (use-modules (system repl repl)) (use-modules (system repl debug)) (define-syntax-rule (trap-here-0) (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-0) (cond ((null? vals) sum) (else (iter (+ sum (car vals)) (cdr vals)))))) (foo) I have added some debugger commands:=20 ,loc - show current location ,qq - really quit (calls primitive-exit) scheme@(guile-user) [1]> ,loc (let iter ((sum 0) (vals '(1 2 3 5 8 2))) * (trap-here-0) (cond scheme@(guile-user) [1]> ,qq mwette$=20 --Apple-Mail=_0141792C-9C60-45E1-B16B-C5FB707F1A54 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
On Feb 23, 2017, at 12:04 PM, Mike Gran <spk121@yahoo.com> = wrote:

* Some helper = funcs for debugging.  For example, I just found
=  out (after a decade) that Guile comes with its own pk. =  Also,
 a "break REPL here when condition is = true" procedure would
 be great.  I've = sometimes rolled my own with ",break acos" and
=  adding (acos 0.0) for the location in question.


I= am playing with this.  Now reading through system/repl/* and = system/vm/* to understand the debugger.

Try

(use-modules (system repl = repl))
(use-modules (system repl = debug))

(define-syntax-rule (trap-here-0)
  = (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-0)
    (cond
     ((null? vals) sum)
     (else (iter (+ sum (car vals)) (cdr = vals))))))

(foo)

I have = added some debugger commands: 
,loc - = show current location
,qq - really quit (calls = primitive-exit)

scheme@(guile-user) [1]> ,loc
  =     (let iter ((sum 0) (vals '(1 2 3 5 8 2)))
* =       (trap-here-0)
  =       (cond
scheme@(guile-user) [1]> ,qq
mwette$ 

= --Apple-Mail=_0141792C-9C60-45E1-B16B-C5FB707F1A54--