GDB (xrefs)
Classes | Macros | Typedefs | Enumerations | Functions | Variables
/tmp/gdb-8.1/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 BOOL WINAPI() CancelIo_ftype(HANDLE)
 
typedef DWORD WINAPI(* thread_fn_type) (void *)
 

Enumerations

enum  select_thread_state { STS_STARTED, STS_STOPPED }
 

Functions

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)
 
void _initialize_ser_windows (void)
 

Variables

static CancelIo_ftypeCancelIo
 
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

◆ CancelIo

#define CancelIo   dyn_CancelIo

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

Referenced by _initialize_ser_windows(), and ser_windows_close().

Typedef Documentation

◆ CancelIo_ftype

typedef BOOL WINAPI() CancelIo_ftype(HANDLE)

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

◆ thread_fn_type

typedef DWORD WINAPI(* thread_fn_type) (void *)

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

Enumeration Type Documentation

◆ select_thread_state

Enumerator
STS_STARTED 
STS_STOPPED 

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

Function Documentation

◆ _initialize_ser_windows()

void _initialize_ser_windows ( void  )

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

References CancelIo, hardwire_ops, pipe_ops, serial_add_interface(), tcp_ops, and tty_ops.

◆ cleanup_pipe_state()

static void cleanup_pipe_state ( void *  untyped)
static

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

References free_pipe_state(), and cleanup_check::ps.

Referenced by pipe_windows_open().

◆ console_select_thread()

static DWORD WINAPI console_select_thread ( void *  arg)
static

◆ create_select_thread()

static void create_select_thread ( thread_fn_type  thread_fn,
struct serial scb,
struct ser_console_state state 
)
static

◆ destroy_select_thread()

static void destroy_select_thread ( struct ser_console_state state)
static

◆ fd_is_file()

static int fd_is_file ( int  fd)
static

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

Referenced by ser_console_wait_handle().

◆ fd_is_pipe()

static int fd_is_pipe ( int  fd)
static

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

Referenced by ser_console_wait_handle().

◆ file_select_thread()

static DWORD WINAPI file_select_thread ( void *  arg)
static

◆ free_pipe_state()

static void free_pipe_state ( struct pipe_state ps)
static

◆ gdb_pipe()

int gdb_pipe ( int  pdes[2])

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

◆ make_pipe_state()

static struct pipe_state* make_pipe_state ( void  )
static

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

References cleanup_check::ps, and XCNEW.

Referenced by pipe_windows_fdopen(), and pipe_windows_open().

◆ net_windows_close()

static void net_windows_close ( struct serial scb)
static

◆ net_windows_done_wait_handle()

static void net_windows_done_wait_handle ( struct serial scb)
static

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

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

◆ net_windows_open()

static int net_windows_open ( struct serial scb,
const char *  name 
)
static

◆ net_windows_select_thread()

static DWORD WINAPI net_windows_select_thread ( void *  arg)
static

◆ net_windows_socket_check_pending()

static int net_windows_socket_check_pending ( struct serial scb)
static

◆ net_windows_wait_handle()

static void net_windows_wait_handle ( struct serial scb,
HANDLE *  read,
HANDLE *  except 
)
static

◆ pipe_avail()

static int pipe_avail ( struct serial scb,
int  fd 
)
static

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

References BOOL.

◆ pipe_done_wait_handle()

static void pipe_done_wait_handle ( struct serial scb)
static

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

References if(), cleanup_check::ps, serial::state, and stop_select_thread().

◆ pipe_select_thread()

static DWORD WINAPI pipe_select_thread ( void *  arg)
static

◆ pipe_wait_handle()

static void pipe_wait_handle ( struct serial scb,
HANDLE *  read,
HANDLE *  except 
)
static

◆ pipe_windows_close()

static void pipe_windows_close ( struct serial scb)
static

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

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

◆ pipe_windows_fdopen()

static int pipe_windows_fdopen ( struct serial scb,
int  fd 
)
static

◆ pipe_windows_open()

static int pipe_windows_open ( struct serial scb,
const char *  name 
)
static

◆ pipe_windows_read()

static int pipe_windows_read ( struct serial scb,
size_t  count 
)
static

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

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

◆ pipe_windows_write()

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

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

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

◆ select_thread_wait()

static void select_thread_wait ( struct ser_console_state state)
static

◆ ser_console_close()

static void ser_console_close ( struct serial scb)
static

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

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

◆ ser_console_done_wait_handle()

static void ser_console_done_wait_handle ( struct serial scb)
static

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

References if(), serial::state, and stop_select_thread().

◆ ser_console_get_tty_state()

static serial_ttystate ser_console_get_tty_state ( struct serial scb)
static

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

References serial::fd, ser_console_ttystate::is_a_tty, and XNEW.

◆ ser_console_wait_handle()

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

◆ ser_windows_close()

static void ser_windows_close ( struct serial scb)
static

◆ ser_windows_drain_output()

static int ser_windows_drain_output ( struct serial scb)
static

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

References serial::fd.

◆ ser_windows_flush_input()

static int ser_windows_flush_input ( struct serial scb)
static

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

References serial::fd.

◆ ser_windows_flush_output()

static int ser_windows_flush_output ( struct serial scb)
static

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

References serial::fd.

◆ ser_windows_open()

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

◆ ser_windows_raw()

static void ser_windows_raw ( struct serial scb)
static

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

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

◆ ser_windows_read_prim()

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

◆ ser_windows_send_break()

static int ser_windows_send_break ( struct serial scb)
static

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

References serial::fd.

◆ ser_windows_setbaudrate()

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

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

References serial::fd, and rate.

◆ ser_windows_setparity()

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

◆ ser_windows_setstopbits()

static int ser_windows_setstopbits ( struct serial scb,
int  num 
)
static

◆ ser_windows_wait_handle()

static void ser_windows_wait_handle ( struct serial scb,
HANDLE *  read,
HANDLE *  except 
)
static

◆ ser_windows_write_prim()

static int ser_windows_write_prim ( struct serial scb,
const void *  buf,
size_t  len 
)
static

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

References serial::fd, memset(), and ser_windows_state::ov.

◆ start_select_thread()

static void start_select_thread ( struct ser_console_state state)
static

◆ stop_select_thread()

static void stop_select_thread ( struct ser_console_state state)
static

Variable Documentation

◆ CancelIo

CancelIo_ftype* CancelIo
static

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

◆ hardwire_ops

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:105
static int ser_windows_write_prim(struct serial *scb, const void *buf, size_t len)
Definition: ser-mingw.c:352
static void ser_windows_close(struct serial *scb)
Definition: ser-mingw.c:244
int ser_base_set_tty_state(struct serial *scb, serial_ttystate ttystate)
Definition: ser-base.c:549
static int ser_windows_setparity(struct serial *scb, int parity)
Definition: ser-mingw.c:198
static int ser_windows_send_break(struct serial *scb)
Definition: ser-mingw.c:129
void ser_base_async(struct serial *scb, int async_p)
Definition: ser-base.c:586
static int ser_windows_open(struct serial *scb, const char *name)
Definition: ser-mingw.c:51
static int ser_windows_setstopbits(struct serial *scb, int num)
Definition: ser-mingw.c:169
static void ser_windows_raw(struct serial *scb)
Definition: ser-mingw.c:146
static int ser_windows_flush_input(struct serial *scb)
Definition: ser-mingw.c:121
void ser_base_print_tty_state(struct serial *scb, serial_ttystate ttystate, struct ui_file *stream)
Definition: ser-base.c:555
int ser_base_readchar(struct serial *scb, int timeout)
Definition: ser-base.c:468
static int ser_windows_read_prim(struct serial *scb, size_t count)
Definition: ser-mingw.c:320
int ser_base_write(struct serial *scb, const void *buf, size_t count)
Definition: ser-base.c:474
static void ser_windows_wait_handle(struct serial *scb, HANDLE *read, HANDLE *except)
Definition: ser-mingw.c:268
static int ser_windows_flush_output(struct serial *scb)
Definition: ser-mingw.c:113
serial_ttystate ser_base_copy_tty_state(struct serial *scb, serial_ttystate ttystate)
Definition: ser-base.c:542
serial_ttystate ser_base_get_tty_state(struct serial *scb)
Definition: ser-base.c:535
static int ser_windows_setbaudrate(struct serial *scb, int rate)
Definition: ser-mingw.c:230

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

Referenced by _initialize_ser_windows().

◆ pipe_ops

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:549
int ser_base_flush_output(struct serial *scb)
Definition: ser-base.c:498
static void pipe_done_wait_handle(struct serial *scb)
Definition: ser-mingw.c:1033
static int pipe_avail(struct serial *scb, int fd)
Definition: ser-mingw.c:1045
static void pipe_wait_handle(struct serial *scb, HANDLE *read, HANDLE *except)
Definition: ser-mingw.c:1012
int ser_base_setbaudrate(struct serial *scb, int rate)
Definition: ser-base.c:564
int ser_base_setstopbits(struct serial *scb, int num)
Definition: ser-base.c:570
void ser_base_raw(struct serial *scb)
Definition: ser-base.c:529
void ser_base_async(struct serial *scb, int async_p)
Definition: ser-base.c:586
int ser_base_drain_output(struct serial *scb)
Definition: ser-base.c:523
static int pipe_windows_read(struct serial *scb, size_t count)
Definition: ser-mingw.c:967
void ser_base_print_tty_state(struct serial *scb, serial_ttystate ttystate, struct ui_file *stream)
Definition: ser-base.c:555
int ser_base_setparity(struct serial *scb, int parity)
Definition: ser-base.c:578
static int pipe_windows_write(struct serial *scb, const void *buf, size_t count)
Definition: ser-mingw.c:990
int ser_base_flush_input(struct serial *scb)
Definition: ser-base.c:504
int ser_base_readchar(struct serial *scb, int timeout)
Definition: ser-base.c:468
int ser_base_send_break(struct serial *scb)
Definition: ser-base.c:517
int ser_base_write(struct serial *scb, const void *buf, size_t count)
Definition: ser-base.c:474
serial_ttystate ser_base_copy_tty_state(struct serial *scb, serial_ttystate ttystate)
Definition: ser-base.c:542
static int pipe_windows_open(struct serial *scb, const char *name)
Definition: ser-mingw.c:860
static int pipe_windows_fdopen(struct serial *scb, int fd)
Definition: ser-mingw.c:929
static void pipe_windows_close(struct serial *scb)
Definition: ser-mingw.c:954
serial_ttystate ser_base_get_tty_state(struct serial *scb)
Definition: ser-base.c:535

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

Referenced by _initialize_ser_windows().

◆ tcp_ops

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:1194
int ser_base_set_tty_state(struct serial *scb, serial_ttystate ttystate)
Definition: ser-base.c:549
int ser_base_flush_output(struct serial *scb)
Definition: ser-base.c:498
static void net_windows_done_wait_handle(struct serial *scb)
Definition: ser-mingw.c:1186
static void net_windows_wait_handle(struct serial *scb, HANDLE *read, HANDLE *except)
Definition: ser-mingw.c:1167
int net_write_prim(struct serial *scb, const void *buf, size_t count)
Definition: ser-tcp.c:352
int ser_base_setbaudrate(struct serial *scb, int rate)
Definition: ser-base.c:564
int ser_base_setstopbits(struct serial *scb, int num)
Definition: ser-base.c:570
void ser_base_raw(struct serial *scb)
Definition: ser-base.c:529
void ser_base_async(struct serial *scb, int async_p)
Definition: ser-base.c:586
int net_read_prim(struct serial *scb, size_t count)
Definition: ser-tcp.c:343
static void net_windows_close(struct serial *scb)
Definition: ser-mingw.c:1219
int ser_base_drain_output(struct serial *scb)
Definition: ser-base.c:523
void ser_base_print_tty_state(struct serial *scb, serial_ttystate ttystate, struct ui_file *stream)
Definition: ser-base.c:555
int ser_base_setparity(struct serial *scb, int parity)
Definition: ser-base.c:578
int ser_base_flush_input(struct serial *scb)
Definition: ser-base.c:504
int ser_base_readchar(struct serial *scb, int timeout)
Definition: ser-base.c:468
int ser_base_write(struct serial *scb, const void *buf, size_t count)
Definition: ser-base.c:474
int ser_tcp_send_break(struct serial *scb)
Definition: ser-tcp.c:362
serial_ttystate ser_base_copy_tty_state(struct serial *scb, serial_ttystate ttystate)
Definition: ser-base.c:542
serial_ttystate ser_base_get_tty_state(struct serial *scb)
Definition: ser-base.c:535

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

Referenced by _initialize_ser_windows().

◆ tty_ops

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:549
static serial_ttystate ser_console_get_tty_state(struct serial *scb)
Definition: ser-mingw.c:784
static void ser_console_done_wait_handle(struct serial *scb)
Definition: ser-mingw.c:756
static void ser_console_wait_handle(struct serial *scb, HANDLE *read, HANDLE *except)
Definition: ser-mingw.c:702
static void ser_console_close(struct serial *scb)
Definition: ser-mingw.c:767
int ser_base_drain_output(struct serial *scb)
Definition: ser-base.c:523
void ser_base_print_tty_state(struct serial *scb, serial_ttystate ttystate, struct ui_file *stream)
Definition: ser-base.c:555
serial_ttystate ser_base_copy_tty_state(struct serial *scb, serial_ttystate ttystate)
Definition: ser-base.c:542

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

Referenced by _initialize_ser_windows().