From: Kevin Buettner via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Cc: pedro@palves.net, Kevin Buettner <kevinb@redhat.com>,
Tom de Vries <tdevries@suse.de>
Subject: [PATCH v5 5/8] Guile QUIT processing updates
Date: Wed, 22 Feb 2023 16:46:10 -0700 [thread overview]
Message-ID: <20230222234613.29662-6-kevinb@redhat.com> (raw)
In-Reply-To: <20230222234613.29662-1-kevinb@redhat.com>
This commit contains QUIT processing updates for GDB's Guile support.
As with the Python updates, we don't want to permit this code to
swallow the exception, gdb_exception_forced_quit, which is associated
with GDB receiving a SIGTERM.
I've adopted the same solution that I used for Python; whereever
a gdb_exception is caught in try/catch code in the Guile extension
language support, a catch for gdb_exception_forced_quit has been
added; this catch block will simply call quit_force(), which will
cause the necessary cleanups to occur followed by GDB exiting.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=26761
Tested-by: Tom de Vries <tdevries@suse.de>
---
gdb/guile/guile-internal.h | 5 +++++
gdb/guile/scm-pretty-print.c | 5 +++++
gdb/guile/scm-type.c | 5 +++++
gdb/guile/scm-value.c | 5 +++++
gdb/top.h | 2 +-
5 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h
index 42ecb3c24f9..b04ef17a5ad 100644
--- a/gdb/guile/guile-internal.h
+++ b/gdb/guile/guile-internal.h
@@ -29,6 +29,7 @@
#include "symtab.h"
#include "libguile.h"
#include "objfiles.h"
+#include "top.h" /* For quit_force(). */
struct block;
struct frame_info;
@@ -704,6 +705,10 @@ gdbscm_wrap (Function &&func, Args &&... args)
{
result = func (std::forward<Args> (args)...);
}
+ catch (const gdb_exception_forced_quit &e)
+ {
+ quit_force (NULL, 0);
+ }
catch (const gdb_exception &except)
{
exc = unpack (except);
diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c
index e172a14dbb3..ae56758b2bc 100644
--- a/gdb/guile/scm-pretty-print.c
+++ b/gdb/guile/scm-pretty-print.c
@@ -21,6 +21,7 @@
conventions, et.al. */
#include "defs.h"
+#include "top.h" /* For quit_force(). */
#include "charset.h"
#include "symtab.h" /* Needed by language.h. */
#include "language.h"
@@ -558,6 +559,10 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value,
(_("invalid result from pretty-printer to-string"), result);
}
}
+ catch (const gdb_exception_forced_quit &except)
+ {
+ quit_force (NULL, 0);
+ }
catch (const gdb_exception &except)
{
}
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index da16d22990c..008e792cc34 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -21,6 +21,7 @@
conventions, et.al. */
#include "defs.h"
+#include "top.h" /* For quit_force(). */
#include "arch-utils.h"
#include "value.h"
#include "gdbtypes.h"
@@ -132,6 +133,10 @@ tyscm_type_name (struct type *type)
&type_print_raw_options);
return stb.release ();
}
+ catch (const gdb_exception_forced_quit &except)
+ {
+ quit_force (NULL, 0);
+ }
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 ac948dcd1a2..32a9539b3e2 100644
--- a/gdb/guile/scm-value.c
+++ b/gdb/guile/scm-value.c
@@ -21,6 +21,7 @@
conventions, et.al. */
#include "defs.h"
+#include "top.h" /* For quit_force(). */
#include "arch-utils.h"
#include "charset.h"
#include "cp-abi.h"
@@ -416,6 +417,10 @@ gdbscm_value_address (SCM self)
{
address = vlscm_scm_from_value (value_addr (value));
}
+ catch (const gdb_exception_forced_quit &except)
+ {
+ quit_force (NULL, 0);
+ }
catch (const gdb_exception &except)
{
}
diff --git a/gdb/top.h b/gdb/top.h
index 9f9a0281be4..5a1352ef81c 100644
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -236,7 +236,7 @@ extern void read_command_file (FILE *);
extern void init_history (void);
extern void command_loop (void);
extern int quit_confirm (void);
-extern void quit_force (int *, int);
+extern void quit_force (int *, int) ATTRIBUTE_NORETURN;
extern void quit_command (const char *, int);
extern void quit_cover (void);
extern void execute_command (const char *, int);
--
2.34.3
next prev parent reply other threads:[~2023-02-22 23:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-22 23:46 [PATCH v5 0/8] Fix gdb.base/gdb-sigterm.exp failure/error Kevin Buettner via Gdb-patches
2023-02-22 23:46 ` [PATCH v5 1/8] Introduce gdb_exception_forced_quit Kevin Buettner via Gdb-patches
2023-02-22 23:46 ` [PATCH v5 2/8] Handle gdb SIGTERM by throwing / catching gdb_exception_force_quit Kevin Buettner via Gdb-patches
2023-03-02 20:14 ` Simon Marchi via Gdb-patches
2023-02-22 23:46 ` [PATCH v5 3/8] Catch gdb_exception_error instead of gdb_exception (in many places) Kevin Buettner via Gdb-patches
2023-02-22 23:46 ` [PATCH v5 4/8] Python QUIT processing updates Kevin Buettner via Gdb-patches
2023-02-22 23:46 ` Kevin Buettner via Gdb-patches [this message]
2023-02-22 23:46 ` [PATCH v5 6/8] QUIT processing w/ explicit throw for gdb_exception_forced_quit Kevin Buettner via Gdb-patches
2023-02-22 23:46 ` [PATCH v5 7/8] Introduce set_force_quit_flag and change type of sync_quit_force_run Kevin Buettner via Gdb-patches
2023-02-22 23:46 ` [PATCH v5 8/8] Forced quit cases handled by resetting sync_quit_force_run Kevin Buettner via Gdb-patches
2023-02-23 13:01 ` [PATCH v5 0/8] Fix gdb.base/gdb-sigterm.exp failure/error Pedro Alves
2023-02-27 23:22 ` 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=20230222234613.29662-6-kevinb@redhat.com \
--to=gdb-patches@sourceware.org \
--cc=kevinb@redhat.com \
--cc=pedro@palves.net \
--cc=tdevries@suse.de \
/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