]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/event-top.h
gdb: move a bunch of quit-related things to event-top.{c,h}
[thirdparty/binutils-gdb.git] / gdb / event-top.h
index f431f2812b21a6a0e517481021c1a1c6606ba42d..846d1e48289314d114d9847ac07a338a90426629 100644 (file)
 
 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);