aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorKevin Buettner <kevinb@redhat.com>2023-02-27 16:11:37 -0700
committerKevin Buettner <kevinb@redhat.com>2023-02-27 16:20:39 -0700
commit53f1f3d4aa7019a159d939b7bd2a27a93d630fda (patch)
tree5ebbd72f3dc6866bd22b5da6c6cec49ca26fc9c2 /gdb
parentb940a061c0d549dbe981463414da87cb84a8a9bb (diff)
downloadbinutils-53f1f3d4aa7019a159d939b7bd2a27a93d630fda.zip
binutils-53f1f3d4aa7019a159d939b7bd2a27a93d630fda.tar.gz
binutils-53f1f3d4aa7019a159d939b7bd2a27a93d630fda.tar.bz2
Guile QUIT processing updates
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> Approved-By: Pedro Alves <pedro@palves.net>
Diffstat (limited to 'gdb')
-rw-r--r--gdb/guile/guile-internal.h5
-rw-r--r--gdb/guile/scm-pretty-print.c5
-rw-r--r--gdb/guile/scm-type.c5
-rw-r--r--gdb/guile/scm-value.c5
-rw-r--r--gdb/top.h2
5 files changed, 21 insertions, 1 deletions
diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h
index 42ecb3c..b04ef17 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 e172a14..ae56758 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 da16d22..008e792 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 ac948dc..32a9539 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 4972d5e..5c1ccfe 100644
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -235,7 +235,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);