diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2024-04-23 09:22:59 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2024-04-23 11:26:14 -0400 |
commit | e5dc0d5d04e68328242fc171098e78f79589c7b7 (patch) | |
tree | 9227cf1cd0a15019e9e1e0b6266a8be2c4f43a38 /gdb/event-top.c | |
parent | 4111db1af3ac9be50a49ad69b255a6cd4198037b (diff) | |
download | fsf-binutils-gdb-e5dc0d5d04e68328242fc171098e78f79589c7b7.zip fsf-binutils-gdb-e5dc0d5d04e68328242fc171098e78f79589c7b7.tar.gz fsf-binutils-gdb-e5dc0d5d04e68328242fc171098e78f79589c7b7.tar.bz2 |
gdb: move a bunch of quit-related things to event-top.{c,h}
Move some declarations related to the "quit" machinery from defs.h to
event-top.h. Most of the definitions associated to these declarations
are in event-top.c. The exceptions are `quit()` and `maybe_quit()`,
that are defined in utils.c. For consistency, move these two
definitions to event-top.c.
Include "event-top.h" in many files that use these things.
Change-Id: I6594f6df9047a9a480e7b9934275d186afb14378
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/event-top.c')
-rw-r--r-- | gdb/event-top.c | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/gdb/event-top.c b/gdb/event-top.c index 8411ec5..2fcbad6 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -19,6 +19,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "gdbsupport/job-control.h" +#include "run-on-main-thread.h" #include "top.h" #include "ui.h" #include "inferior.h" @@ -1062,15 +1064,55 @@ gdb_init_signals (void) install_handle_sigsegv (); } -/* See defs.h. */ +/* See event-top.h. */ void -quit_serial_event_set (void) +quit (void) +{ + if (sync_quit_force_run) + { + sync_quit_force_run = false; + throw_forced_quit ("SIGTERM"); + } + +#ifdef __MSDOS__ + /* No steenking SIGINT will ever be coming our way when the + program is resumed. Don't lie. */ + throw_quit ("Quit"); +#else + if (job_control + /* If there is no terminal switching for this target, then we can't + possibly get screwed by the lack of job control. */ + || !target_supports_terminal_ours ()) + throw_quit ("Quit"); + else + throw_quit ("Quit (expect signal SIGINT when the program is resumed)"); +#endif +} + +/* See event-top.h. */ + +void +maybe_quit () +{ + if (!is_main_thread ()) + return; + + if (sync_quit_force_run) + quit (); + + quit_handler (); +} + +/* See event-top.h. */ + +void +quit_serial_event_set () { serial_event_set (quit_serial_event); } -/* See defs.h. */ +/* See event-top.h. */ void quit_serial_event_clear (void) |