From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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) From: Kevin Buettner 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-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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: , X-List-Received-Date: Sun, 22 Aug 2021 23:24:26 -0000 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