From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id wBBVL+/cImEkGwAAWB0awg (envelope-from ) for ; Sun, 22 Aug 2021 19:25:35 -0400 Received: by simark.ca (Postfix, from userid 112) id C053F1EE18; Sun, 22 Aug 2021 19:25:35 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 24E1F1E813 for ; Sun, 22 Aug 2021 19:25:35 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C6F80385C41A for ; Sun, 22 Aug 2021 23:25:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C6F80385C41A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1629674734; bh=haFmRxac7PpbK7YzU/WlPe+mMBqCOdDiWjSHoxuBwe0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=tDf8oQ4ADbVYKC5LRNEvEIuBT4U95JKWUtiBnjLCGvvlYAaMGm4EgWq6WPSt3iSfy 2oZndkUrdsY9yAthuum65MOdBNCAc7Q+vQve9rWFkefb4hI5rYOkQDieSKSdtHnEnp L6LOFiGSQpRsqYE2hgomM8guhsQs4P4U+8v9wL/k= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 28F523854834 for ; Sun, 22 Aug 2021 23:24:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 28F523854834 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-580-w6vCE4qJNCCS8snYjT8VIQ-1; Sun, 22 Aug 2021 19:24:23 -0400 X-MC-Unique: w6vCE4qJNCCS8snYjT8VIQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9BE023639F for ; Sun, 22 Aug 2021 23:24:22 +0000 (UTC) Received: from f34-1.lan (ovpn-112-47.phx2.redhat.com [10.3.112.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7775B10013C1; Sun, 22 Aug 2021 23:24:22 +0000 (UTC) To: gdb-patches@sourceware.org Subject: [PATCH v2 5/6] Guile QUIT processing updates Date: Sun, 22 Aug 2021 16:20:02 -0700 Message-Id: <20210822231959.184061-6-kevinb@redhat.com> In-Reply-To: <20210822231959.184061-1-kevinb@redhat.com> References: <20210822231959.184061-1-kevinb@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Kevin Buettner via Gdb-patches Reply-To: Kevin Buettner Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" This commit contains QUIT processing updates for GDB's Guile support. As with the Python updates, we want the extension language to be able to handle Ctrl-C / SIGINT if it wants, but we don't want to allow it to swallow a SIGTERM. This commit changes gdbscm_throw_gdb_exception to check for sync_quit_force_run, throwing a suitable exception when it is set. (Note that a gdbscm_gdb_exception must be converted to a gdb_exception.) The other changes are straightforward: catch blocks for gdb_exception_quit are added in a few places. --- gdb/guile/scm-exception.c | 4 ++++ gdb/guile/scm-pretty-print.c | 4 ++++ gdb/guile/scm-type.c | 4 ++++ gdb/guile/scm-value.c | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/gdb/guile/scm-exception.c b/gdb/guile/scm-exception.c index b62eaebfda6..97ee6a4e53e 100644 --- a/gdb/guile/scm-exception.c +++ b/gdb/guile/scm-exception.c @@ -456,6 +456,10 @@ gdbscm_scm_from_gdb_exception (const gdbscm_gdb_exception &exception) void gdbscm_throw_gdb_exception (gdbscm_gdb_exception exception) { + /* Throw to higher level for SIGTERM sent to GDB. */ + if (sync_quit_force_run) + throw_quit ("%s", exception.message); + SCM scm_exception = gdbscm_scm_from_gdb_exception (exception); xfree (exception.message); gdbscm_throw (scm_exception); diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c index 96a3ef584c9..7ac5bff8d6c 100644 --- a/gdb/guile/scm-pretty-print.c +++ b/gdb/guile/scm-pretty-print.c @@ -558,6 +558,10 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value, (_("invalid result from pretty-printer to-string"), result); } } + catch (const gdb_exception_quit &except) + { + GDBSCM_HANDLE_GDB_EXCEPTION (unpack (except)); + } catch (const gdb_exception &except) { } diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c index d65102b01c7..564d574beb9 100644 --- a/gdb/guile/scm-type.c +++ b/gdb/guile/scm-type.c @@ -111,6 +111,10 @@ tyscm_type_name (struct type *type) LA_PRINT_TYPE (type, "", &stb, -1, 0, &type_print_raw_options); return std::move (stb.string ()); } + catch (const gdb_exception_quit &except) + { + GDBSCM_HANDLE_GDB_EXCEPTION (unpack (except)); + } catch (const gdb_exception &except) { excp = gdbscm_scm_from_gdb_exception (unpack (except)); diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c index d4d76df0411..d1962e1a562 100644 --- a/gdb/guile/scm-value.c +++ b/gdb/guile/scm-value.c @@ -416,6 +416,10 @@ gdbscm_value_address (SCM self) { address = vlscm_scm_from_value (value_addr (value)); } + catch (const gdb_exception_quit &except) + { + GDBSCM_HANDLE_GDB_EXCEPTION (unpack (except)); + } catch (const gdb_exception &except) { } -- 2.31.1