GDB (xrefs)
|
#include "defs.h"
#include "top.h"
#include "ui.h"
#include "inferior.h"
#include "infrun.h"
#include "target.h"
#include "terminal.h"
#include "gdbsupport/event-loop.h"
#include "event-top.h"
#include "interps.h"
#include <signal.h>
#include "cli/cli-script.h"
#include "main.h"
#include "gdbthread.h"
#include "observable.h"
#include "gdbcmd.h"
#include "annotate.h"
#include "maint.h"
#include "ser-event.h"
#include "gdbsupport/gdb_select.h"
#include "gdbsupport/gdb-sigmask.h"
#include "async-event.h"
#include "bt-utils.h"
#include "pager.h"
#include "readline/readline.h"
#include "readline/history.h"
Go to the source code of this file.
Macros | |
#define | SERVER_COMMAND_PREFIX "server " |
Functions | |
static std::string | top_level_prompt () |
static void | async_sigterm_handler (gdb_client_data arg) |
static void | show_bt_on_fatal_signal (struct ui_file *file, int from_tty, struct cmd_list_element *cmd, const char *value) |
static struct gdb_exception | gdb_rl_callback_read_char_wrapper_noexcept () noexcept |
static void | gdb_rl_callback_read_char_wrapper (gdb_client_data client_data) |
static void | gdb_rl_callback_handler (char *rl) noexcept |
void | change_line_handler (int editing) |
void | gdb_rl_callback_handler_remove (void) |
void | gdb_rl_callback_handler_install (const char *prompt) |
void | gdb_rl_callback_handler_reinstall (void) |
void | display_gdb_prompt (const char *new_prompt) |
static std::string & | get_command_line_buffer (void) |
void | async_enable_stdin (void) |
void | async_disable_stdin (void) |
void | command_handler (const char *command) |
static bool | command_line_append_input_line (std::string &cmd_line_buffer, const char *rl) |
const char * | handle_line_of_input (std::string &cmd_line_buffer, const char *rl, int repeat, const char *annotation_suffix) |
void | gdb_rl_deprep_term_function (void) |
void | command_line_handler (gdb::unique_xmalloc_ptr< char > &&rl) |
void | gdb_readline_no_editing_callback (gdb_client_data client_data) |
static bool | unblock_signal (int sig) |
static void ATTRIBUTE_NORETURN | handle_fatal_signal (int sig) |
static void | handle_sigsegv (int sig) |
static void | install_handle_sigsegv () |
void | gdb_init_signals (void) |
void | quit_serial_event_set (void) |
void | quit_serial_event_clear (void) |
static int | quit_serial_event_fd (void) |
void | default_quit_handler (void) |
void | handle_sigint (int sig) |
int | interruptible_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) |
void | set_force_quit_flag () |
void | handle_sigterm (int sig) |
void | async_request_quit (gdb_client_data arg) |
void | gdb_setup_readline (int editing) |
void | gdb_disable_readline (void) |
static void | set_debug_event_loop_command (const char *args, int from_tty, cmd_list_element *c) |
static void | show_debug_event_loop_command (struct ui_file *file, int from_tty, struct cmd_list_element *cmd, const char *value) |
void | _initialize_event_top () |
Variables | |
bool | set_editing_cmd_var |
bool | exec_done_display_p = false |
int | call_stdin_event_handler_again_p |
static bool | bt_on_fatal_signal = GDB_PRINT_INTERNAL_BACKTRACE_INIT_ON |
static struct async_signal_handler * | sigint_token |
static struct async_signal_handler * | async_sigterm_token |
void(* | after_char_processing_hook )(void) |
static bool | callback_handler_installed |
static thread_local void(* | thread_local_segv_handler )(int) |
static struct serial_event * | quit_serial_event |
quit_handler_ftype * | quit_handler = default_quit_handler |
volatile bool | sync_quit_force_run |
static const char | debug_event_loop_off [] = "off" |
static const char | debug_event_loop_all_except_ui [] = "all-except-ui" |
static const char | debug_event_loop_all [] = "all" |
static const char * | debug_event_loop_enum [] |
static const char * | debug_event_loop_value = debug_event_loop_off |
#define SERVER_COMMAND_PREFIX "server " |
void _initialize_event_top | ( | ) |
Definition at line 1375 of file event-top.c.
Referenced by initialize_all_files().
void async_disable_stdin | ( | void | ) |
Definition at line 523 of file event-top.c.
References current_ui, PROMPT_BLOCKED, ui::prompt_state, and ui::unregister_file_handler().
Referenced by all_uis_on_sync_execution_starting(), and run_inferior_call().
void async_enable_stdin | ( | void | ) |
Definition at line 507 of file event-top.c.
References current_ui, target_terminal::ours(), PROMPT_BLOCKED, PROMPT_NEEDED, ui::prompt_state, and ui::register_file_handler().
Referenced by handle_command_errors(), mi_execute_command(), normal_stop(), run_inferior_call(), call_thread_fsm::should_stop(), and start_event_loop().
void async_request_quit | ( | gdb_client_data | arg | ) |
|
static |
Definition at line 1139 of file event-top.c.
References quit_force().
Referenced by gdb_init_signals().
void change_line_handler | ( | int | editing | ) |
Definition at line 291 of file event-top.c.
References ui::call_readline, ui::command_editing, command_interp(), current_ui, gdb_readline_no_editing_callback(), gdb_rl_callback_handler_remove(), gdb_rl_callback_read_char_wrapper(), main_ui, and top_level_interpreter().
Referenced by set_editing().
void command_handler | ( | const char * | command | ) |
Definition at line 537 of file event-top.c.
References bpstat_do_actions(), current_ui, execute_command(), ui::instream, reinitialize_more_filter(), and ui::stdin_stream.
Referenced by command_line_handler(), and read_command_file().
|
static |
Definition at line 565 of file event-top.c.
Referenced by handle_line_of_input().
void command_line_handler | ( | gdb::unique_xmalloc_ptr< char > && | rl | ) |
Definition at line 717 of file event-top.c.
References command_handler(), current_ui, display_gdb_prompt(), execute_command(), get_command_line_buffer(), handle_line_of_input(), ui::line_buffer, printf_unfiltered(), PROMPT_NEEDED, ui::prompt_state, and PROMPTED.
Referenced by cli_interp::resume(), and tui_command_line_handler().
void default_quit_handler | ( | void | ) |
Definition at line 1068 of file event-top.c.
References check_quit_flag(), target_terminal::is_ours(), quit(), and target_pass_ctrlc().
void display_gdb_prompt | ( | const char * | new_prompt | ) |
Definition at line 398 of file event-top.c.
References annotate_display_prompt(), ui::command_editing, current_ui, gdb_flush(), gdb_rl_callback_handler_install(), gdb_rl_callback_handler_remove(), gdb_stdout, printf_unfiltered(), PROMPT_BLOCKED, PROMPT_NEEDED, ui::prompt_state, PROMPTED, reset_command_nest_depth(), and top_level_prompt().
Referenced by command_line_handler(), gdb_readline_wrapper(), cli_interp_base::on_command_error(), cli_interp_base::on_sync_execution_done(), and cli_interp_base::pre_command_loop().
void gdb_disable_readline | ( | void | ) |
Definition at line 1319 of file event-top.c.
References ui::command_editing, current_ui, gdb_rl_callback_handler_remove(), and ui::unregister_file_handler().
Referenced by cli_interp::suspend(), mi_interp::suspend(), tui_interp::suspend(), and undo_terminal_modifications_before_exit().
void gdb_init_signals | ( | void | ) |
Definition at line 991 of file event-top.c.
References async_request_quit(), async_sigterm_handler(), async_sigterm_token, create_async_signal_handler(), handle_fatal_signal(), handle_sigint(), handle_sigterm(), initialize_async_signal_handlers(), install_handle_sigsegv(), install_sigint_handler(), make_serial_event(), quit_serial_event, and sigint_token.
Referenced by gdb_init().
void gdb_readline_no_editing_callback | ( | gdb_client_data | client_data | ) |
Definition at line 800 of file event-top.c.
References current_ui, ui::input_handler, ui::instream, ui::line_buffer, and ui::stdin_stream.
Referenced by change_line_handler(), gdb_setup_readline(), and mi_interp::resume().
|
staticnoexcept |
Definition at line 248 of file event-top.c.
References current_ui, and ui::input_handler.
Referenced by gdb_rl_callback_handler_install().
void gdb_rl_callback_handler_install | ( | const char * | prompt | ) |
Definition at line 352 of file event-top.c.
References callback_handler_installed, current_ui, gdb_rl_callback_handler(), and main_ui.
Referenced by display_gdb_prompt(), and gdb_rl_callback_handler_reinstall().
void gdb_rl_callback_handler_reinstall | ( | void | ) |
Definition at line 368 of file event-top.c.
References callback_handler_installed, current_ui, gdb_rl_callback_handler_install(), and main_ui.
Referenced by reinstall_readline_callback_handler_cleanup().
void gdb_rl_callback_handler_remove | ( | void | ) |
Definition at line 339 of file event-top.c.
References callback_handler_installed, current_ui, and main_ui.
Referenced by change_line_handler(), display_gdb_prompt(), gdb_disable_readline(), and gdb_readline_wrapper_line().
|
static |
Definition at line 231 of file event-top.c.
References gdb_rl_callback_read_char_wrapper_noexcept().
Referenced by change_line_handler(), and gdb_setup_readline().
|
staticnoexcept |
Definition at line 185 of file event-top.c.
References after_char_processing_hook.
Referenced by gdb_rl_callback_read_char_wrapper().
void gdb_rl_deprep_term_function | ( | void | ) |
Definition at line 692 of file event-top.c.
References printf_unfiltered().
Referenced by init_main().
void gdb_setup_readline | ( | int | editing | ) |
Definition at line 1278 of file event-top.c.
References ui::call_readline, ui::command_editing, current_ui, gdb_readline_no_editing_callback(), gdb_rl_callback_read_char_wrapper(), ui::instream, ISATTY, main_ui, and ui::register_file_handler().
Referenced by cli_interp::resume(), mi_interp::resume(), and tui_interp::resume().
|
static |
Definition at line 497 of file event-top.c.
References current_ui, and ui::line_buffer.
Referenced by command_line_handler().
|
static |
Definition at line 870 of file event-top.c.
References bt_on_fatal_signal, gdb_internal_backtrace(), gdb_stderr, REPORT_BUGS_TO, tui_disable(), and unblock_signal().
Referenced by gdb_init_signals(), and handle_sigsegv().
const char * handle_line_of_input | ( | std::string & | cmd_line_buffer, |
const char * | rl, | ||
int | repeat, | ||
const char * | annotation_suffix ) |
Definition at line 605 of file event-top.c.
References annotation_level, command_line_append_input_line(), complete(), current_ui, gdb_add_history(), get_saved_command_line(), history_expansion_p, ui::input_interactive_p(), ui::instream, printf_unfiltered(), save_command_line(), server_command, SERVER_COMMAND_PREFIX, and ui::stdin_stream.
Referenced by command_line_handler(), and command_line_input().
void handle_sigint | ( | int | sig | ) |
Definition at line 1085 of file event-top.c.
References handle_sigint(), mark_async_signal_handler(), set_quit_flag(), and sigint_token.
Referenced by gdb_init_signals(), handle_sigint(), install_gdb_sigint_handler(), and record_full_wait_1().
|
static |
Definition at line 957 of file event-top.c.
References handle_fatal_signal(), install_handle_sigsegv(), and thread_local_segv_handler.
Referenced by install_handle_sigsegv().
void handle_sigterm | ( | int | sig | ) |
Definition at line 1158 of file event-top.c.
References async_sigterm_token, handle_sigterm(), mark_async_signal_handler(), and set_force_quit_flag().
Referenced by gdb_init_signals(), and handle_sigterm().
|
static |
Definition at line 937 of file event-top.c.
References handle_sigsegv().
Referenced by gdb_init_signals(), and handle_sigsegv().
int interruptible_select | ( | int | n, |
fd_set * | readfds, | ||
fd_set * | writefds, | ||
fd_set * | exceptfds, | ||
struct timeval * | timeout ) |
Definition at line 1103 of file event-top.c.
References gdb_select(), and quit_serial_event_fd().
Referenced by gdb_readline_no_editing(), stdio_file::read(), ser_base_wait_for(), wait_for_connect(), and wait_one().
void quit_serial_event_clear | ( | void | ) |
Definition at line 1051 of file event-top.c.
References quit_serial_event, and serial_event_clear().
Referenced by check_quit_flag().
|
static |
Definition at line 1060 of file event-top.c.
References quit_serial_event, and serial_event_fd().
Referenced by interruptible_select().
void quit_serial_event_set | ( | void | ) |
Definition at line 1043 of file event-top.c.
References quit_serial_event, and serial_event_set().
Referenced by set_quit_flag().
|
static |
Definition at line 1353 of file event-top.c.
References debug_event_loop_all, debug_event_loop_all_except_ui, debug_event_loop_off, and debug_event_loop_value.
void set_force_quit_flag | ( | ) |
Definition at line 1149 of file event-top.c.
References set_quit_flag(), and sync_quit_force_run.
Referenced by handle_sigterm(), tui_getc(), tui_rl_switch_mode(), and scoped_switch_fork_info::~scoped_switch_fork_info().
|
static |
Definition at line 112 of file event-top.c.
References gdb_printf().
|
static |
Definition at line 1367 of file event-top.c.
References gdb_printf().
|
static |
Definition at line 470 of file event-top.c.
References annotation_level, gdb::observers::before_prompt, get_prompt(), and prefix.
Referenced by display_gdb_prompt().
|
static |
Definition at line 854 of file event-top.c.
Referenced by handle_fatal_signal().
void(* after_char_processing_hook) (void) | ( | void | ) |
Definition at line 138 of file event-top.c.
Referenced by gdb_readline_wrapper(), gdb_readline_wrapper_line(), gdb_rl_callback_read_char_wrapper_noexcept(), gdb_rl_operate_and_get_next(), gdb_rl_operate_and_get_next_completion(), start_event_loop(), and gdb_readline_wrapper_cleanup::~gdb_readline_wrapper_cleanup().
|
static |
Definition at line 134 of file event-top.c.
Referenced by gdb_init_signals(), and handle_sigterm().
|
static |
Definition at line 107 of file event-top.c.
Referenced by handle_fatal_signal().
int call_stdin_event_handler_again_p |
Definition at line 103 of file event-top.c.
Referenced by start_sequence(), stdin_event_handler(), and tui_getc_1().
|
static |
Definition at line 334 of file event-top.c.
Referenced by gdb_rl_callback_handler_install(), gdb_rl_callback_handler_reinstall(), and gdb_rl_callback_handler_remove().
|
static |
Definition at line 1341 of file event-top.c.
Referenced by set_debug_event_loop_command().
|
static |
Definition at line 1340 of file event-top.c.
Referenced by set_debug_event_loop_command().
|
static |
Definition at line 1343 of file event-top.c.
|
static |
Definition at line 1339 of file event-top.c.
Referenced by set_debug_event_loop_command().
|
static |
Definition at line 1350 of file event-top.c.
Referenced by set_debug_event_loop_command().
bool exec_done_display_p = false |
Definition at line 98 of file event-top.c.
Referenced by fetch_inferior_event(), and init_main().
quit_handler_ftype* quit_handler = default_quit_handler |
Definition at line 1080 of file event-top.c.
Referenced by do_remote_fileio_request(), fetch_inferior_event(), maybe_quit(), remote_target::readchar(), remote_fileio_reply(), remote_fileio_request(), and remote_target::remote_serial_write().
|
static |
Definition at line 972 of file event-top.c.
Referenced by gdb_init_signals(), quit_serial_event_clear(), quit_serial_event_fd(), and quit_serial_event_set().
bool set_editing_cmd_var |
Definition at line 94 of file event-top.c.
Referenced by init_main(), and set_editing().
|
static |
Definition at line 124 of file event-top.c.
Referenced by gdb_init_signals(), and handle_sigint().
volatile bool sync_quit_force_run |
Definition at line 1145 of file event-top.c.
Referenced by maybe_quit(), quit(), quit_force(), and set_force_quit_flag().
|
static |
Definition at line 931 of file event-top.c.
Referenced by handle_sigsegv(), scoped_segv_handler_restore::scoped_segv_handler_restore(), and scoped_segv_handler_restore::~scoped_segv_handler_restore().