Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [PATCH v2 5/6] Guile QUIT processing updates
Date: Sun, 22 Aug 2021 16:20:02 -0700	[thread overview]
Message-ID: <20210822231959.184061-6-kevinb@redhat.com> (raw)
In-Reply-To: <20210822231959.184061-1-kevinb@redhat.com>

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


  parent reply	other threads:[~2021-08-22 23:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-22 23:19 [PATCH v2 0/6] glibc-2.34: Fix gdb.base/gdb-sigterm.exp failure/error Kevin Buettner via Gdb-patches
2021-08-22 23:19 ` [PATCH v2 1/6] Handle recursive internal problem in gdb_internal_error_resync Kevin Buettner via Gdb-patches
2021-09-27 17:38   ` Pedro Alves
2022-02-26 20:40     ` Kevin Buettner via Gdb-patches
2021-08-22 23:19 ` [PATCH v2 2/6] Handle gdb SIGTERM via normal QUIT processing Kevin Buettner via Gdb-patches
2021-09-27 17:39   ` Pedro Alves
2021-08-22 23:20 ` [PATCH v2 3/6] Catch and (re)throw gdb_exception_quit Kevin Buettner via Gdb-patches
2021-09-27 18:05   ` Pedro Alves
2021-08-22 23:20 ` [PATCH v2 4/6] Python QUIT processing updates Kevin Buettner via Gdb-patches
2021-09-27 18:24   ` Pedro Alves
2021-08-22 23:20 ` Kevin Buettner via Gdb-patches [this message]
2021-09-27 18:26   ` [PATCH v2 5/6] Guile " Pedro Alves
2021-08-22 23:20 ` [PATCH v2 6/6] QUIT processing w/ explicit sync_quit_force_run check Kevin Buettner via Gdb-patches
2021-09-27 18:34   ` Pedro Alves
2021-09-27 17:20 ` [PATCH v2 0/6] glibc-2.34: Fix gdb.base/gdb-sigterm.exp failure/error Kevin Buettner via Gdb-patches

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

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

  git send-email \
    --in-reply-to=20210822231959.184061-6-kevinb@redhat.com \
    --to=gdb-patches@sourceware.org \
    --cc=kevinb@redhat.com \
    /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