From 522002f96cdfe306cb3385d075a5ae9f8381969e Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 22 Aug 2012 17:48:55 +0000 Subject: * 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. --- gdb/utils.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'gdb/utils.c') diff --git a/gdb/utils.c b/gdb/utils.c index b9e76ab..6026450 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -122,9 +122,11 @@ static int debug_timestamp = 0; int job_control; +#ifndef HAVE_PYTHON /* Nonzero means a quit has been requested. */ int quit_flag; +#endif /* HAVE_PYTHON */ /* Nonzero means quit immediately if Control-C is typed now, rather than waiting until QUIT is executed. Be careful in setting this; @@ -139,6 +141,41 @@ int quit_flag; int immediate_quit; +#ifndef HAVE_PYTHON + +/* Clear the quit flag. */ + +void +clear_quit_flag (void) +{ + quit_flag = 0; +} + +/* Set the quit flag. */ + +void +set_quit_flag (void) +{ + quit_flag = 1; +} + +/* Return true if the quit flag has been set, false otherwise. */ + +int +check_quit_flag (void) +{ + /* This is written in a particular way to avoid races. */ + if (quit_flag) + { + quit_flag = 0; + return 1; + } + + return 0; +} + +#endif /* HAVE_PYTHON */ + /* Nonzero means that strings with character values >0x7F should be printed as octal escapes. Zero means just print the value (e.g. it's an international character, and the terminal or window can cope.) */ @@ -1840,6 +1877,7 @@ prompt_for_continue (void) reinitialize_more_filter (); immediate_quit++; + QUIT; /* On a real operating system, the user can quit with SIGINT. But not on GO32. @@ -1868,7 +1906,7 @@ prompt_for_continue (void) while (*p == ' ' || *p == '\t') ++p; if (p[0] == 'q') - async_request_quit (0); + quit (); xfree (ignore); } immediate_quit--; -- cgit v1.1