From patchwork Sun Mar 15 17:00:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 20686 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id B6A9027BBEB; Sun, 15 Mar 2020 17:02:09 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 7E57827BBEA for ; Sun, 15 Mar 2020 17:02:09 +0000 (GMT) Received: from localhost ([::1]:56160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDWeO-0001xE-Mg for patchwork@mira.cbaines.net; Sun, 15 Mar 2020 13:02:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54088) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDWdO-0001qt-BN for guix-patches@gnu.org; Sun, 15 Mar 2020 13:01:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDWdM-0006pw-G2 for guix-patches@gnu.org; Sun, 15 Mar 2020 13:01:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:57660) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jDWdL-0006lj-AP for guix-patches@gnu.org; Sun, 15 Mar 2020 13:01:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jDWdK-0001jl-99 for guix-patches@gnu.org; Sun, 15 Mar 2020 13:01:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#40077] [PATCH 0/4] Inferior provide stack traces along with exceptions Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 15 Mar 2020 17:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 40077 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 40077@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15842916356636 (code B ref -1); Sun, 15 Mar 2020 17:01:02 +0000 Received: (at submit) by debbugs.gnu.org; 15 Mar 2020 17:00:35 +0000 Received: from localhost ([127.0.0.1]:35399 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDWct-0001ix-EM for submit@debbugs.gnu.org; Sun, 15 Mar 2020 13:00:35 -0400 Received: from lists.gnu.org ([209.51.188.17]:59475) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jDWcs-0001iq-4p for submit@debbugs.gnu.org; Sun, 15 Mar 2020 13:00:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53534) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDWcq-0001cl-7o for guix-patches@gnu.org; Sun, 15 Mar 2020 13:00:33 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54996) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jDWcp-00043i-KT; Sun, 15 Mar 2020 13:00:31 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=41128 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jDWcp-0000L7-6p; Sun, 15 Mar 2020 13:00:31 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sun, 15 Mar 2020 18:00:19 +0100 Message-Id: <20200315170019.22544-1-ludo@gnu.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches 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 = #< pid: pipe socket: # close: # version: (0 1 1) packages: #> table: #>> 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: #< pid: pipe socket: # close: # version: (0 1 1) packages: #> table: #>> 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(-)