GDB (xrefs)
Classes | Macros | Typedefs | Enumerations | Functions | Variables
/tmp/gdb-7.10/gdb/ser-mingw.c File Reference
#include "defs.h"
#include "serial.h"
#include "ser-base.h"
#include "ser-tcp.h"
#include <windows.h>
#include <conio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include "command.h"

Go to the source code of this file.

Classes

struct  ser_windows_state
 
struct  ser_console_state
 
struct  ser_console_ttystate
 
struct  pipe_state
 
struct  net_windows_state
 

Macros

#define CancelIo   dyn_CancelIo
 

Typedefs

typedef DWORD WINAPI(* thread_fn_type) (void *)
 

Enumerations

enum  select_thread_state { STS_STARTED, STS_STOPPED }
 

Functions

void _initialize_ser_windows (void)
 
static int ser_windows_open (struct serial *scb, const char *name)
 
static int ser_windows_drain_output (struct serial *scb)
 
static int ser_windows_flush_output (struct serial *scb)
 
static int ser_windows_flush_input (struct serial *scb)
 
static int ser_windows_send_break (struct serial *scb)
 
static void ser_windows_raw (struct serial *scb)
 
static int ser_windows_setstopbits (struct serial *scb, int num)
 
static int ser_windows_setparity (struct serial *scb, int parity)
 
static int ser_windows_setbaudrate (struct serial *scb, int rate)
 
static void ser_windows_close (struct serial *scb)
 
static void ser_windows_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except)
 
static int ser_windows_read_prim (struct serial *scb, size_t count)
 
static int ser_windows_write_prim (struct serial *scb, const void *buf, size_t len)
 
static void select_thread_wait (struct ser_console_state *state)
 
static void create_select_thread (thread_fn_type thread_fn, struct serial *scb, struct ser_console_state *state)
 
static void destroy_select_thread (struct ser_console_state *state)
 
static void start_select_thread (struct ser_console_state *state)
 
static void stop_select_thread (struct ser_console_state *state)
 
static DWORD WINAPI console_select_thread (void *arg)
 
static int fd_is_pipe (int fd)
 
static int fd_is_file (int fd)
 
static DWORD WINAPI pipe_select_thread (void *arg)
 
static DWORD WINAPI file_select_thread (void *arg)
 
static void ser_console_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except)
 
static void ser_console_done_wait_handle (struct serial *scb)
 
static void ser_console_close (struct serial *scb)
 
static serial_ttystate ser_console_get_tty_state (struct serial *scb)
 
static struct pipe_statemake_pipe_state (void)
 
static void free_pipe_state (struct pipe_state *ps)
 
static void cleanup_pipe_state (void *untyped)
 
static int pipe_windows_open (struct serial *scb, const char *name)
 
static int pipe_windows_fdopen (struct serial *scb, int fd)
 
static void pipe_windows_close (struct serial *scb)
 
static int pipe_windows_read (struct serial *scb, size_t count)
 
static int pipe_windows_write (struct serial *scb, const void *buf, size_t count)
 
static void pipe_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except)
 
static void pipe_done_wait_handle (struct serial *scb)
 
static int pipe_avail (struct serial *scb, int fd)
 
int gdb_pipe (int pdes[2])
 
static int net_windows_socket_check_pending (struct serial *scb)
 
static DWORD WINAPI net_windows_select_thread (void *arg)
 
static void net_windows_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except)
 
static void net_windows_done_wait_handle (struct serial *scb)
 
static int net_windows_open (struct serial *scb, const char *name)
 
static void net_windows_close (struct serial *scb)
 

Variables

static BOOL WINAPI(* CancelIo )(HANDLE)
 
static const struct serial_ops hardwire_ops
 
static const struct serial_ops tty_ops
 
static const struct serial_ops pipe_ops
 
static const struct serial_ops tcp_ops
 

Macro Definition Documentation

#define CancelIo   dyn_CancelIo

Definition at line 46 of file ser-mingw.c.

Referenced by _initialize_ser_windows(), and ser_windows_close().

Typedef Documentation

typedef DWORD WINAPI(* thread_fn_type) (void *)

Definition at line 456 of file ser-mingw.c.

Enumeration Type Documentation

Enumerator
STS_STARTED 
STS_STOPPED 

Definition at line 393 of file ser-mingw.c.

Function Documentation

void _initialize_ser_windows ( void  )

Definition at line 1366 of file ser-mingw.c.

References CancelIo, and serial_add_interface().

static void cleanup_pipe_state ( void *  untyped)
static

Definition at line 858 of file ser-mingw.c.

References free_pipe_state(), and cleanup_check::ps.

Referenced by pipe_windows_open().

static DWORD WINAPI console_select_thread ( void *  arg)
static
static void create_select_thread ( thread_fn_type  thread_fn,
struct serial scb,
struct ser_console_state state 
)
static
static void destroy_select_thread ( struct ser_console_state state)
static
static int fd_is_file ( int  fd)
static

Definition at line 628 of file ser-mingw.c.

Referenced by ser_console_wait_handle().

static int fd_is_pipe ( int  fd)
static

Definition at line 619 of file ser-mingw.c.

Referenced by ser_console_wait_handle().

static DWORD WINAPI file_select_thread ( void *  arg)
static
static void free_pipe_state ( struct pipe_state ps)
static
int gdb_pipe ( int  pdes[2])

Definition at line 1064 of file ser-mingw.c.

static struct pipe_state* make_pipe_state ( void  )
static
static void net_windows_close ( struct serial scb)
static
static void net_windows_done_wait_handle ( struct serial scb)
static

Definition at line 1193 of file ser-mingw.c.

References net_windows_state::base, serial::state, and stop_select_thread().

static int net_windows_open ( struct serial scb,
const char *  name 
)
static
static DWORD WINAPI net_windows_select_thread ( void *  arg)
static
static int net_windows_socket_check_pending ( struct serial scb)
static
static void net_windows_wait_handle ( struct serial scb,
HANDLE *  read,
HANDLE *  except 
)
static
static int pipe_avail ( struct serial scb,
int  fd 
)
static

Definition at line 1052 of file ser-mingw.c.

References BOOL.

static void pipe_done_wait_handle ( struct serial scb)
static
static DWORD WINAPI pipe_select_thread ( void *  arg)
static
static void pipe_wait_handle ( struct serial scb,
HANDLE *  read,
HANDLE *  except 
)
static
static void pipe_windows_close ( struct serial scb)
static

Definition at line 961 of file ser-mingw.c.

References free_pipe_state(), cleanup_check::ps, and serial::state.

static int pipe_windows_fdopen ( struct serial scb,
int  fd 
)
static
static int pipe_windows_open ( struct serial scb,
const char *  name 
)
static
static int pipe_windows_read ( struct serial scb,
size_t  count 
)
static

Definition at line 974 of file ser-mingw.c.

References available, serial::buf, and serial::fd.

static int pipe_windows_write ( struct serial scb,
const void *  buf,
size_t  count 
)
static

Definition at line 997 of file ser-mingw.c.

References pipe_state::input, cleanup_check::ps, and serial::state.

static void select_thread_wait ( struct ser_console_state state)
static
static void ser_console_close ( struct serial scb)
static

Definition at line 772 of file ser-mingw.c.

References destroy_select_thread(), serial::state, and xfree().

static void ser_console_done_wait_handle ( struct serial scb)
static

Definition at line 761 of file ser-mingw.c.

References serial::state, and stop_select_thread().

static serial_ttystate ser_console_get_tty_state ( struct serial scb)
static

Definition at line 789 of file ser-mingw.c.

References serial::fd, ser_console_ttystate::is_a_tty, and xmalloc().

static void ser_console_wait_handle ( struct serial scb,
HANDLE *  read,
HANDLE *  except 
)
static
static void ser_windows_close ( struct serial scb)
static
static int ser_windows_drain_output ( struct serial scb)
static

Definition at line 107 of file ser-mingw.c.

References serial::fd.

static int ser_windows_flush_input ( struct serial scb)
static

Definition at line 123 of file ser-mingw.c.

References serial::fd.

static int ser_windows_flush_output ( struct serial scb)
static

Definition at line 115 of file ser-mingw.c.

References serial::fd.

static int ser_windows_open ( struct serial scb,
const char *  name 
)
static
static void ser_windows_raw ( struct serial scb)
static

Definition at line 148 of file ser-mingw.c.

References _, serial::current_timeout, serial::fd, and warning().

static int ser_windows_read_prim ( struct serial scb,
size_t  count 
)
static
static int ser_windows_send_break ( struct serial scb)
static

Definition at line 131 of file ser-mingw.c.

References serial::fd.

static int ser_windows_setbaudrate ( struct serial scb,
int  rate 
)
static

Definition at line 234 of file ser-mingw.c.

References serial::fd, and rate.

static int ser_windows_setparity ( struct serial scb,
int  parity 
)
static

Definition at line 202 of file ser-mingw.c.

References serial::fd, GDBPARITY_EVEN, GDBPARITY_NONE, GDBPARITY_ODD, and internal_warning().

static int ser_windows_setstopbits ( struct serial scb,
int  num 
)
static
static void ser_windows_wait_handle ( struct serial scb,
HANDLE *  read,
HANDLE *  except 
)
static
static int ser_windows_write_prim ( struct serial scb,
const void *  buf,
size_t  len 
)
static

Definition at line 356 of file ser-mingw.c.

References serial::fd, and ser_windows_state::ov.

static void start_select_thread ( struct ser_console_state state)
static
static void stop_select_thread ( struct ser_console_state state)
static

Variable Documentation

BOOL WINAPI(* CancelIo) (HANDLE)
static

Definition at line 47 of file ser-mingw.c.

const struct serial_ops hardwire_ops
static
Initial value:
=
{
"hardwire",
NULL,
NULL,
}
static int ser_windows_drain_output(struct serial *scb)
Definition: ser-mingw.c:107
static int ser_windows_write_prim(struct serial *scb, const void *buf, size_t len)
Definition: ser-mingw.c:356
static void ser_windows_close(struct serial *scb)
Definition: ser-mingw.c:248
int ser_base_set_tty_state(struct serial *scb, serial_ttystate ttystate)
Definition: ser-base.c:510
static int ser_windows_setparity(struct serial *scb, int parity)
Definition: ser-mingw.c:202
static int ser_windows_send_break(struct serial *scb)
Definition: ser-mingw.c:131
void ser_base_async(struct serial *scb, int async_p)
Definition: ser-base.c:555
int ser_base_noflush_set_tty_state(struct serial *scb, serial_ttystate new_ttystate, serial_ttystate old_ttystate)
Definition: ser-base.c:516
static int ser_windows_open(struct serial *scb, const char *name)
Definition: ser-mingw.c:52
static int ser_windows_setstopbits(struct serial *scb, int num)
Definition: ser-mingw.c:173
static void ser_windows_raw(struct serial *scb)
Definition: ser-mingw.c:148
static int ser_windows_flush_input(struct serial *scb)
Definition: ser-mingw.c:123
void ser_base_print_tty_state(struct serial *scb, serial_ttystate ttystate, struct ui_file *stream)
Definition: ser-base.c:524
int ser_base_readchar(struct serial *scb, int timeout)
Definition: ser-base.c:435
static int ser_windows_read_prim(struct serial *scb, size_t count)
Definition: ser-mingw.c:324
int ser_base_write(struct serial *scb, const void *buf, size_t count)
Definition: ser-base.c:441
static void ser_windows_wait_handle(struct serial *scb, HANDLE *read, HANDLE *except)
Definition: ser-mingw.c:272
static int ser_windows_flush_output(struct serial *scb)
Definition: ser-mingw.c:115
serial_ttystate ser_base_copy_tty_state(struct serial *scb, serial_ttystate ttystate)
Definition: ser-base.c:503
serial_ttystate ser_base_get_tty_state(struct serial *scb)
Definition: ser-base.c:496
static int ser_windows_setbaudrate(struct serial *scb, int rate)
Definition: ser-mingw.c:234

Definition at line 1241 of file ser-mingw.c.

const struct serial_ops pipe_ops
static
Initial value:
=
{
"pipe",
}
int ser_base_set_tty_state(struct serial *scb, serial_ttystate ttystate)
Definition: ser-base.c:510
int ser_base_flush_output(struct serial *scb)
Definition: ser-base.c:459
static void pipe_done_wait_handle(struct serial *scb)
Definition: ser-mingw.c:1040
static int pipe_avail(struct serial *scb, int fd)
Definition: ser-mingw.c:1052
static void pipe_wait_handle(struct serial *scb, HANDLE *read, HANDLE *except)
Definition: ser-mingw.c:1019
int ser_base_setbaudrate(struct serial *scb, int rate)
Definition: ser-base.c:533
int ser_base_setstopbits(struct serial *scb, int num)
Definition: ser-base.c:539
void ser_base_raw(struct serial *scb)
Definition: ser-base.c:490
void ser_base_async(struct serial *scb, int async_p)
Definition: ser-base.c:555
int ser_base_noflush_set_tty_state(struct serial *scb, serial_ttystate new_ttystate, serial_ttystate old_ttystate)
Definition: ser-base.c:516
int ser_base_drain_output(struct serial *scb)
Definition: ser-base.c:484
static int pipe_windows_read(struct serial *scb, size_t count)
Definition: ser-mingw.c:974
void ser_base_print_tty_state(struct serial *scb, serial_ttystate ttystate, struct ui_file *stream)
Definition: ser-base.c:524
int ser_base_setparity(struct serial *scb, int parity)
Definition: ser-base.c:547
static int pipe_windows_write(struct serial *scb, const void *buf, size_t count)
Definition: ser-mingw.c:997
int ser_base_flush_input(struct serial *scb)
Definition: ser-base.c:465
int ser_base_readchar(struct serial *scb, int timeout)
Definition: ser-base.c:435
int ser_base_send_break(struct serial *scb)
Definition: ser-base.c:478
int ser_base_write(struct serial *scb, const void *buf, size_t count)
Definition: ser-base.c:441
serial_ttystate ser_base_copy_tty_state(struct serial *scb, serial_ttystate ttystate)
Definition: ser-base.c:503
static int pipe_windows_open(struct serial *scb, const char *name)
Definition: ser-mingw.c:866
static int pipe_windows_fdopen(struct serial *scb, int fd)
Definition: ser-mingw.c:936
static void pipe_windows_close(struct serial *scb)
Definition: ser-mingw.c:961
serial_ttystate ser_base_get_tty_state(struct serial *scb)
Definition: ser-base.c:496

Definition at line 1305 of file ser-mingw.c.

const struct serial_ops tcp_ops
static
Initial value:
=
{
"tcp",
NULL,
NULL,
}
static int net_windows_open(struct serial *scb, const char *name)
Definition: ser-mingw.c:1201
int ser_base_set_tty_state(struct serial *scb, serial_ttystate ttystate)
Definition: ser-base.c:510
int ser_base_flush_output(struct serial *scb)
Definition: ser-base.c:459
static void net_windows_done_wait_handle(struct serial *scb)
Definition: ser-mingw.c:1193
static void net_windows_wait_handle(struct serial *scb, HANDLE *read, HANDLE *except)
Definition: ser-mingw.c:1174
int net_write_prim(struct serial *scb, const void *buf, size_t count)
Definition: ser-tcp.c:348
int ser_base_setbaudrate(struct serial *scb, int rate)
Definition: ser-base.c:533
int ser_base_setstopbits(struct serial *scb, int num)
Definition: ser-base.c:539
void ser_base_raw(struct serial *scb)
Definition: ser-base.c:490
void ser_base_async(struct serial *scb, int async_p)
Definition: ser-base.c:555
int net_read_prim(struct serial *scb, size_t count)
Definition: ser-tcp.c:339
int ser_base_noflush_set_tty_state(struct serial *scb, serial_ttystate new_ttystate, serial_ttystate old_ttystate)
Definition: ser-base.c:516
static void net_windows_close(struct serial *scb)
Definition: ser-mingw.c:1227
int ser_base_drain_output(struct serial *scb)
Definition: ser-base.c:484
void ser_base_print_tty_state(struct serial *scb, serial_ttystate ttystate, struct ui_file *stream)
Definition: ser-base.c:524
int ser_base_setparity(struct serial *scb, int parity)
Definition: ser-base.c:547
int ser_base_flush_input(struct serial *scb)
Definition: ser-base.c:465
int ser_base_readchar(struct serial *scb, int timeout)
Definition: ser-base.c:435
int ser_base_write(struct serial *scb, const void *buf, size_t count)
Definition: ser-base.c:441
int ser_tcp_send_break(struct serial *scb)
Definition: ser-tcp.c:354
serial_ttystate ser_base_copy_tty_state(struct serial *scb, serial_ttystate ttystate)
Definition: ser-base.c:503
serial_ttystate ser_base_get_tty_state(struct serial *scb)
Definition: ser-base.c:496

Definition at line 1336 of file ser-mingw.c.

const struct serial_ops tty_ops
static
Initial value:
=
{
"terminal",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
}
int ser_base_set_tty_state(struct serial *scb, serial_ttystate ttystate)
Definition: ser-base.c:510
static serial_ttystate ser_console_get_tty_state(struct serial *scb)
Definition: ser-mingw.c:789
static void ser_console_done_wait_handle(struct serial *scb)
Definition: ser-mingw.c:761
static void ser_console_wait_handle(struct serial *scb, HANDLE *read, HANDLE *except)
Definition: ser-mingw.c:706
static void ser_console_close(struct serial *scb)
Definition: ser-mingw.c:772
int ser_base_noflush_set_tty_state(struct serial *scb, serial_ttystate new_ttystate, serial_ttystate old_ttystate)
Definition: ser-base.c:516
int ser_base_drain_output(struct serial *scb)
Definition: ser-base.c:484
void ser_base_print_tty_state(struct serial *scb, serial_ttystate ttystate, struct ui_file *stream)
Definition: ser-base.c:524
serial_ttystate ser_base_copy_tty_state(struct serial *scb, serial_ttystate ttystate)
Definition: ser-base.c:503

Definition at line 1274 of file ser-mingw.c.