unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 40077@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#40077] [PATCH 0/4] Inferior provide stack traces along with exceptions
Date: Sun, 15 Mar 2020 18:00:19 +0100	[thread overview]
Message-ID: <20200315170019.22544-1-ludo@gnu.org> (raw)

Hello!

This patch series allows inferiors to provide stack traces when
an exception is thrown.

The wire format needed to be changed to provide that info, and thus
the protocol had to be adjusted to support both forward and backward
compatibility: a new client must be able to talk to an old ‘guix repl’,
and an old client must be able to talk to a new ‘guix repl’.  To that
end, clients now send the protocol version they support.

Note that, with these patches, stack traces are available but inferior
exceptions are not reported more nicely than before:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (open-inferior "/home/ludo/src/guix" #:command "scripts/guix")
$1 = #<<inferior> pid: pipe socket: #<input-output: file 7f08f4404a80> close: #<procedure close-pipe (p)> version: (0 1 1) packages: #<promise #<procedure 7f08f6813040 at guix/inferior.scm:161:32 ()>> table: #<promise #<procedure 7f08f43c6240 at guix/inferior.scm:162:32 ()>>>
scheme@(guile-user)> (inferior-eval '(throw 'x 'y 'z) $1)
ice-9/boot-9.scm:1669:16: In procedure raise-exception:
ERROR:
  1. &inferior-exception:
      arguments: (x y z)
      inferior: #<<inferior> pid: pipe socket: #<input-output: string 7f08f4404a80> close: #<procedure close-pipe (p)> version: (0 1 1) packages: #<promise #<procedure 7f08f6813040 at guix/inferior.scm:161:32 ()>> table: #<promise #<procedure 7f08f43c6240 at guix/inferior.scm:162:32 ()>>>
      stack: ((#f ("ice-9/boot-9.scm" 1763 13)) (raise-exception ("ice-9/boot-9.scm" 1668 16)) (#f (#f #f #f)) (#f ("guix/repl.scm" 92 21)) (with-exception-handler ("ice-9/boot-9.scm" 1735 10)) (with-exception-handler ("ice-9/boot-9.scm" 1730 15)) (#f ("guix/repl.scm" 119 7)))

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
--8<---------------cut here---------------end--------------->8---

This is left as an exercise to the reader.

Feedback welcome!

Ludo’.

Ludovic Courtès (4):
  repl: Allow clients to send their protocol version.
  inferior: Adjust to protocol (0 1).
  repl: Return stack traces along with exceptions.
  inferior: '&inferior-exception' includes a stack trace.

 guix/inferior.scm  | 24 +++++++++++--
 guix/repl.scm      | 86 ++++++++++++++++++++++++++++++++++++++--------
 tests/inferior.scm |  3 ++
 3 files changed, 97 insertions(+), 16 deletions(-)

-- 
2.25.1

             reply	other threads:[~2020-03-15 17:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-15 17:00 Ludovic Courtès [this message]
2020-03-15 17:15 ` [bug#40077] [PATCH 1/4] repl: Allow clients to send their protocol version Ludovic Courtès
2020-03-15 17:15   ` [bug#40077] [PATCH 2/4] inferior: Adjust to protocol (0 1) Ludovic Courtès
2020-03-15 17:15   ` [bug#40077] [PATCH 3/4] repl: Return stack traces along with exceptions Ludovic Courtès
2020-03-15 17:15   ` [bug#40077] [PATCH 4/4] inferior: '&inferior-exception' includes a stack trace Ludovic Courtès
2020-03-19 14:15 ` bug#40077: [PATCH 0/4] Inferior provide stack traces along with exceptions Ludovic Courtès

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://guix.gnu.org/

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

  git send-email \
    --in-reply-to=20200315170019.22544-1-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=40077@debbugs.gnu.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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).