From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Zelphir Kaltstahl Newsgroups: gmane.lisp.guile.user Subject: Re: How do people debug their guile code? Date: Tue, 8 Sep 2020 22:15:44 +0200 Message-ID: References: <877dt4kvw2.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40280"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Icedove/68.10.0 Cc: guile-user@gnu.org To: Fredrik Salomonsson Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Tue Sep 08 22:21:55 2020 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kFk7m-000ANz-G7 for guile-user@m.gmane-mx.org; Tue, 08 Sep 2020 22:21:54 +0200 Original-Received: from localhost ([::1]:36866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFk7l-0004Sz-Hy for guile-user@m.gmane-mx.org; Tue, 08 Sep 2020 16:21:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47084) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFk1v-00047g-6C for guile-user@gnu.org; Tue, 08 Sep 2020 16:15:51 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:34213) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFk1s-00061E-Ul for guile-user@gnu.org; Tue, 08 Sep 2020 16:15:50 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 73E9E2400FB for ; Tue, 8 Sep 2020 22:15:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1599596145; bh=TvOjBsYAjcko+ynYvLZVJ3hoxJkHV0ndzOzqionA/T8=; h=Subject:To:Cc:From:Date:From; b=BFDKEdiMpiVU94gjoPbOJQ+Tzvddp1BNg6Z0+iWTfbHkUClofMnzpxTcgZ3mDtc9M BMDxtevW/iP+2Fojdy+n27Wniwrm9gRjcA7cZ8nZMB9Yz/utGuMZdis7J8RTt50PuG hrie5UyCoNqDZeXqZ4i3uA9pi+wAEgvwSMv7vwIQevYXZz1xOx3g5yGcW+x+DGYwe3 HbqHKqj7ODMJsPfl2iJqck81v2PLc5CuT2sT1VVOdWb2x+8JbCY4o+1WXnGqlCo728 4ESYmYxtB0NGuu9o9uyl0YSmtWgkb3zP1Toq51fF90bp3MVuKXrrOU84AqW361kxd8 xyQOC1poBw8vw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4BmGcJ6YDyz9rxP; Tue, 8 Sep 2020 22:15:44 +0200 (CEST) In-Reply-To: <877dt4kvw2.fsf@posteo.net> Content-Language: en-US Received-SPF: pass client-ip=185.67.36.66; envelope-from=zelphirkaltstahl@posteo.de; helo=mout02.posteo.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 15:52:49 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -36 X-Spam_score: -3.7 X-Spam_bar: --- X-Spam_report: (-3.7 / 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, NICE_REPLY_A=-1.626, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:16894 Archived-At: Hi Fredrik! On 08.09.20 19:42, Fredrik Salomonsson wrote: > Hi again, > > I recently asked about something similar but more Emacs specific in the= > thread "Debug=C2=A0setup=C2=A0in=C2=A0Emacs". But it seems there are so= me more work to > be done to get it properly hooked up with Emacs' GUD. I asked a follow > up question how people debug their code and got as suggestion that it > might be better to create a separate thread for it. > > So here it is. > > I'm fairly new with guile (hence why I ask about this). My workflow (in= > other languages) is usually to write tests, then when something goes > wrong I hook up a debugger and step through the code. > > For guile I've been just writing tests and when something goes wrong I > sprinkle (format=C2=A0#t=C2=A0...) and re-run the tests. I haven't dabb= led that > much in running the REPL as I haven't figured out a good way of setting= > up the same environment as when I run the tests (using guile-hall). I've not used guile-hall yet, nor tested with it. However, what I do to reproduce the same environment as I have in srfi-64 unit test, but inside the REPL is the following: 1. start the Guile REPL with `guile -L ` 2. run `(use-modules ())` 3. use procedures defined inside the module 4. copy and paste changed or new definitions from the code 5. try out the definitions and if something goes wrong fix it and go back to step 4 again If running M-x run-guile or M-x run-geiser from Emacs, one might need to change the %load-path of Guile. This can be done with `(add-to-load-path )` for example. Then one can proceed as described above again. Not sure if any of this is new to you, but I guessed it would be good to put it out there. > What I gathered from the "Debug=C2=A0setup=C2=A0in=C2=A0Emacs" thread. = Is to sprinkle > print out statements using the "format" or "simple-format" procedure. > > Use the "pk" procedure. > > Use the REPL if the setup is easy enough, combined with the use of > trace. > > And to write tests. > > So I'm curious if there are other workflows/steps people use/take? > > Thanks Regards, Zelphir --=20 repositories: https://notabug.org/ZelphirKaltstahl