GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations | Functions | Variables
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"
#include "gdbsupport/buildargv.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  pipe_state_destroyer
 
struct  net_windows_state
 

Macros

#define CancelIo   dyn_CancelIo
 

Typedefs

typedef BOOL WINAPI CancelIo_ftype(HANDLE)
 
typedef DWORD WINAPI(* thread_fn_type) (void *)
 
typedef std::unique_ptr< pipe_state, pipe_state_destroyerpipe_state_up
 

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

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 45 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 46 of file ser-mingw.c.

◆ pipe_state_up

typedef std::unique_ptr<pipe_state, pipe_state_destroyer> pipe_state_up

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

◆ thread_fn_type

typedef DWORD WINAPI(* thread_fn_type) (void *)

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

Enumeration Type Documentation

◆ select_thread_state

Enumerator
STS_STARTED 
STS_STOPPED 

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

Function Documentation

◆ _initialize_ser_windows()

void _initialize_ser_windows ( )

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

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

◆ 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 627 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 618 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

◆ 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

◆ 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(), 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 pipe_state::input, 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 768 of file ser-mingw.c.

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

◆ ser_console_done_wait_handle()

static void ser_console_done_wait_handle ( struct serial * scb)
static

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

References 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 785 of file ser-mingw.c.

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

◆ 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 106 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 122 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 114 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 147 of file ser-mingw.c.

References serial::fd.

◆ 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 130 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

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

References serial::fd, GDBPARITY_EVEN, GDBPARITY_NONE, GDBPARITY_ODD, and parity.

◆ 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 351 of file ser-mingw.c.

References serial::fd, 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 47 of file ser-mingw.c.

◆ hardwire_ops

const struct serial_ops hardwire_ops
static
Initial value:
=
{
"hardwire",
NULL,
NULL,
}
void ser_base_async(struct serial *scb, int async_p)
Definition ser-base.c:587
void ser_base_print_tty_state(struct serial *scb, serial_ttystate ttystate, struct ui_file *stream)
Definition ser-base.c:556
int ser_base_set_tty_state(struct serial *scb, serial_ttystate ttystate)
Definition ser-base.c:550
serial_ttystate ser_base_get_tty_state(struct serial *scb)
Definition ser-base.c:536
serial_ttystate ser_base_copy_tty_state(struct serial *scb, serial_ttystate ttystate)
Definition ser-base.c:543
int ser_base_write(struct serial *scb, const void *buf, size_t count)
Definition ser-base.c:475
int ser_base_readchar(struct serial *scb, int timeout)
Definition ser-base.c:469
static void ser_windows_raw(struct serial *scb)
Definition ser-mingw.c:147
static int ser_windows_send_break(struct serial *scb)
Definition ser-mingw.c:130
static int ser_windows_flush_input(struct serial *scb)
Definition ser-mingw.c:122
static int ser_windows_setbaudrate(struct serial *scb, int rate)
Definition ser-mingw.c:230
static int ser_windows_flush_output(struct serial *scb)
Definition ser-mingw.c:114
static int ser_windows_open(struct serial *scb, const char *name)
Definition ser-mingw.c:52
static void ser_windows_wait_handle(struct serial *scb, HANDLE *read, HANDLE *except)
Definition ser-mingw.c:268
static int ser_windows_drain_output(struct serial *scb)
Definition ser-mingw.c:106
static int ser_windows_read_prim(struct serial *scb, size_t count)
Definition ser-mingw.c:320
static int ser_windows_setparity(struct serial *scb, int parity)
Definition ser-mingw.c:199
static int ser_windows_write_prim(struct serial *scb, const void *buf, size_t len)
Definition ser-mingw.c:351
static int ser_windows_setstopbits(struct serial *scb, int num)
Definition ser-mingw.c:170
static void ser_windows_close(struct serial *scb)
Definition ser-mingw.c:244

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

Referenced by _initialize_ser_windows().

◆ pipe_ops

const struct serial_ops pipe_ops
static
Initial value:
=
{
"pipe",
}
void ser_base_raw(struct serial *scb)
Definition ser-base.c:530
int ser_base_drain_output(struct serial *scb)
Definition ser-base.c:524
int ser_base_send_break(struct serial *scb)
Definition ser-base.c:518
int ser_base_setbaudrate(struct serial *scb, int rate)
Definition ser-base.c:565
int ser_base_setstopbits(struct serial *scb, int num)
Definition ser-base.c:571
int ser_base_flush_output(struct serial *scb)
Definition ser-base.c:499
int ser_base_flush_input(struct serial *scb)
Definition ser-base.c:505
int ser_base_setparity(struct serial *scb, int parity)
Definition ser-base.c:579
static int pipe_windows_write(struct serial *scb, const void *buf, size_t count)
Definition ser-mingw.c:990
static int pipe_windows_open(struct serial *scb, const char *name)
Definition ser-mingw.c:863
static void pipe_windows_close(struct serial *scb)
Definition ser-mingw.c:954
static int pipe_windows_fdopen(struct serial *scb, int fd)
Definition ser-mingw.c:929
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 int pipe_windows_read(struct serial *scb, size_t count)
Definition ser-mingw.c:967
static void pipe_wait_handle(struct serial *scb, HANDLE *read, HANDLE *except)
Definition ser-mingw.c:1012

Definition at line 1294 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 void net_windows_close(struct serial *scb)
Definition ser-mingw.c:1218
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
static int net_windows_open(struct serial *scb, const char *name)
Definition ser-mingw.c:1194
int net_write_prim(struct serial *scb, const void *buf, size_t count)
Definition ser-tcp.c:411
int net_read_prim(struct serial *scb, size_t count)
Definition ser-tcp.c:402
int ser_tcp_send_break(struct serial *scb)
Definition ser-tcp.c:421

Definition at line 1324 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,
}
static serial_ttystate ser_console_get_tty_state(struct serial *scb)
Definition ser-mingw.c:785
static void ser_console_done_wait_handle(struct serial *scb)
Definition ser-mingw.c:757
static void ser_console_wait_handle(struct serial *scb, HANDLE *read, HANDLE *except)
Definition ser-mingw.c:703
static void ser_console_close(struct serial *scb)
Definition ser-mingw.c:768

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

Referenced by _initialize_ser_windows().