GDB (xrefs)
Classes | Macros | Typedefs | Functions | Variables
/tmp/gdb-8.1/gdb/event-loop.c File Reference
#include "defs.h"
#include "event-loop.h"
#include "event-top.h"
#include "queue.h"
#include "ser-event.h"
#include <poll.h>
#include <sys/types.h>
#include "gdb_sys_time.h"
#include "gdb_select.h"
#include "observer.h"
#include "top.h"

Go to the source code of this file.

Classes

union  event_data
 
struct  gdb_event
 
struct  file_handler
 
struct  async_signal_handler
 
struct  async_event_handler
 
struct  gdb_timer
 

Macros

#define GDB_READABLE   (1<<1)
 
#define GDB_WRITABLE   (1<<2)
 
#define GDB_EXCEPTION   (1<<3)
 
#define USE_POLL   1
 

Typedefs

typedef union event_data event_data
 
typedef struct gdb_event gdb_event
 
typedef void() event_handler_func(event_data)
 
typedef struct gdb_eventgdb_event_p
 
typedef struct file_handler file_handler
 
typedef struct async_signal_handler async_signal_handler
 
typedef struct async_event_handler async_event_handler
 

Functions

static int invoke_async_signal_handlers (void)
 
static void create_file_handler (int fd, int mask, handler_func *proc, gdb_client_data client_data)
 
static int check_async_event_handlers (void)
 
static int gdb_wait_for_event (int)
 
static int update_wait_timeout (void)
 
static int poll_timers (void)
 
static void async_signals_handler (int error, gdb_client_data client_data)
 
void initialize_async_signal_handlers (void)
 
int gdb_do_one_event (void)
 
void start_event_loop (void)
 
void add_file_handler (int fd, handler_func *proc, gdb_client_data client_data)
 
static file_handlerget_next_file_handler_to_handle_and_advance (void)
 
void delete_file_handler (int fd)
 
static void handle_file_event (file_handler *file_ptr, int ready_mask)
 
async_signal_handlercreate_async_signal_handler (sig_handler_func *proc, gdb_client_data client_data)
 
void mark_async_signal_handler (async_signal_handler *async_handler_ptr)
 
void clear_async_signal_handler (async_signal_handler *async_handler_ptr)
 
int async_signal_handler_is_marked (async_signal_handler *async_handler_ptr)
 
void delete_async_signal_handler (async_signal_handler **async_handler_ptr)
 
async_event_handlercreate_async_event_handler (async_event_handler_func *proc, gdb_client_data client_data)
 
void mark_async_event_handler (async_event_handler *async_handler_ptr)
 
void clear_async_event_handler (async_event_handler *async_handler_ptr)
 
void delete_async_event_handler (async_event_handler **async_handler_ptr)
 
int create_timer (int ms, timer_handler_func *proc, gdb_client_data client_data)
 
void delete_timer (int id)
 
template<typename Duration >
static struct timeval duration_cast_timeval (const Duration &d)
 

Variables

static unsigned char use_poll = USE_POLL
 
struct {
   file_handler *   first_file_handler
 
   file_handler *   next_file_handler
 
   struct pollfd *   poll_fds
 
   int   next_poll_fds_index
 
   int   poll_timeout
 
   fd_set   check_masks [3]
 
   fd_set   ready_masks [3]
 
   int   num_fds
 
   struct timeval   select_timeout
 
   int   timeout_valid
 
gdb_notifier
 
struct {
   struct gdb_timer *   first_timer
 
   int   num_timers
 
timer_list
 
struct {
   async_signal_handler *   first_handler
 
   async_signal_handler *   last_handler
 
sighandler_list
 
struct {
   async_event_handler *   first_handler
 
   async_event_handler *   last_handler
 
async_event_handler_list
 
static struct serial_event * async_signal_handlers_serial_event
 

Macro Definition Documentation

◆ GDB_EXCEPTION

#define GDB_EXCEPTION   (1<<3)

◆ GDB_READABLE

#define GDB_READABLE   (1<<1)

◆ GDB_WRITABLE

#define GDB_WRITABLE   (1<<2)

Definition at line 44 of file event-loop.c.

Referenced by create_file_handler(), delete_file_handler(), and gdb_wait_for_event().

◆ USE_POLL

#define USE_POLL   1

Definition at line 153 of file event-loop.c.

Typedef Documentation

◆ async_event_handler

◆ async_signal_handler

◆ event_data

typedef union event_data event_data

◆ event_handler_func

typedef void() event_handler_func(event_data)

Definition at line 55 of file event-loop.c.

◆ file_handler

typedef struct file_handler file_handler

◆ gdb_event

typedef struct gdb_event gdb_event

Definition at line 54 of file event-loop.c.

◆ gdb_event_p

typedef struct gdb_event * gdb_event_p

Function Documentation

◆ add_file_handler()

void add_file_handler ( int  fd,
handler_func proc,
gdb_client_data  client_data 
)

◆ async_signal_handler_is_marked()

int async_signal_handler_is_marked ( async_signal_handler async_handler_ptr)

Definition at line 938 of file event-loop.c.

References async_signal_handler::ready.

◆ async_signals_handler()

static void async_signals_handler ( int  error,
gdb_client_data  client_data 
)
static

Definition at line 274 of file event-loop.c.

Referenced by initialize_async_signal_handlers().

◆ check_async_event_handlers()

static int check_async_event_handlers ( void  )
static

◆ clear_async_event_handler()

void clear_async_event_handler ( async_event_handler async_handler_ptr)

◆ clear_async_signal_handler()

void clear_async_signal_handler ( async_signal_handler async_handler_ptr)

Definition at line 930 of file event-loop.c.

References async_signal_handler::ready.

◆ create_async_event_handler()

async_event_handler* create_async_event_handler ( async_event_handler_func proc,
gdb_client_data  client_data 
)

◆ create_async_signal_handler()

async_signal_handler* create_async_signal_handler ( sig_handler_func proc,
gdb_client_data  client_data 
)

◆ create_file_handler()

static void create_file_handler ( int  fd,
int  mask,
handler_func proc,
gdb_client_data  client_data 
)
static

◆ create_timer()

int create_timer ( int  ms,
timer_handler_func proc,
gdb_client_data  client_data 
)

◆ delete_async_event_handler()

void delete_async_event_handler ( async_event_handler **  async_handler_ptr)

◆ delete_async_signal_handler()

void delete_async_signal_handler ( async_signal_handler **  async_handler_ptr)

Definition at line 984 of file event-loop.c.

References gdb_assert, async_signal_handler::next_handler, sighandler_list, and xfree().

◆ delete_file_handler()

void delete_file_handler ( int  fd)

◆ delete_timer()

void delete_timer ( int  id)

Definition at line 1156 of file event-loop.c.

References gdb_notifier, gdb_timer::next, gdb_timer::timer_id, and timer_list.

Referenced by reschedule(), and ser_base_async().

◆ duration_cast_timeval()

template<typename Duration >
static struct timeval duration_cast_timeval ( const Duration &  d)
static

Definition at line 1191 of file event-loop.c.

Referenced by update_wait_timeout().

◆ gdb_do_one_event()

int gdb_do_one_event ( void  )

◆ gdb_wait_for_event()

static int gdb_wait_for_event ( int  block)
static

◆ get_next_file_handler_to_handle_and_advance()

static file_handler* get_next_file_handler_to_handle_and_advance ( void  )
static

Definition at line 541 of file event-loop.c.

References gdb_assert, gdb_notifier, and file_handler::next_file.

Referenced by delete_file_handler(), and gdb_wait_for_event().

◆ handle_file_event()

static void handle_file_event ( file_handler file_ptr,
int  ready_mask 
)
static

◆ initialize_async_signal_handlers()

void initialize_async_signal_handlers ( void  )

◆ invoke_async_signal_handlers()

static int invoke_async_signal_handlers ( void  )
static

◆ mark_async_event_handler()

void mark_async_event_handler ( async_event_handler async_handler_ptr)

◆ mark_async_signal_handler()

void mark_async_signal_handler ( async_signal_handler async_handler_ptr)

◆ poll_timers()

static int poll_timers ( void  )
static

◆ start_event_loop()

void start_event_loop ( void  )

◆ update_wait_timeout()

static int update_wait_timeout ( void  )
static

Definition at line 1207 of file event-loop.c.

References _, duration_cast_timeval(), gdb_notifier, internal_error(), timer_list, and use_poll.

Referenced by gdb_wait_for_event(), and poll_timers().

Variable Documentation

◆ async_event_handler_list

struct { ... } async_event_handler_list

◆ async_signal_handlers_serial_event

struct serial_event* async_signal_handlers_serial_event
static

◆ check_masks

fd_set check_masks[3]

Definition at line 194 of file event-loop.c.

◆ first_file_handler

file_handler* first_file_handler

Definition at line 168 of file event-loop.c.

◆ first_handler

async_event_handler* first_handler

Definition at line 239 of file event-loop.c.

◆ first_timer

struct gdb_timer* first_timer

Definition at line 227 of file event-loop.c.

◆ gdb_notifier

struct { ... } gdb_notifier

◆ last_handler

async_event_handler* last_handler

Definition at line 242 of file event-loop.c.

◆ next_file_handler

file_handler* next_file_handler

Definition at line 175 of file event-loop.c.

◆ next_poll_fds_index

int next_poll_fds_index

Definition at line 186 of file event-loop.c.

◆ num_fds

int num_fds

Definition at line 201 of file event-loop.c.

Referenced by ioscm_input_waiting().

◆ num_timers

int num_timers

Definition at line 230 of file event-loop.c.

◆ poll_fds

struct pollfd* poll_fds

Definition at line 179 of file event-loop.c.

◆ poll_timeout

int poll_timeout

Definition at line 189 of file event-loop.c.

◆ ready_masks

fd_set ready_masks[3]

Definition at line 197 of file event-loop.c.

◆ select_timeout

struct timeval select_timeout

Definition at line 204 of file event-loop.c.

Referenced by gdb_wait_for_event().

◆ sighandler_list

struct { ... } sighandler_list

◆ timeout_valid

int timeout_valid

Definition at line 207 of file event-loop.c.

◆ timer_list

struct { ... } timer_list

◆ use_poll

unsigned char use_poll = USE_POLL
static