GDB (xrefs)
|
#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 "gdb_assert.h"
#include "gdb_string.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 |
Defines | |
#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_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_state * | make_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 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) |
#define CancelIo dyn_CancelIo |
Definition at line 49 of file ser-mingw.c.
Referenced by _initialize_ser_windows(), and ser_windows_close().
typedef DWORD WINAPI(* thread_fn_type)(void *) |
Definition at line 427 of file ser-mingw.c.
enum select_thread_state |
Definition at line 364 of file ser-mingw.c.
void _initialize_ser_windows | ( | void | ) |
Definition at line 1214 of file ser-mingw.c.
References serial_ops::async, serial_ops::avail, CancelIo, serial_ops::close, serial_ops::copy_tty_state, serial_ops::drain_output, serial_ops::fdopen, serial_ops::flush_input, serial_ops::flush_output, serial_ops::get_tty_state, serial_ops::go_raw, memset(), serial_ops::name, net_read_prim(), net_windows_close(), net_windows_done_wait_handle(), net_windows_open(), net_windows_wait_handle(), net_write_prim(), serial_ops::next, serial_ops::noflush_set_tty_state, serial_ops::open, pipe_avail(), pipe_done_wait_handle(), pipe_wait_handle(), pipe_windows_close(), pipe_windows_fdopen(), pipe_windows_open(), pipe_windows_read(), pipe_windows_write(), serial_ops::print_tty_state, serial_ops::read_prim, serial_ops::readchar, serial_ops::send_break, ser_base_async(), ser_base_copy_tty_state(), ser_base_drain_output(), ser_base_flush_input(), ser_base_flush_output(), ser_base_get_tty_state(), ser_base_noflush_set_tty_state(), ser_base_print_tty_state(), ser_base_raw(), ser_base_readchar(), ser_base_send_break(), ser_base_set_tty_state(), ser_base_setbaudrate(), ser_base_setstopbits(), ser_base_write(), ser_console_close(), ser_console_done_wait_handle(), ser_console_get_tty_state(), ser_console_wait_handle(), ser_tcp_send_break(), ser_windows_close(), ser_windows_drain_output(), ser_windows_flush_input(), ser_windows_flush_output(), ser_windows_open(), ser_windows_raw(), ser_windows_read_prim(), ser_windows_send_break(), ser_windows_setbaudrate(), ser_windows_setstopbits(), ser_windows_wait_handle(), ser_windows_write_prim(), serial_add_interface(), serial_ops::set_tty_state, serial_ops::setbaudrate, serial_ops::setstopbits, serial_ops::write, serial_ops::write_prim, and XMALLOC.
static void cleanup_pipe_state | ( | void * | untyped | ) | [static] |
Definition at line 829 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] |
Definition at line 505 of file ser-mingw.c.
References ser_console_state::except_event, serial::fd, ser_console_state::have_stopped, ser_console_state::read_event, arm-linux::record(), select_thread_wait(), serial::state, and ser_console_state::stop_select.
Referenced by ser_console_wait_handle().
static void create_select_thread | ( | thread_fn_type | thread_fn, |
struct serial * | scb, | ||
struct ser_console_state * | state | ||
) | [static] |
Definition at line 432 of file ser-mingw.c.
References ser_console_state::except_event, ser_console_state::exit_select, ser_console_state::have_started, ser_console_state::have_stopped, ser_console_state::read_event, ser_console_state::start_select, ser_console_state::stop_select, STS_STOPPED, ser_console_state::thread, and ser_console_state::thread_state.
Referenced by net_windows_open(), pipe_wait_handle(), and ser_console_wait_handle().
static void destroy_select_thread | ( | struct ser_console_state * | state | ) | [static] |
Definition at line 454 of file ser-mingw.c.
References ser_console_state::except_event, ser_console_state::exit_select, ser_console_state::have_started, ser_console_state::have_stopped, ser_console_state::read_event, ser_console_state::start_select, ser_console_state::stop_select, and ser_console_state::thread.
Referenced by free_pipe_state(), net_windows_close(), and ser_console_close().
static int fd_is_file | ( | int | fd | ) | [static] |
Definition at line 599 of file ser-mingw.c.
Referenced by ser_console_wait_handle().
static int fd_is_pipe | ( | int | fd | ) | [static] |
Definition at line 590 of file ser-mingw.c.
Referenced by ser_console_wait_handle().
static DWORD WINAPI file_select_thread | ( | void * | arg | ) | [static] |
Definition at line 651 of file ser-mingw.c.
References ser_console_state::except_event, serial::fd, ser_console_state::have_stopped, ser_console_state::read_event, select_thread_wait(), and serial::state.
Referenced by ser_console_wait_handle().
static void free_pipe_state | ( | struct pipe_state * | ps | ) | [static] |
Definition at line 803 of file ser-mingw.c.
References destroy_select_thread(), pipe_state::input, pipe_state::output, pipe_state::pex, ser_console_state::read_event, pipe_state::wait, and xfree().
Referenced by cleanup_pipe_state(), pipe_windows_close(), and pipe_windows_fdopen().
Definition at line 1035 of file ser-mingw.c.
static struct pipe_state* make_pipe_state | ( | void | ) | [static, read] |
Definition at line 789 of file ser-mingw.c.
References ser_console_state::except_event, memset(), cleanup_check::ps, ser_console_state::read_event, ser_console_state::start_select, ser_console_state::stop_select, pipe_state::wait, and XMALLOC.
Referenced by pipe_windows_fdopen(), and pipe_windows_open().
static void net_windows_close | ( | struct serial * | scb | ) | [static] |
Definition at line 1201 of file ser-mingw.c.
References net_windows_state::base, destroy_select_thread(), net_close(), net_windows_state::sock_event, serial::state, and xfree().
Referenced by _initialize_ser_windows().
static void net_windows_done_wait_handle | ( | struct serial * | scb | ) | [static] |
Definition at line 1167 of file ser-mingw.c.
References net_windows_state::base, serial::state, and stop_select_thread().
Referenced by _initialize_ser_windows().
static int net_windows_open | ( | struct serial * | scb, |
const char * | name | ||
) | [static] |
Definition at line 1175 of file ser-mingw.c.
References net_windows_state::base, create_select_thread(), serial::fd, memset(), net_open(), net_windows_select_thread(), net_windows_state::sock_event, serial::state, and xmalloc().
Referenced by _initialize_ser_windows().
static DWORD WINAPI net_windows_select_thread | ( | void * | arg | ) | [static] |
Definition at line 1050 of file ser-mingw.c.
References net_windows_state::base, ser_console_state::except_event, serial::fd, gdb_assert, ser_console_state::have_stopped, ser_console_state::read_event, select_thread_wait(), net_windows_state::sock_event, serial::state, and ser_console_state::stop_select.
Referenced by net_windows_open().
static void net_windows_wait_handle | ( | struct serial * | scb, |
HANDLE * | read, | ||
HANDLE * | except | ||
) | [static] |
Definition at line 1098 of file ser-mingw.c.
References available, net_windows_state::base, ser_console_state::except_event, serial::fd, ser_console_state::read_event, net_windows_state::sock_event, start_select_thread(), serial::state, and ser_console_state::stop_select.
Referenced by _initialize_ser_windows().
static int pipe_avail | ( | struct serial * | scb, |
int | fd | ||
) | [static] |
Definition at line 1023 of file ser-mingw.c.
References BOOL.
Referenced by _initialize_ser_windows().
static void pipe_done_wait_handle | ( | struct serial * | scb | ) | [static] |
Definition at line 1011 of file ser-mingw.c.
References cleanup_check::ps, ser_console_state::read_event, serial::state, stop_select_thread(), and pipe_state::wait.
Referenced by _initialize_ser_windows().
static DWORD WINAPI pipe_select_thread | ( | void * | arg | ) | [static] |
Definition at line 608 of file ser-mingw.c.
References ser_console_state::except_event, serial::fd, ser_console_state::have_stopped, ser_console_state::read_event, select_thread_wait(), serial::state, and ser_console_state::stop_select.
Referenced by pipe_wait_handle(), and ser_console_wait_handle().
static void pipe_wait_handle | ( | struct serial * | scb, |
HANDLE * | read, | ||
HANDLE * | except | ||
) | [static] |
Definition at line 990 of file ser-mingw.c.
References create_select_thread(), ser_console_state::except_event, pipe_select_thread(), cleanup_check::ps, ser_console_state::read_event, start_select_thread(), serial::state, ser_console_state::stop_select, and pipe_state::wait.
Referenced by _initialize_ser_windows().
static void pipe_windows_close | ( | struct serial * | scb | ) | [static] |
Definition at line 932 of file ser-mingw.c.
References free_pipe_state(), cleanup_check::ps, and serial::state.
Referenced by _initialize_ser_windows().
static int pipe_windows_fdopen | ( | struct serial * | scb, |
int | fd | ||
) | [static] |
Definition at line 907 of file ser-mingw.c.
References serial::fd, free_pipe_state(), pipe_state::input, make_pipe_state(), pipe_state::output, cleanup_check::ps, and serial::state.
Referenced by _initialize_ser_windows().
static int pipe_windows_open | ( | struct serial * | scb, |
const char * | name | ||
) | [static] |
Definition at line 837 of file ser-mingw.c.
References _, cleanup_pipe_state(), discard_cleanups(), do_cleanups(), error(), serial::error_fd, error_no_arg(), serial::fd, gdb_buildargv(), pipe_state::input, make_cleanup(), make_cleanup_freeargv(), make_pipe_state(), pipe_state::output, pipe_state::pex, cleanup_check::ps, safe_strerror(), and serial::state.
Referenced by _initialize_ser_windows().
static int pipe_windows_read | ( | struct serial * | scb, |
size_t | count | ||
) | [static] |
Definition at line 945 of file ser-mingw.c.
References available, serial::buf, and serial::fd.
Referenced by _initialize_ser_windows().
static int pipe_windows_write | ( | struct serial * | scb, |
const void * | buf, | ||
size_t | count | ||
) | [static] |
Definition at line 968 of file ser-mingw.c.
References pipe_state::input, cleanup_check::ps, and serial::state.
Referenced by _initialize_ser_windows().
static void select_thread_wait | ( | struct ser_console_state * | state | ) | [static] |
Definition at line 408 of file ser-mingw.c.
References ser_console_state::exit_select, ser_console_state::have_started, and ser_console_state::start_select.
Referenced by console_select_thread(), file_select_thread(), net_windows_select_thread(), and pipe_select_thread().
static void ser_console_close | ( | struct serial * | scb | ) | [static] |
Definition at line 743 of file ser-mingw.c.
References destroy_select_thread(), serial::state, and xfree().
Referenced by _initialize_ser_windows().
static void ser_console_done_wait_handle | ( | struct serial * | scb | ) | [static] |
Definition at line 732 of file ser-mingw.c.
References serial::state, and stop_select_thread().
Referenced by _initialize_ser_windows().
static serial_ttystate ser_console_get_tty_state | ( | struct serial * | scb | ) | [static] |
Definition at line 760 of file ser-mingw.c.
References serial::fd, ser_console_ttystate::is_a_tty, and xmalloc().
Referenced by _initialize_ser_windows().
static void ser_console_wait_handle | ( | struct serial * | scb, |
HANDLE * | read, | ||
HANDLE * | except | ||
) | [static] |
Definition at line 677 of file ser-mingw.c.
References console_select_thread(), create_select_thread(), ser_console_state::except_event, serial::fd, fd_is_file(), fd_is_pipe(), file_select_thread(), memset(), pipe_select_thread(), ser_console_state::read_event, start_select_thread(), serial::state, ser_console_state::stop_select, and xmalloc().
Referenced by _initialize_ser_windows().
static void ser_windows_close | ( | struct serial * | scb | ) | [static] |
Definition at line 219 of file ser-mingw.c.
References CancelIo, ser_windows_state::except_event, serial::fd, ser_windows_state::ov, serial::state, and xfree().
Referenced by _initialize_ser_windows().
static int ser_windows_drain_output | ( | struct serial * | scb | ) | [static] |
Definition at line 110 of file ser-mingw.c.
References serial::fd.
Referenced by _initialize_ser_windows().
static int ser_windows_flush_input | ( | struct serial * | scb | ) | [static] |
Definition at line 126 of file ser-mingw.c.
References serial::fd.
Referenced by _initialize_ser_windows().
static int ser_windows_flush_output | ( | struct serial * | scb | ) | [static] |
Definition at line 118 of file ser-mingw.c.
References serial::fd.
Referenced by _initialize_ser_windows().
static int ser_windows_open | ( | struct serial * | scb, |
const char * | name | ||
) | [static] |
Definition at line 55 of file ser-mingw.c.
References ser_windows_state::except_event, serial::fd, memset(), ser_windows_state::ov, serial::state, and xmalloc().
Referenced by _initialize_ser_windows().
static void ser_windows_raw | ( | struct serial * | scb | ) | [static] |
Definition at line 151 of file ser-mingw.c.
References _, serial::current_timeout, serial::fd, and warning().
Referenced by _initialize_ser_windows().
static int ser_windows_read_prim | ( | struct serial * | scb, |
size_t | count | ||
) | [static] |
Definition at line 295 of file ser-mingw.c.
References serial::buf, serial::fd, ser_windows_state::in_progress, memset(), ser_windows_state::ov, p, and serial::state.
Referenced by _initialize_ser_windows().
static int ser_windows_send_break | ( | struct serial * | scb | ) | [static] |
Definition at line 134 of file ser-mingw.c.
References serial::fd.
Referenced by _initialize_ser_windows().
static int ser_windows_setbaudrate | ( | struct serial * | scb, |
int | rate | ||
) | [static] |
Definition at line 205 of file ser-mingw.c.
References serial::fd, and rate.
Referenced by _initialize_ser_windows().
static int ser_windows_setstopbits | ( | struct serial * | scb, |
int | num | ||
) | [static] |
Definition at line 178 of file ser-mingw.c.
References serial::fd, SERIAL_1_AND_A_HALF_STOPBITS, SERIAL_1_STOPBITS, and SERIAL_2_STOPBITS.
Referenced by _initialize_ser_windows().
static void ser_windows_wait_handle | ( | struct serial * | scb, |
HANDLE * | read, | ||
HANDLE * | except | ||
) | [static] |
Definition at line 243 of file ser-mingw.c.
References _, ser_windows_state::except_event, serial::fd, gdb_assert, ser_windows_state::in_progress, ser_windows_state::lastCommMask, ser_windows_state::ov, serial::state, exsummary::status, and warning().
Referenced by _initialize_ser_windows().
static int ser_windows_write_prim | ( | struct serial * | scb, |
const void * | buf, | ||
size_t | len | ||
) | [static] |
Definition at line 327 of file ser-mingw.c.
References serial::fd, memset(), and ser_windows_state::ov.
Referenced by _initialize_ser_windows().
static void start_select_thread | ( | struct ser_console_state * | state | ) | [static] |
Definition at line 474 of file ser-mingw.c.
References ser_console_state::have_started, ser_console_state::start_select, STS_STARTED, and ser_console_state::thread_state.
Referenced by net_windows_wait_handle(), pipe_wait_handle(), and ser_console_wait_handle().
static void stop_select_thread | ( | struct ser_console_state * | state | ) | [static] |
Definition at line 487 of file ser-mingw.c.
References ser_console_state::have_stopped, ser_console_state::stop_select, STS_STARTED, STS_STOPPED, and ser_console_state::thread_state.
Referenced by net_windows_done_wait_handle(), pipe_done_wait_handle(), and ser_console_done_wait_handle().
Definition at line 50 of file ser-mingw.c.