Switch gdb's TRY/CATCH to C++ try/catch
[deliverable/binutils-gdb.git] / gdb / defs.h
index ad9b259baae7bf31fb344a41758eb753307f5802..482ef1cb36123a79f639e87582375f29f8f5045a 100644 (file)
@@ -125,11 +125,10 @@ 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
@@ -139,29 +138,51 @@ extern char *debug_file_directory;
    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.  */
This page took 0.025729 seconds and 4 git commands to generate.