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.h | |
parent | 4111db1af3ac9be50a49ad69b255a6cd4198037b (diff) | |
download | gdb-e5dc0d5d04e68328242fc171098e78f79589c7b7.zip gdb-e5dc0d5d04e68328242fc171098e78f79589c7b7.tar.gz 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.h')
-rw-r--r-- | gdb/event-top.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/gdb/event-top.h b/gdb/event-top.h index f431f28..846d1e4 100644 --- a/gdb/event-top.h +++ b/gdb/event-top.h @@ -26,9 +26,61 @@ struct cmd_list_element; +/* 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) (); +extern quit_handler_ftype *quit_handler; + /* Exported functions from event-top.c. FIXME: these should really go into top.h. */ +/* 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 (); + +/* Flag that function quit should call quit_force. */ + +extern volatile bool sync_quit_force_run; + +/* Set sync_quit_force_run and also call set_quit_flag(). */ + +extern void set_force_quit_flag (); + +/* Control C eventually causes this to be called, at a convenient time. */ + +extern void quit (); + +/* Helper for the QUIT macro. */ + +extern void maybe_quit (); + +/* 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. */ + +extern void quit_serial_event_set (); + +/* Clear the serial event associated with the quit flag. */ + +extern void quit_serial_event_clear (); + extern void display_gdb_prompt (const char *new_prompt); extern void gdb_setup_readline (int); extern void gdb_disable_readline (void); |