GDB (xrefs)
Classes | Macros | Typedefs | Functions | Variables
/tmp/gdb-7.10/gdb/event-loop.c File Reference
#include "defs.h"
#include "event-loop.h"
#include "event-top.h"
#include "queue.h"
#include <poll.h>
#include <sys/types.h>
#include <sys/time.h>
#include "gdb_select.h"
#include "observer.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)
 
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 call_async_signal_handler (struct async_signal_handler *handler)
 
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 milliseconds, timer_handler_func *proc, gdb_client_data client_data)
 
void delete_timer (int id)
 

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
 

Macro Definition Documentation

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

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

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

#define USE_POLL   1

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

Typedef Documentation

typedef union event_data event_data
typedef void( event_handler_func) (event_data)

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

typedef struct file_handler file_handler
typedef struct gdb_event gdb_event

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

typedef struct gdb_event * gdb_event_p

Function Documentation

void add_file_handler ( int  fd,
handler_func proc,
gdb_client_data  client_data 
)
int async_signal_handler_is_marked ( async_signal_handler async_handler_ptr)

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

References async_signal_handler::ready.

Referenced by remote_check_pending_interrupt().

void call_async_signal_handler ( struct async_signal_handler handler)
static int check_async_event_handlers ( void  )
static
void clear_async_event_handler ( async_event_handler async_handler_ptr)

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

References async_event_handler::ready.

Referenced by record_btrace_async(), record_full_async(), and remote_async().

void clear_async_signal_handler ( async_signal_handler async_handler_ptr)

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

References async_signal_handler::ready.

Referenced by remote_check_pending_interrupt().

async_event_handler* create_async_event_handler ( async_event_handler_func proc,
gdb_client_data  client_data 
)
async_signal_handler* create_async_signal_handler ( sig_handler_func proc,
gdb_client_data  client_data 
)
static void create_file_handler ( int  fd,
int  mask,
handler_func proc,
gdb_client_data  client_data 
)
static
int create_timer ( int  milliseconds,
timer_handler_func proc,
gdb_client_data  client_data 
)
void delete_async_event_handler ( async_event_handler **  async_handler_ptr)
void delete_async_signal_handler ( async_signal_handler **  async_handler_ptr)

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

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

void delete_file_handler ( int  fd)
void delete_timer ( int  id)

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

References gdb_notifier, gdb_timer::next, gdb_timer::timer_id, timer_list, and xfree().

Referenced by reschedule(), and ser_base_async().

int gdb_do_one_event ( void  )
static int gdb_wait_for_event ( int  block)
static
static file_handler* get_next_file_handler_to_handle_and_advance ( void  )
static

Definition at line 516 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().

static void handle_file_event ( file_handler file_ptr,
int  ready_mask 
)
static
static int invoke_async_signal_handlers ( void  )
static
void mark_async_event_handler ( async_event_handler async_handler_ptr)
void mark_async_signal_handler ( async_signal_handler async_handler_ptr)
static int poll_timers ( void  )
static
void start_event_loop ( void  )
static int update_wait_timeout ( void  )
static

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

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

Referenced by gdb_wait_for_event(), and poll_timers().

Variable Documentation

struct { ... } async_event_handler_list
fd_set check_masks[3]

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

file_handler* first_file_handler

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

async_event_handler* first_handler

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

struct gdb_timer* first_timer

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

struct { ... } gdb_notifier
async_event_handler* last_handler

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

file_handler* next_file_handler

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

int next_poll_fds_index

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

int num_fds

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

Referenced by ioscm_input_waiting().

int num_timers

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

struct pollfd* poll_fds

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

int poll_timeout

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

fd_set ready_masks[3]

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

struct timeval select_timeout

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

Referenced by gdb_wait_for_event().

struct { ... } sighandler_list
int timeout_valid

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

struct { ... } timer_list
unsigned char use_poll = USE_POLL
static