summaryrefslogtreecommitdiff
path: root/gdb/defs.h
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-08-22 17:48:45 +0000
committerTom Tromey <tromey@redhat.com>2012-08-22 17:48:45 +0000
commite493a2763e7b1f4f0621651eb75c5ab81b3345d3 (patch)
treefacfb07c1e702fd1bf7d828a0157a58528b92d4d /gdb/defs.h
parentcf9cee187411f994b30fdedfbe19c79cd266b8d8 (diff)
downloadgdb-e493a2763e7b1f4f0621651eb75c5ab81b3345d3.tar.gz
* defs.h (quit_flag): Don't declare.
(clear_quit_flag, check_quit_flag, set_quit_flag): Declare. (QUIT): Use new functions. * event-top.c (command_handler): Use clear_quit_flag. (handle_sigint): Use set_quit_flag. (async_request_quit): Use check_quit_flag. Don't check immediate_quit. * exceptions.c (throw_exception): Use clear_quit_flag. * main.c (captured_main): Use clear_quit_flag. * python/python.c (clear_quit_flag, set_quit_flag) (check_quit_flag): New functions. * remote-sim.c (gdb_os_poll_quit): Use check_quit_flag, clear_quit_flag. * remote.c (remote_wait_as): Use check_quit_flag, clear_quit_flag. (remote_start_remote): Call QUIT. * symfile.c (load_progress): Use check_quit_flag. * top.c (command_loop): Use clear_quit_flag. (command_line_input): Call QUIT. * utils.c (quit_flag): Conditionally define. (clear_quit_flag, check_quit_flag, set_quit_flag): New functions. (prompt_for_continue): Call QUIT. Use quit, not async_request_quit. * remote-mips.c (mips_expect_timeout): Call QUIT. * monitor.c (monitor_expect): Call QUIT.
Diffstat (limited to 'gdb/defs.h')
-rw-r--r--gdb/defs.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/gdb/defs.h b/gdb/defs.h
index de34740f323..96bc58c8b00 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -171,7 +171,27 @@ extern char *python_libdir;
/* Search path for separate debug files. */
extern char *debug_file_directory;
-extern int quit_flag;
+/* 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.
+
+ If GDB is built with Python support, it uses Python's low-level
+ interface to implement the flag. This approach makes it possible
+ for Python and GDB SIGINT handling to coexist seamlessly.
+
+ If GDB is built without Python, it instead uses its traditional
+ variables. */
+
+/* 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);
+
extern int immediate_quit;
extern void quit (void);
@@ -184,7 +204,7 @@ extern void quit (void);
needed. */
#define QUIT { \
- if (quit_flag) quit (); \
+ if (check_quit_flag ()) quit (); \
if (deprecated_interactive_hook) deprecated_interactive_hook (); \
}