GDB (xrefs)
|
#include "defs.h"
#include "top.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 "gdbsupport/buffer.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) |
static void | stdin_event_handler (int error, gdb_client_data client_data) |
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 | 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 |
struct ui * | main_ui |
struct ui * | current_ui |
struct ui * | ui_list |
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 int | 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 1433 of file event-top.c.
Referenced by initialize_all_files().
void async_disable_stdin | ( | void | ) |
Definition at line 587 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().
void async_enable_stdin | ( | void | ) |
Definition at line 571 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(), and start_event_loop().
void async_request_quit | ( | gdb_client_data | arg | ) |
|
static |
Definition at line 1206 of file event-top.c.
References quit_force().
Referenced by gdb_init_signals().
void change_line_handler | ( | int | editing | ) |
Definition at line 278 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(), interp_supports_command_editing(), main_ui, and top_level_interpreter().
Referenced by set_editing().
void command_handler | ( | const char * | command | ) |
Definition at line 601 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 629 of file event-top.c.
Referenced by handle_line_of_input().
void command_line_handler | ( | gdb::unique_xmalloc_ptr< char > && | rl | ) |
Definition at line 781 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 1135 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 385 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 cli_base_on_command_error(), cli_base_on_sync_execution_done(), command_line_handler(), gdb_readline_wrapper(), and cli_interp_base::pre_command_loop().
void gdb_disable_readline | ( | void | ) |
Definition at line 1377 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 1058 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 864 of file event-top.c.
References current_ui, ui::input_handler, ui::instream, ui::line_buffer, ui::stdin_stream, and xfree().
Referenced by change_line_handler(), gdb_setup_readline(), and mi_interp::resume().
|
staticnoexcept |
Definition at line 235 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 339 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 355 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 326 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 218 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 178 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 756 of file event-top.c.
References printf_unfiltered().
Referenced by init_main().
void gdb_setup_readline | ( | int | editing | ) |
Definition at line 1336 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 490 of file event-top.c.
References current_ui, and ui::line_buffer.
Referenced by command_line_handler().
|
static |
Definition at line 941 of file event-top.c.
References bt_on_fatal_signal, gdb_internal_backtrace(), gdb_stderr, REPORT_BUGS_TO, 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 669 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 1152 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 1024 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 1217 of file event-top.c.
References async_sigterm_token, handle_sigterm(), mark_async_signal_handler(), set_quit_flag(), and sync_quit_force_run.
Referenced by gdb_init_signals(), and handle_sigterm().
|
static |
Definition at line 1004 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 1170 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 1118 of file event-top.c.
References quit_serial_event, and serial_event_clear().
Referenced by check_quit_flag().
|
static |
Definition at line 1127 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 1110 of file event-top.c.
References quit_serial_event, and serial_event_set().
Referenced by set_quit_flag().
|
static |
Definition at line 1411 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.
|
static |
Definition at line 108 of file event-top.c.
References gdb_printf().
|
static |
Definition at line 1425 of file event-top.c.
References gdb_printf().
|
static |
Definition at line 501 of file event-top.c.
References ui::call_readline, call_stdin_event_handler_again_p, current_ui, gdb_printf(), gdb_stderr, main_ui, QUIT, quit_command(), and ui::unregister_file_handler().
Referenced by ui::register_file_handler().
|
static |
Definition at line 457 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 925 of file event-top.c.
Referenced by handle_fatal_signal().
void(* after_char_processing_hook) (void) | ( | void | ) |
Definition at line 134 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 130 of file event-top.c.
Referenced by gdb_init_signals(), and handle_sigterm().
|
static |
Definition at line 103 of file event-top.c.
Referenced by handle_fatal_signal().
int call_stdin_event_handler_again_p |
Definition at line 99 of file event-top.c.
Referenced by start_sequence(), stdin_event_handler(), and tui_getc_1().
|
static |
Definition at line 321 of file event-top.c.
Referenced by gdb_rl_callback_handler_install(), gdb_rl_callback_handler_reinstall(), and gdb_rl_callback_handler_remove().
struct ui* current_ui |
Definition at line 483 of file event-top.c.
Referenced by abort_with_message(), all_uis_on_sync_execution_starting(), annotate_breakpoints_invalid(), annotate_frames_invalid(), async_disable_stdin(), async_enable_stdin(), ATTRIBUTE_PRINTF(), ATTRIBUTE_PRINTF(), bpstat_do_actions_1(), call_function_by_hand_dummy(), captured_command_loop(), captured_main_1(), catch_command_errors(), change_line_handler(), check_curr_ui_sync_execution_done(), cli_ui_out::clear_current_line(), command_handler(), command_line_handler(), command_line_input(), compile_code_command(), compile_file_command(), compile_print_command(), continue_1(), current_interpreter(), current_ui_current_uiout_ptr(), current_ui_gdb_stderr_ptr(), current_ui_gdb_stdin_ptr(), current_ui_gdb_stdlog_ptr(), current_ui_gdb_stdout_ptr(), display_gdb_prompt(), display_mi_prompt(), cli_ui_out::do_progress_notify(), dont_repeat(), execute_command(), execute_control_command(), execute_control_commands(), execute_fn_to_ui_file(), execute_user_command(), fetch_inferior_event(), follow_fork_inferior(), gdb_disable_readline(), gdb_internal_backtrace(), gdb_readline_no_editing(), gdb_readline_no_editing_callback(), gdb_readline_wrapper(), gdb_readline_wrapper_cleanup::gdb_readline_wrapper_cleanup(), gdb_readline_wrapper_line(), gdb_rl_callback_handler(), gdb_rl_callback_handler_install(), gdb_rl_callback_handler_reinstall(), gdb_rl_callback_handler_remove(), gdb_setup_readline(), get_command_line_buffer(), get_current_interp_info(), handle_line_of_input(), if_command(), target_terminal::inferior(), inferior_event_handler(), interpreter_exec_cmd(), invoke_async_signal_handlers(), ioscm_with_output_to_port_worker(), maybe_wait_sync_command_done(), mi_cmd_interpreter_exec(), mi_execute_command(), mi_execute_command_input_handler(), mi_execute_command_wrapper(), mi_on_normal_stop_1(), mi_on_resume_1(), new_ui_command(), switch_thru_all_uis::next(), normal_stop(), target_terminal::ours(), target_terminal::ours_for_output(), postfork_child_hook(), postfork_hook(), prefork_hook(), print_flush(), read_command_file(), read_command_lines(), read_next_line(), reinstall_readline_callback_handler_cleanup(), target_terminal::restore_inferior(), cli_interp::resume(), mi_interp::resume(), tui_interp::resume(), run_inferior_call(), scoped_input_handler::scoped_input_handler(), script_from_file(), set_editing(), scoped_restore_interp::set_interp(), set_top_level_interpreter(), call_thread_fsm::should_stop(), show_editing(), show_interactive_mode(), start_event_loop(), stdin_event_handler(), switch_thru_all_uis::switch_thru_all_uis(), tui_getc_1(), tui_inject_newline_into_command_window(), tui_redisplay_readline(), tui_rl_startup_hook(), undo_terminal_modifications_before_exit(), wait_sync_command_done(), while_command(), with_command_1(), and gdb_readline_wrapper_cleanup::~gdb_readline_wrapper_cleanup().
|
static |
Definition at line 1399 of file event-top.c.
Referenced by set_debug_event_loop_command().
|
static |
Definition at line 1398 of file event-top.c.
Referenced by set_debug_event_loop_command().
|
static |
Definition at line 1401 of file event-top.c.
|
static |
Definition at line 1397 of file event-top.c.
Referenced by set_debug_event_loop_command().
|
static |
Definition at line 1408 of file event-top.c.
Referenced by set_debug_event_loop_command().
bool exec_done_display_p = false |
Definition at line 94 of file event-top.c.
Referenced by fetch_inferior_event(), and init_main().
struct ui* main_ui |
Definition at line 482 of file event-top.c.
Referenced by ATTRIBUTE_PRINTF(), captured_main_1(), change_line_handler(), fetch_inferior_event(), gdb_flush_out_err(), gdb_rl_callback_handler_install(), gdb_rl_callback_handler_reinstall(), gdb_rl_callback_handler_remove(), gdb_setup_readline(), target_terminal::inferior(), invoke_async_signal_handlers(), target_terminal::ours(), target_terminal::ours_for_output(), postfork_child_hook(), target_terminal::restore_inferior(), stdin_event_handler(), and undo_terminal_modifications_before_exit().
quit_handler_ftype* quit_handler = default_quit_handler |
Definition at line 1147 of file event-top.c.
Referenced by do_remote_fileio_request(), maybe_quit(), remote_target::readchar(), remote_fileio_reply(), remote_fileio_request(), and remote_target::remote_serial_write().
|
static |
Definition at line 1039 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 90 of file event-top.c.
Referenced by init_main(), and set_editing().
|
static |
Definition at line 120 of file event-top.c.
Referenced by gdb_init_signals(), and handle_sigint().
volatile int sync_quit_force_run |
Definition at line 1212 of file event-top.c.
Referenced by handle_sigterm(), maybe_quit(), and quit().
|
static |
Definition at line 998 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().
struct ui* ui_list |
Definition at line 484 of file event-top.c.
Referenced by all_uis(), switch_thru_all_uis::switch_thru_all_uis(), ui::ui(), and ui::~ui().