public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb: move a bunch of quit-related things to event-top.{c,h}
@ 2024-04-23 15:29 Simon Marchi
  0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2024-04-23 15:29 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e5dc0d5d04e68328242fc171098e78f79589c7b7

commit e5dc0d5d04e68328242fc171098e78f79589c7b7
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date:   Tue Apr 23 09:22:59 2024 -0400

    gdb: move a bunch of quit-related things to event-top.{c,h}
    
    Move some declarations related to the "quit" machinery from defs.h to
    event-top.h.  Most of the definitions associated to these declarations
    are in event-top.c.  The exceptions are `quit()` and `maybe_quit()`,
    that are defined in utils.c.  For consistency, move these two
    definitions to event-top.c.
    
    Include "event-top.h" in many files that use these things.
    
    Change-Id: I6594f6df9047a9a480e7b9934275d186afb14378
    Approved-By: Tom Tromey <tom@tromey.com>

Diff:
---
 gdb/ada-lang.c              |  1 +
 gdb/ada-typeprint.c         |  1 +
 gdb/ada-valprint.c          |  1 +
 gdb/addrmap.c               |  1 +
 gdb/amd64-windows-tdep.c    |  1 +
 gdb/breakpoint.c            |  1 +
 gdb/c-typeprint.c           |  1 +
 gdb/cli/cli-script.c        |  1 +
 gdb/coffread.c              |  1 +
 gdb/corefile.c              |  1 +
 gdb/cp-valprint.c           |  1 +
 gdb/dbxread.c               |  1 +
 gdb/defs.h                  | 44 --------------------------------------
 gdb/disasm.c                |  1 +
 gdb/dwarf2/cooked-index.c   |  1 +
 gdb/dwarf2/expr.c           |  1 +
 gdb/dwarf2/loc.c            |  1 +
 gdb/dwarf2/read-gdb-index.c |  1 +
 gdb/dwarf2/read.c           |  1 +
 gdb/event-top.c             | 48 ++++++++++++++++++++++++++++++++++++++---
 gdb/event-top.h             | 52 +++++++++++++++++++++++++++++++++++++++++++++
 gdb/f-typeprint.c           |  1 +
 gdb/findvar.c               |  1 +
 gdb/frame.c                 |  1 +
 gdb/gdb_bfd.c               |  1 +
 gdb/linux-fork.c            |  1 +
 gdb/m2-lang.c               |  1 +
 gdb/m2-typeprint.c          |  1 +
 gdb/mi/mi-cmd-stack.c       |  1 +
 gdb/objc-lang.c             |  1 +
 gdb/p-lang.c                |  1 +
 gdb/p-typeprint.c           |  1 +
 gdb/printcmd.c              |  1 +
 gdb/psymtab.c               |  1 +
 gdb/remote-fileio.c         |  1 +
 gdb/remote-sim.c            |  1 +
 gdb/rust-lang.c             |  1 +
 gdb/ser-base.c              |  1 +
 gdb/skip.c                  |  1 +
 gdb/solib-rocm.c            |  1 +
 gdb/sparc64-tdep.c          |  1 +
 gdb/stabsread.c             |  1 +
 gdb/stack.c                 |  1 +
 gdb/symmisc.c               |  1 +
 gdb/symtab.c                |  1 +
 gdb/tracepoint.c            |  1 +
 gdb/tui/tui.c               |  1 +
 gdb/utils.c                 | 41 -----------------------------------
 gdb/valops.c                |  1 +
 gdb/valprint.c              |  1 +
 gdb/xcoffread.c             |  1 +
 51 files changed, 144 insertions(+), 88 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 5ab6e8b14b7..e33a746da9e 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -19,6 +19,7 @@
 
 
 #include <ctype.h>
+#include "event-top.h"
 #include "extract-store-integer.h"
 #include "gdbsupport/gdb_regex.h"
 #include "frame.h"
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index deead1055db..915f8b54d50 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -17,6 +17,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "bfd.h"
+#include "event-top.h"
 #include "gdbtypes.h"
 #include "value.h"
 #include "c-lang.h"
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index 6d3fca9bdeb..937bd39e87d 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -18,6 +18,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <ctype.h>
+#include "event-top.h"
 #include "extract-store-integer.h"
 #include "gdbtypes.h"
 #include "expression.h"
diff --git a/gdb/addrmap.c b/gdb/addrmap.c
index c6e037330ec..b9a0f77d5d0 100644
--- a/gdb/addrmap.c
+++ b/gdb/addrmap.c
@@ -17,6 +17,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "gdbsupport/gdb_obstack.h"
 #include "addrmap.h"
 #include "gdbsupport/selftest.h"
diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c
index 3dfc8000533..9636201d13a 100644
--- a/gdb/amd64-windows-tdep.c
+++ b/gdb/amd64-windows-tdep.c
@@ -15,6 +15,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "extract-store-integer.h"
 #include "osabi.h"
 #include "amd64-tdep.h"
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 6d8adc62664..03e073d7879 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -19,6 +19,7 @@
 
 #include "arch-utils.h"
 #include <ctype.h>
+#include "event-top.h"
 #include "hashtab.h"
 #include "symtab.h"
 #include "frame.h"
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index 3e299356308..62cf7219a41 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -16,6 +16,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "gdbsupport/gdb_obstack.h"
 #include "bfd.h"
 #include "symtab.h"
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 2f731807c94..03e0a2e43e3 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -17,6 +17,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "value.h"
 #include <ctype.h>
 
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 327c014a5a4..daae3ffe989 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -17,6 +17,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "symtab.h"
 #include "gdbtypes.h"
 #include "demangle.h"
diff --git a/gdb/corefile.c b/gdb/corefile.c
index 984c7bef880..8caf3bff383 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -19,6 +19,7 @@
 
 #include <signal.h>
 #include <fcntl.h>
+#include "event-top.h"
 #include "extract-store-integer.h"
 #include "inferior.h"
 #include "symtab.h"
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 2e776f40a63..ae28882e178 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -17,6 +17,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "extract-store-integer.h"
 #include "gdbsupport/gdb_obstack.h"
 #include "symtab.h"
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 9faaf0e7381..830dd1cc611 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -31,6 +31,7 @@
    for real.  dbx_psymtab_to_symtab() is the function that does this */
 
 
+#include "event-top.h"
 #include "gdbsupport/gdb_obstack.h"
 #include <sys/stat.h>
 #include "symtab.h"
diff --git a/gdb/defs.h b/gdb/defs.h
index 6f9c0d1f781..11e2190c3e4 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -94,50 +94,6 @@ extern std::string python_libdir;
 /* * Search path for separate debug files.  */
 extern std::string debug_file_directory;
 
-/* The current quit handler (and its type).  This is called from the
-   QUIT macro.  See default_quit_handler below for default behavior.
-   Parts of GDB temporarily override this to e.g., completely suppress
-   Ctrl-C because it would not be safe to throw.  E.g., normally, you
-   wouldn't want to quit between a RSP command and its response, as
-   that would break the communication with the target, but you may
-   still want to intercept the Ctrl-C and offer to disconnect if the
-   user presses Ctrl-C multiple times while the target is stuck
-   waiting for the wedged remote stub.  */
-typedef void (quit_handler_ftype) (void);
-extern quit_handler_ftype *quit_handler;
-
-/* The default quit handler.  Checks whether Ctrl-C was pressed, and
-   if so:
-
-     - If GDB owns the terminal, throws a quit exception.
-
-     - If GDB does not own the terminal, forwards the Ctrl-C to the
-       target.
-*/
-extern void default_quit_handler (void);
-
-/* Flag that function quit should call quit_force.  */
-extern volatile bool sync_quit_force_run;
-
-/* Set sync_quit_force_run and also call set_quit_flag().  */
-extern void set_force_quit_flag ();
-
-extern void quit (void);
-
-/* Helper for the QUIT macro.  */
-
-extern void maybe_quit (void);
-
-/* Check whether a Ctrl-C was typed, and if so, call the current quit
-   handler.  */
-#define QUIT maybe_quit ()
-
-/* Set the serial event associated with the quit flag.  */
-extern void quit_serial_event_set (void);
-
-/* Clear the serial event associated with the quit flag.  */
-extern void quit_serial_event_clear (void);
-
 /* * Languages represented in the symbol table and elsewhere.
    This should probably be in language.h, but since enum's can't
    be forward declared to satisfy opaque references before their
diff --git a/gdb/disasm.c b/gdb/disasm.c
index da6f3afba7a..e54b8521dde 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -18,6 +18,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "arch-utils.h"
+#include "event-top.h"
 #include "target.h"
 #include "value.h"
 #include "ui-out.h"
diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c
index 190ceebe160..3b95c075a55 100644
--- a/gdb/dwarf2/cooked-index.c
+++ b/gdb/dwarf2/cooked-index.c
@@ -24,6 +24,7 @@
 #include "cp-support.h"
 #include "c-lang.h"
 #include "ada-lang.h"
+#include "event-top.h"
 #include "split-name.h"
 #include "observable.h"
 #include "run-on-main-thread.h"
diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c
index d92facbf0dc..cb80dbf60b1 100644
--- a/gdb/dwarf2/expr.c
+++ b/gdb/dwarf2/expr.c
@@ -20,6 +20,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "block.h"
+#include "event-top.h"
 #include "symtab.h"
 #include "gdbtypes.h"
 #include "value.h"
diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index 205d2ba56cb..23c57bde939 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -19,6 +19,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "ui-out.h"
 #include "value.h"
 #include "frame.h"
diff --git a/gdb/dwarf2/read-gdb-index.c b/gdb/dwarf2/read-gdb-index.c
index 8c0895b9639..e743ce13978 100644
--- a/gdb/dwarf2/read-gdb-index.c
+++ b/gdb/dwarf2/read-gdb-index.c
@@ -22,6 +22,7 @@
 #include "cli/cli-cmds.h"
 #include "complaints.h"
 #include "dwz.h"
+#include "event-top.h"
 #include "gdb/gdb-index.h"
 #include "gdbsupport/gdb-checked-static-cast.h"
 #include "mapped-index.h"
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 96e51bb42b0..501d6c0c992 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -47,6 +47,7 @@
 #include "dwarf2/public.h"
 #include "bfd.h"
 #include "elf-bfd.h"
+#include "event-top.h"
 #include "symtab.h"
 #include "gdbtypes.h"
 #include "objfiles.h"
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 8411ec5028a..2fcbad6b937 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -19,6 +19,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "gdbsupport/job-control.h"
+#include "run-on-main-thread.h"
 #include "top.h"
 #include "ui.h"
 #include "inferior.h"
@@ -1062,15 +1064,55 @@ gdb_init_signals (void)
   install_handle_sigsegv ();
 }
 
-/* See defs.h.  */
+/* See event-top.h.  */
 
 void
-quit_serial_event_set (void)
+quit (void)
+{
+  if (sync_quit_force_run)
+    {
+      sync_quit_force_run = false;
+      throw_forced_quit ("SIGTERM");
+    }
+
+#ifdef __MSDOS__
+  /* No steenking SIGINT will ever be coming our way when the
+     program is resumed.  Don't lie.  */
+  throw_quit ("Quit");
+#else
+  if (job_control
+      /* If there is no terminal switching for this target, then we can't
+	 possibly get screwed by the lack of job control.  */
+      || !target_supports_terminal_ours ())
+    throw_quit ("Quit");
+  else
+    throw_quit ("Quit (expect signal SIGINT when the program is resumed)");
+#endif
+}
+
+/* See event-top.h.  */
+
+void
+maybe_quit ()
+{
+  if (!is_main_thread ())
+    return;
+
+  if (sync_quit_force_run)
+    quit ();
+
+  quit_handler ();
+}
+
+/* See event-top.h.  */
+
+void
+quit_serial_event_set ()
 {
   serial_event_set (quit_serial_event);
 }
 
-/* See defs.h.  */
+/* See event-top.h.  */
 
 void
 quit_serial_event_clear (void)
diff --git a/gdb/event-top.h b/gdb/event-top.h
index f431f2812b2..846d1e48289 100644
--- a/gdb/event-top.h
+++ b/gdb/event-top.h
@@ -26,9 +26,61 @@
 
 struct cmd_list_element;
 
+/* The current quit handler (and its type).  This is called from the
+   QUIT macro.  See default_quit_handler below for default behavior.
+   Parts of GDB temporarily override this to e.g., completely suppress
+   Ctrl-C because it would not be safe to throw.  E.g., normally, you
+   wouldn't want to quit between a RSP command and its response, as
+   that would break the communication with the target, but you may
+   still want to intercept the Ctrl-C and offer to disconnect if the
+   user presses Ctrl-C multiple times while the target is stuck
+   waiting for the wedged remote stub.  */
+typedef void (quit_handler_ftype) ();
+extern quit_handler_ftype *quit_handler;
+
 /* Exported functions from event-top.c.
    FIXME: these should really go into top.h.  */
 
+/* The default quit handler.  Checks whether Ctrl-C was pressed, and
+   if so:
+
+     - If GDB owns the terminal, throws a quit exception.
+
+     - If GDB does not own the terminal, forwards the Ctrl-C to the
+       target.
+*/
+
+extern void default_quit_handler ();
+
+/* Flag that function quit should call quit_force.  */
+
+extern volatile bool sync_quit_force_run;
+
+/* Set sync_quit_force_run and also call set_quit_flag().  */
+
+extern void set_force_quit_flag ();
+
+/* Control C eventually causes this to be called, at a convenient time.  */
+
+extern void quit ();
+
+/* Helper for the QUIT macro.  */
+
+extern void maybe_quit ();
+
+/* Check whether a Ctrl-C was typed, and if so, call the current quit
+   handler.  */
+
+#define QUIT maybe_quit ()
+
+/* Set the serial event associated with the quit flag.  */
+
+extern void quit_serial_event_set ();
+
+/* Clear the serial event associated with the quit flag.  */
+
+extern void quit_serial_event_clear ();
+
 extern void display_gdb_prompt (const char *new_prompt);
 extern void gdb_setup_readline (int);
 extern void gdb_disable_readline (void);
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index 6e9722dbeb8..42e1cfb871b 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -20,6 +20,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "gdbsupport/gdb_obstack.h"
 #include "bfd.h"
 #include "symtab.h"
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 660eb11c8b8..df4ab1a28b9 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -17,6 +17,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "extract-store-integer.h"
 #include "symtab.h"
 #include "gdbtypes.h"
diff --git a/gdb/frame.c b/gdb/frame.c
index 719fa051afc..0232bdb6865 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -18,6 +18,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "frame.h"
+#include "event-top.h"
 #include "extract-store-integer.h"
 #include "target.h"
 #include "value.h"
diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
index 1462aaf0f89..6e97b216813 100644
--- a/gdb/gdb_bfd.c
+++ b/gdb/gdb_bfd.c
@@ -18,6 +18,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "gdb_bfd.h"
+#include "event-top.h"
 #include "ui-out.h"
 #include "gdbcmd.h"
 #include "hashtab.h"
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index bb8119a36d0..867cb187c8a 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -18,6 +18,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "arch-utils.h"
+#include "event-top.h"
 #include "inferior.h"
 #include "infrun.h"
 #include "regcache.h"
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index 86fef96dec1..5e9faa67de3 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -17,6 +17,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "symtab.h"
 #include "gdbtypes.h"
 #include "expression.h"
diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c
index 32cc930cfb8..c0ae72203c3 100644
--- a/gdb/m2-typeprint.c
+++ b/gdb/m2-typeprint.c
@@ -16,6 +16,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "language.h"
 #include "gdbsupport/gdb_obstack.h"
 #include "bfd.h"
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index b78c169e70b..5e504283fcf 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -17,6 +17,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "target.h"
 #include "frame.h"
 #include "value.h"
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index e492c82845b..b36816898a5 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -20,6 +20,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "symtab.h"
 #include "gdbtypes.h"
 #include "expression.h"
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index ddacccce1b2..d3d491c54cd 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -19,6 +19,7 @@
 
 /* This file is derived from c-lang.c */
 
+#include "event-top.h"
 #include "extract-store-integer.h"
 #include "symtab.h"
 #include "gdbtypes.h"
diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c
index ad98d9ef202..95a7f6041c1 100644
--- a/gdb/p-typeprint.c
+++ b/gdb/p-typeprint.c
@@ -18,6 +18,7 @@
 
 /* This file is derived from p-typeprint.c */
 
+#include "event-top.h"
 #include "gdbsupport/gdb_obstack.h"
 #include "bfd.h"
 #include "symtab.h"
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 79da7ea4e22..66669f105c5 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -17,6 +17,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "extract-store-integer.h"
 #include "frame.h"
 #include "symtab.h"
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index a4f5b04627c..8edadf3a335 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -17,6 +17,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "symtab.h"
 #include "objfiles.h"
 #include "psymtab.h"
diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c
index 934ba3f8281..bdb3c22b692 100644
--- a/gdb/remote-fileio.c
+++ b/gdb/remote-fileio.c
@@ -19,6 +19,7 @@
 
 /* See the GDB User Guide for details of the GDB remote protocol.  */
 
+#include "event-top.h"
 #include "extract-store-integer.h"
 #include "gdbcmd.h"
 #include "remote.h"
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 5fccefe93a1..38d7f5b7c0f 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -20,6 +20,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "gdb_bfd.h"
 #include "inferior.h"
 #include "infrun.h"
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 53e7356c451..e7fdc287dbc 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -25,6 +25,7 @@
 #include "charset.h"
 #include "cp-support.h"
 #include "demangle.h"
+#include "event-top.h"
 #include "gdbarch.h"
 #include "infcall.h"
 #include "objfiles.h"
diff --git a/gdb/ser-base.c b/gdb/ser-base.c
index ccf38d2202b..81ef942c55f 100644
--- a/gdb/ser-base.c
+++ b/gdb/ser-base.c
@@ -17,6 +17,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "serial.h"
 #include "ser-base.h"
 #include "gdbsupport/event-loop.h"
diff --git a/gdb/skip.c b/gdb/skip.c
index f2818eccb34..9b8a56cadef 100644
--- a/gdb/skip.c
+++ b/gdb/skip.c
@@ -16,6 +16,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "skip.h"
+#include "event-top.h"
 #include "value.h"
 #include "valprint.h"
 #include "ui-out.h"
diff --git a/gdb/solib-rocm.c b/gdb/solib-rocm.c
index b714e4ef6cc..9b995c7a3ab 100644
--- a/gdb/solib-rocm.c
+++ b/gdb/solib-rocm.c
@@ -23,6 +23,7 @@
 #include "arch-utils.h"
 #include "elf-bfd.h"
 #include "elf/amdgpu.h"
+#include "event-top.h"
 #include "gdbsupport/fileio.h"
 #include "inferior.h"
 #include "observable.h"
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index 9c8deaac021..0eaaf506b3c 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -19,6 +19,7 @@
 
 #include "arch-utils.h"
 #include "dwarf2/frame.h"
+#include "event-top.h"
 #include "extract-store-integer.h"
 #include "frame.h"
 #include "frame-base.h"
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 85fe4000f32..11585196234 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -25,6 +25,7 @@
    this file.  */
 
 #include "bfd.h"
+#include "event-top.h"
 #include "gdbsupport/gdb_obstack.h"
 #include "symtab.h"
 #include "gdbtypes.h"
diff --git a/gdb/stack.c b/gdb/stack.c
index 2922265515d..6e9312c0a0d 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -17,6 +17,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "extract-store-integer.h"
 #include "value.h"
 #include "symtab.h"
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index f80fc5ab196..70435996a8e 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -17,6 +17,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "symtab.h"
 #include "gdbtypes.h"
 #include "bfd.h"
diff --git a/gdb/symtab.c b/gdb/symtab.c
index d931b3a694b..63b780bb66e 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -19,6 +19,7 @@
 
 #include "dwarf2/call-site.h"
 #include "symtab.h"
+#include "event-top.h"
 #include "gdbtypes.h"
 #include "gdbcore.h"
 #include "frame.h"
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 1586a043af6..0c0a94573bb 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -18,6 +18,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "arch-utils.h"
+#include "event-top.h"
 #include "symtab.h"
 #include "frame.h"
 #include "gdbtypes.h"
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index eaee85f82b4..01e8d7cb926 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -19,6 +19,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "gdbcmd.h"
 #include "tui/tui.h"
 #include "tui/tui-hooks.h"
diff --git a/gdb/utils.c b/gdb/utils.c
index 04f2d909cd2..8d7ef7e3ad0 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -652,47 +652,6 @@ warning_filename_and_errno (const char *filename, int saved_errno)
 	   safe_strerror (saved_errno));
 }
 
-/* Control C eventually causes this to be called, at a convenient time.  */
-
-void
-quit (void)
-{
-  if (sync_quit_force_run)
-    {
-      sync_quit_force_run = false;
-      throw_forced_quit ("SIGTERM");
-    }
-
-#ifdef __MSDOS__
-  /* No steenking SIGINT will ever be coming our way when the
-     program is resumed.  Don't lie.  */
-  throw_quit ("Quit");
-#else
-  if (job_control
-      /* If there is no terminal switching for this target, then we can't
-	 possibly get screwed by the lack of job control.  */
-      || !target_supports_terminal_ours ())
-    throw_quit ("Quit");
-  else
-    throw_quit ("Quit (expect signal SIGINT when the program is resumed)");
-#endif
-}
-
-/* See defs.h.  */
-
-void
-maybe_quit (void)
-{
-  if (!is_main_thread ())
-    return;
-
-  if (sync_quit_force_run)
-    quit ();
-
-  quit_handler ();
-}
-
-\f
 /* Called when a memory allocation fails, with the number of bytes of
    memory requested in SIZE.  */
 
diff --git a/gdb/valops.c b/gdb/valops.c
index f9b54a5d9a9..8eae7cf7995 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -17,6 +17,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "extract-store-integer.h"
 #include "symtab.h"
 #include "gdbtypes.h"
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 13e80c06c9f..21265ada2dd 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -17,6 +17,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "event-top.h"
 #include "extract-store-integer.h"
 #include "symtab.h"
 #include "gdbtypes.h"
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index c4914bdcbaf..639dd5b8adc 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -19,6 +19,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "bfd.h"
+#include "event-top.h"
 
 #include <sys/types.h>
 #include <fcntl.h>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-23 15:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-23 15:29 [binutils-gdb] gdb: move a bunch of quit-related things to event-top.{c,h} Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).