Fix PR rust/20110
[deliverable/binutils-gdb.git] / gdb / defs.h
index b94df305c8bf871438355050824c04895b1696d4..ed513968523a16634dc9a9fdd325886ce6a5b49c 100644 (file)
@@ -125,40 +125,72 @@ extern char *python_libdir;
 /* * Search path for separate debug files.  */
 extern char *debug_file_directory;
 
-/* GDB has two methods for handling SIGINT.  When immediate_quit is
-   nonzero, a SIGINT results in an immediate longjmp out of the signal
-   handler.  Otherwise, SIGINT simply sets a flag; code that might
-   take a long time, and which ought to be interruptible, checks this
-   flag using the QUIT macro.
+/* GDB's SIGINT handler basically sets a flag; code that might take a
+   long time before it gets back to the event loop, and which ought to
+   be interruptible, checks this flag using the QUIT macro, which, if
+   GDB has the terminal, throws a quit exception.
+
+   In addition to setting a flag, the SIGINT handler also marks a
+   select/poll-able file descriptor as read-ready.  That is used by
+   interruptible_select in order to support interrupting blocking I/O
+   in a race-free manner.
 
    These functions use the extension_language_ops API to allow extension
    language(s) and GDB SIGINT handling to coexist seamlessly.  */
 
-/* * Clear the quit flag.  */
-extern void clear_quit_flag (void);
 /* * Evaluate to non-zero if the quit flag is set, zero otherwise.  This
    will clear the quit flag as a side effect.  */
 extern int check_quit_flag (void);
 /* * Set the quit flag.  */
 extern void set_quit_flag (void);
 
+/* 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;
+
+/* Override the current quit handler.  Sets NEW_QUIT_HANDLER as
+   current quit handler, and installs a cleanup that when run restores
+   the previous quit handler.  */
+struct cleanup *
+  make_cleanup_override_quit_handler (quit_handler_ftype *new_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 int sync_quit_force_run;
 
-extern int immediate_quit;
-
 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 quit.  The target
-   is given a chance to process the Ctrl-C.  E.g., it may detect that
-   repeated Ctrl-C requests were issued, and choose to close the
-   connection.  */
+/* 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
@@ -180,6 +212,7 @@ enum language
     language_pascal,           /* Pascal */
     language_ada,              /* Ada */
     language_opencl,           /* OpenCL */
+    language_rust,             /* Rust */
     language_minimal,          /* All other languages, minimal support only */
     nr_languages
   };
This page took 0.02425 seconds and 4 git commands to generate.