unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>
To: Fredrik Salomonsson <plattfot@posteo.net>
Cc: guile-user@gnu.org
Subject: Re: How do people debug their guile code?
Date: Tue, 8 Sep 2020 22:15:44 +0200	[thread overview]
Message-ID: <e047f76a-58a5-7dfb-09ee-f817221e6324@posteo.de> (raw)
In-Reply-To: <877dt4kvw2.fsf@posteo.net>

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 setup in Emacs". But it seems there are some 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 #t ...) and re-run the tests. I haven't dabbled 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 <dir where my module is>`
2. run `(use-modules (<my module name>))`
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
<string path to dir containing my module>)` 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 setup in Emacs" 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

-- 
repositories: https://notabug.org/ZelphirKaltstahl





  reply	other threads:[~2020-09-08 20:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-08 17:42 How do people debug their guile code? Fredrik Salomonsson
2020-09-08 20:15 ` Zelphir Kaltstahl [this message]
2020-09-08 22:12   ` Fredrik Salomonsson
2020-09-08 20:48 ` Jeremy Korwin-Zmijowski
2020-09-08 21:52 ` Aleix Conchillo Flaqué

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e047f76a-58a5-7dfb-09ee-f817221e6324@posteo.de \
    --to=zelphirkaltstahl@posteo.de \
    --cc=guile-user@gnu.org \
    --cc=plattfot@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).