GDB (xrefs)
Loading...
Searching...
No Matches
Macros | Functions | Variables
event-top.c File Reference
#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_handlersigint_token
 
static struct async_signal_handlerasync_sigterm_token
 
void(* after_char_processing_hook )(void)
 
static bool callback_handler_installed
 
struct uimain_ui
 
struct uicurrent_ui
 
struct uiui_list
 
static thread_local void(* thread_local_segv_handler )(int)
 
static struct serial_event * quit_serial_event
 
quit_handler_ftypequit_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
 

Macro Definition Documentation

◆ SERVER_COMMAND_PREFIX

#define SERVER_COMMAND_PREFIX   "server "

Function Documentation

◆ _initialize_event_top()

void _initialize_event_top ( )

Definition at line 1433 of file event-top.c.

Referenced by initialize_all_files().

◆ async_disable_stdin()

void async_disable_stdin ( void  )

◆ async_enable_stdin()

void async_enable_stdin ( void  )

◆ async_request_quit()

void async_request_quit ( gdb_client_data  arg)

Definition at line 1229 of file event-top.c.

References QUIT.

Referenced by gdb_init_signals().

◆ async_sigterm_handler()

static void async_sigterm_handler ( gdb_client_data  arg)
static

Definition at line 1206 of file event-top.c.

References quit_force().

Referenced by gdb_init_signals().

◆ change_line_handler()

void change_line_handler ( int  editing)

◆ command_handler()

void command_handler ( const char *  command)

◆ command_line_append_input_line()

static bool command_line_append_input_line ( std::string &  cmd_line_buffer,
const char *  rl 
)
static

Definition at line 629 of file event-top.c.

Referenced by handle_line_of_input().

◆ command_line_handler()

void command_line_handler ( gdb::unique_xmalloc_ptr< char > &&  rl)

◆ default_quit_handler()

void default_quit_handler ( void  )

◆ display_gdb_prompt()

void display_gdb_prompt ( const char *  new_prompt)

◆ gdb_disable_readline()

void gdb_disable_readline ( void  )

◆ gdb_init_signals()

void gdb_init_signals ( void  )

◆ gdb_readline_no_editing_callback()

void gdb_readline_no_editing_callback ( gdb_client_data  client_data)

◆ gdb_rl_callback_handler()

static void gdb_rl_callback_handler ( char *  rl)
staticnoexcept

Definition at line 235 of file event-top.c.

References current_ui, and ui::input_handler.

Referenced by gdb_rl_callback_handler_install().

◆ gdb_rl_callback_handler_install()

void gdb_rl_callback_handler_install ( const char *  prompt)

◆ gdb_rl_callback_handler_reinstall()

void gdb_rl_callback_handler_reinstall ( void  )

◆ gdb_rl_callback_handler_remove()

void gdb_rl_callback_handler_remove ( void  )

◆ gdb_rl_callback_read_char_wrapper()

static void gdb_rl_callback_read_char_wrapper ( gdb_client_data  client_data)
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().

◆ gdb_rl_callback_read_char_wrapper_noexcept()

static struct gdb_exception gdb_rl_callback_read_char_wrapper_noexcept ( )
staticnoexcept

Definition at line 178 of file event-top.c.

References after_char_processing_hook.

Referenced by gdb_rl_callback_read_char_wrapper().

◆ gdb_rl_deprep_term_function()

void gdb_rl_deprep_term_function ( void  )

Definition at line 756 of file event-top.c.

References printf_unfiltered().

Referenced by init_main().

◆ gdb_setup_readline()

void gdb_setup_readline ( int  editing)

◆ get_command_line_buffer()

static std::string & get_command_line_buffer ( void  )
static

Definition at line 490 of file event-top.c.

References current_ui, and ui::line_buffer.

Referenced by command_line_handler().

◆ handle_fatal_signal()

static void ATTRIBUTE_NORETURN handle_fatal_signal ( int  sig)
static

◆ handle_line_of_input()

const char * handle_line_of_input ( std::string &  cmd_line_buffer,
const char *  rl,
int  repeat,
const char *  annotation_suffix 
)

◆ handle_sigint()

void handle_sigint ( int  sig)

◆ handle_sigsegv()

static void handle_sigsegv ( int  sig)
static

◆ handle_sigterm()

void handle_sigterm ( int  sig)

◆ install_handle_sigsegv()

static void install_handle_sigsegv ( )
static

Definition at line 1004 of file event-top.c.

References handle_sigsegv().

Referenced by gdb_init_signals(), and handle_sigsegv().

◆ interruptible_select()

int interruptible_select ( int  n,
fd_set *  readfds,
fd_set *  writefds,
fd_set *  exceptfds,
struct timeval *  timeout 
)

◆ quit_serial_event_clear()

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().

◆ quit_serial_event_fd()

static int quit_serial_event_fd ( void  )
static

Definition at line 1127 of file event-top.c.

References quit_serial_event, and serial_event_fd().

Referenced by interruptible_select().

◆ quit_serial_event_set()

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().

◆ set_debug_event_loop_command()

static void set_debug_event_loop_command ( const char *  args,
int  from_tty,
cmd_list_element c 
)
static

◆ show_bt_on_fatal_signal()

static void show_bt_on_fatal_signal ( struct ui_file file,
int  from_tty,
struct cmd_list_element cmd,
const char *  value 
)
static

Definition at line 108 of file event-top.c.

References gdb_printf().

◆ show_debug_event_loop_command()

static void show_debug_event_loop_command ( struct ui_file file,
int  from_tty,
struct cmd_list_element cmd,
const char *  value 
)
static

Definition at line 1425 of file event-top.c.

References gdb_printf().

◆ stdin_event_handler()

static void stdin_event_handler ( int  error,
gdb_client_data  client_data 
)
static

◆ top_level_prompt()

static std::string top_level_prompt ( void  )
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().

◆ unblock_signal()

static bool unblock_signal ( int  sig)
static

Definition at line 925 of file event-top.c.

Referenced by handle_fatal_signal().

Variable Documentation

◆ after_char_processing_hook

void(* after_char_processing_hook) (void) ( void  )

◆ async_sigterm_token

struct async_signal_handler* async_sigterm_token
static

Definition at line 130 of file event-top.c.

Referenced by gdb_init_signals(), and handle_sigterm().

◆ bt_on_fatal_signal

bool bt_on_fatal_signal = GDB_PRINT_INTERNAL_BACKTRACE_INIT_ON
static

Definition at line 103 of file event-top.c.

Referenced by handle_fatal_signal().

◆ call_stdin_event_handler_again_p

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().

◆ callback_handler_installed

bool callback_handler_installed
static

◆ current_ui

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().

◆ debug_event_loop_all

const char debug_event_loop_all[] = "all"
static

Definition at line 1399 of file event-top.c.

Referenced by set_debug_event_loop_command().

◆ debug_event_loop_all_except_ui

const char debug_event_loop_all_except_ui[] = "all-except-ui"
static

Definition at line 1398 of file event-top.c.

Referenced by set_debug_event_loop_command().

◆ debug_event_loop_enum

const char* debug_event_loop_enum[]
static
Initial value:
= {
nullptr
}
static const char debug_event_loop_all_except_ui[]
Definition event-top.c:1398
static const char debug_event_loop_all[]
Definition event-top.c:1399
static const char debug_event_loop_off[]
Definition event-top.c:1397

Definition at line 1401 of file event-top.c.

◆ debug_event_loop_off

const char debug_event_loop_off[] = "off"
static

Definition at line 1397 of file event-top.c.

Referenced by set_debug_event_loop_command().

◆ debug_event_loop_value

const char* debug_event_loop_value = debug_event_loop_off
static

Definition at line 1408 of file event-top.c.

Referenced by set_debug_event_loop_command().

◆ exec_done_display_p

bool exec_done_display_p = false

Definition at line 94 of file event-top.c.

Referenced by fetch_inferior_event(), and init_main().

◆ main_ui

struct ui* main_ui

◆ quit_handler

◆ quit_serial_event

struct serial_event* quit_serial_event
static

◆ set_editing_cmd_var

bool set_editing_cmd_var

Definition at line 90 of file event-top.c.

Referenced by init_main(), and set_editing().

◆ sigint_token

struct async_signal_handler* sigint_token
static

Definition at line 120 of file event-top.c.

Referenced by gdb_init_signals(), and handle_sigint().

◆ sync_quit_force_run

volatile int sync_quit_force_run

Definition at line 1212 of file event-top.c.

Referenced by handle_sigterm(), maybe_quit(), and quit().

◆ thread_local_segv_handler

thread_local void(* thread_local_segv_handler) (int) ( int  )
static

◆ ui_list

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().