From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id iOfhIbZbg2PjeQEAbAwnHQ (envelope-from ) for ; Sun, 27 Nov 2022 13:44:38 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 7Q7EIbZbg2OpUQEA9RJhRA (envelope-from ) for ; Sun, 27 Nov 2022 13:44:38 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2F7A6F793 for ; Sun, 27 Nov 2022 13:44:38 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ozGzv-0002sx-TV; Sun, 27 Nov 2022 07:43:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ozGzu-0002sh-Po for guix-devel@gnu.org; Sun, 27 Nov 2022 07:43:02 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ozGzs-0004kZ-AI; Sun, 27 Nov 2022 07:43:02 -0500 Received: by mail-wr1-x435.google.com with SMTP id n3so12889157wrp.5; Sun, 27 Nov 2022 04:42:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=suT9AWh3YWJGM6/WnSjTsH2ThrK00PbM1BMLDhg9n+A=; b=MXV/+vxdPo9O2jXOUlCAtsRfBIXCovl3GBVZKW00tMpzywW4AQnQkIlh87wm781SCl ehCHYXWUURi74q3ja/Il957CL+ZKqb+PUqPlJnm1eGT9KC04HXiylylLG6uw8nDJVpe1 3d3uJcesZAhDG+SJBRvz3iRc7IZlqx5lZAsbf7tV6AmhAyjuxZ5U/ECWHG52L5Rh9pF/ tUzpsnXCO6YOMCc4NSCsjxNttYZb0cT7Ht1lAI6WeywcScchqnqVafm2wZnmp5FF5g8A 9EQ+p4uQBCYTucXyPtmCP8xPa1vfRDdoDHgnbnM63WiGdDU4AnG6bQ6rFBy18Ln4zFbZ VsQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=suT9AWh3YWJGM6/WnSjTsH2ThrK00PbM1BMLDhg9n+A=; b=5dLwKclIMqcqD0r1s9HZINq5u3cILrNm37RTIVVJzdPDQ4/x/3kpqR15a5Mn39AZLK swava9rblQYSH7MRXs8mkt+bwwTgiOnmfZ+koriUpMTLZsv1wi2zcVh5DjOLHabnmQcK DNDltrXWcXP/UJSMYtEZfbhgF8FHKW9xm1JzBZjI8S6BCVqu9LNBW2cuhyq+RoiM6lDc o50QFccBP4FLMqyQcG/QP1vlGfMXt8n3F0VpzJD8BysZsAHbFkpFpEmq6QVMs/RSpMhQ ub93L+Ba2CB3GDW2vqDTLwahYDBBOKXi9hy+XTJ0wUy+C9GjwGp8wcZ2cpWFH2IgL1B1 0VVA== X-Gm-Message-State: ANoB5plN3GVc9B5nre3tUpkIV+UwTVHTtPZgJukT9NLTm4SribsT9orI AIkVeHRpTUew0QLQIgSlTEj+86Lrio4= X-Google-Smtp-Source: AA0mqf5edxBMoH59S/dn0qBTfL5Sxw7B8gS3MfI+5jHKKX4CCqS79o1jQ1n2D+dgrgo9n/CM98Xg6Q== X-Received: by 2002:adf:f843:0:b0:241:bcae:987f with SMTP id d3-20020adff843000000b00241bcae987fmr17952079wrq.619.1669552977540; Sun, 27 Nov 2022 04:42:57 -0800 (PST) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id n5-20020a05600c4f8500b003c6c4639ac6sm13389490wmq.34.2022.11.27.04.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Nov 2022 04:42:56 -0800 (PST) From: zimoun To: Ludovic =?utf-8?Q?Court=C3=A8s?= , Maxim Cournoyer Cc: guix-devel Subject: Re: Guile debugger workgroup? In-Reply-To: <87fse69czr.fsf@gnu.org> Date: Sun, 27 Nov 2022 13:04:22 +0100 Message-ID: <86o7ss1u49.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=zimon.toutoune@gmail.com; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1669553078; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=suT9AWh3YWJGM6/WnSjTsH2ThrK00PbM1BMLDhg9n+A=; b=ZiDHbrGNszMukzyAwzyZXqRNrtoKbp1xEJGJge6/TPgFuZpXYxwYcVI4XEp3ttwMRJeDQ5 ddK+s6iANML9LgRzU1fLrrzKMVy8k8d2/FAsNKbUDxjV2u3HzGevERDAzWFZpCi54ahGUP 0i9gRzbxCXyHc7SWeDQW0YjFIxesw6sJNR19gEq5LBSeCNdPpoqQpEsjqGCA3PNkVRuBS1 3yitEFmhBn1/UK1GxXWC4wALfCWLR/5LXHnrpbYaIFnHnKN0ALgngIWzbPNG7uUAnQjvHa NzR+mxc2/V+I0vh5VWGBaPstx++UHyf5ez5fengQhpqkMCDWxkx0mX3jZuzMsg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1669553078; a=rsa-sha256; cv=none; b=iIPF1jX0GZUjXCLMUkxUVmZAgMPDoDhPA8Eb+xRo2YLucIjDecOKskO74C8ptB4QkKOpR/ E5ibBAk0h3oehlopdoMYVQx80yp86b2SJ4L74h5IINgVzHcswR/qnFCuJLPjBLwWBypMhI HtLNzLTfdSHmsLoI5R58Mb6/tcRFYaz3yQZOTpQBstqwmitTWDyXZ2CuFyN4NEcs8x7NCa EJ3/wAj//J4RDjXi3T2UAMxCrRcfouesDT4V5rE2NnYy75adho/tln1tr1E7qc7CxPotm8 lniGbA35t19cQz27z8C8Dc3QZUvVPB7pXy5lGZ2tg9b2V46ZMzb/+uehZKyVgw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="MXV/+vxd"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.96 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="MXV/+vxd"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 2F7A6F793 X-Spam-Score: -2.96 X-Migadu-Scanner: scn0.migadu.com X-TUID: KixqIrhbOKsY Hi Ludo, On Sat, 26 Nov 2022 at 12:22, Ludovic Court=C3=A8s wrote: > Well, Guile has a debugger that lets you do that (modulo inlining etc., > as with any other compiler), and Geiser is not Visual Studio=E2=84=A2 but= it > does a good job. And you wrote elsewhere in the thread: It may be more of a limitation of Geiser than of Guile. I find it more useful in =E2=80=9Ctypical=E2=80=9D imperative ELisp code t= han in functional Scheme code, but it=E2=80=99d be nice to have either way! Maybe I am wrong or miss some Guile features. From my experience, the issue is not the way that the information is presented or how we interact with it (Geiser or else) but, instead, the issue is the availability of such information. And that is one limitation of Guile, IMHO. > Also, I think I mentioned before that I almost never use breakpoints on > Guile code=E2=80=94not because of some deficiency of the debugger, not (j= ust) > because I=E2=80=99m silly or inexperienced, but because it=E2=80=99s rare= ly the right > tool for the job. That=E2=80=99s interesting. :-) Well, so you are using the good ol=E2=80=99= way putting =E2=80=99pk=E2=80=99 here or there, right? One thing when debugging is to = inspect the current state of the program; what are the values of this or that, then after running this other, etc. And, =E2=80=99pk=E2=80=99 is the poor man breakpoint. :-) > I believe this is largely due to (1) writing functional code, and (2) > doing live programming at the REPL. Why would you use breakpoints when > you can just call the relevant procedures on some input to see how they > behave? Well, I do not think you are not using breakpoint with Guile because the code is functional style. My guess is more that you have built your way around the limitations of the Guile debugger. For what this example is worth, I know people with 30+ years of experience programming highly optimized C code and they never used GDB or Valgrind or strace or else for debugging. Doing all debugging with plain =E2=80=99printf=E2=80=99. Well, because when they started, GDB and f= riends were less efficient, other folk around were not used to these tools, etc. And so they took habits without. > So I think you won=E2=80=99t convince people to pick Guile for their proj= ect by > selling it as a C/C++/Python drop-in replacement. Guile is about > functional programming and live coding so the set of tools differs. Racket is an example of functional programming and live coding. Haskell is another; it is functional programming and if I might, I would recommend to give a look at the interactive GHCi debugger [1]. Back to the initial example [2]. Racket is able to set breakpoints at various places, as shown in the short demo [3]. Well, I am not able to do that with Guile. --8<---------------cut here---------------start------------->8--- $ cat -n my-target.scm 1 ;#lang racket 2=09 3 (define (mutate-once x) 4 (let ((once "once") 5 (dash "-")) 6 (string-append x dash once))) 7=09 8 (define (mutate-twice x) 9 (let* ((dash "-") 10 (twice "twice") 11 (stuff (string-append twice dash))) 12 (string-append "twice-" x))) 13=09 14 (define (do-something-with x) 15 (string-length x)) 16=09 17 (define (example x) 18 (let* ((my-target "something") 19 (my-target (mutate-once my-target)) 20 (my-target (mutate-twice my-target))) 21 (do-something-with my-target))) --8<---------------cut here---------------end--------------->8--- then, --8<---------------cut here---------------start------------->8--- $ guix repl GNU Guile 3.0.8 Copyright (C) 1995-2021 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guix-user)> (load "my-target.scm") scheme@(guix-user)> ,break-at-source "my-target.scm" 17 While executing meta-command: No procedures found at ~a:~a. "my-target.scm" 17 scheme@(guix-user)> ,break-at-source "/home/simon/tmp/my-target.scm" 17 While executing meta-command: No procedures found at ~a:~a. "/home/simon/tmp/my-target.scm" 17 scheme@(guix-user)> (example #t) $1 =3D 20 scheme@(guix-user)> ,break example Trap 2: Breakpoint at #. scheme@(guix-user)> (example #t) $2 =3D 20 scheme@(guix-user)> --8<---------------cut here---------------end--------------->8--- How can I enter in the debugger? Do I only enter on error? Well, I end to put =E2=80=99pk=E2=80=99 here and there to inspect the code. Poor exper= ience. :-) Just to compare with Haskell (functional style, where it is hard nor impossible to put equivalent of =E2=80=99pk=E2=80=99 here or there :-)) =E2= =80=93 the code is the equivalent as above. --8<---------------cut here---------------start------------->8--- 1 mutate_once x =3D x ++ dash ++ once 2 where 3 once =3D "once" 4 dash =3D "-" 5=09 6 mutate_twice x =3D stuff ++ x 7 where 8 dash =3D "-" 9 twice =3D "once" 10 stuff =3D twice ++ dash 11=09 12 do_something_with x =3D length x 13=09 14 example x =3D do_something_with my_target 15 where 16 my_target =3D mutate_twice my_target 17 where 18 my_target =3D mutate_once my_target 19 where 20 my_target =3D "something" --8<---------------cut here---------------end--------------->8--- then, --8<---------------cut here---------------start------------->8--- $ guix shell ghc gcc-toolchain -- ghci GHCi, version 8.10.7: https://www.haskell.org/ghc/ :? for help Prelude> :load my-target.hs [1 of 1] Compiling Main ( my-target.hs, interpreted ) Ok, one module loaded. *Main> :break 14 Breakpoint 0 activated at my-target.hs:14:13-39 *Main> example True Stopped in Main.example, my-target.hs:14:13-39 _result :: Int =3D _ my_target :: [Char] =3D _ [my-target.hs:14:13-39] *Main> :list 13=20=20 14 example x =3D do_something_with my_target ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 15 where [my-target.hs:14:13-39] *Main> :break 18 Breakpoint 1 activated at my-target.hs:18:21-41 [my-target.hs:14:13-39] *Main> :continue Stopped in Main.example.my_target.my_target, my-target.hs:18:21-41 _result :: [Char] =3D _ my_target :: [Char] =3D _ [my-target.hs:18:21-41] *Main> :list 17 where 18 my_target =3D mutate_once my_target ^^^^^^^^^^^^^^^^^^^^^ 19 where [my-target.hs:18:21-41] *Main> my_target "something" [my-target.hs:18:21-41] *Main> --8<---------------cut here---------------end--------------->8--- Well, again maybe I miss how to use the Guile debugger. From my small experience, I have hard time to debug and inspect Guile code. 1: 2: 3: Short video demoing (link will be dead after 2022-12-07) https://filesender.renater.fr/?s=3Ddownload&token=3D92d4312a-91b4-402e-8= 98a-40ce01a5c3ed Cheers, simon