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/python/python.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'gdb/python/python.c') diff --git a/gdb/python/python.c b/gdb/python/python.c index c66efe4..4a2b518 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -151,6 +151,31 @@ ensure_python_env (struct gdbarch *gdbarch, return make_cleanup (restore_python_env, env); } +/* Clear the quit flag. */ + +void +clear_quit_flag (void) +{ + /* This clears the flag as a side effect. */ + PyOS_InterruptOccurred (); +} + +/* Set the quit flag. */ + +void +set_quit_flag (void) +{ + PyErr_SetInterrupt (); +} + +/* Return true if the quit flag has been set, false otherwise. */ + +int +check_quit_flag (void) +{ + return PyOS_InterruptOccurred (); +} + /* A wrapper around PyRun_SimpleFile. FILE is the Python script to run named FILENAME. -- cgit v1.1