GDB (xrefs)
Loading...
Searching...
No Matches
Macros | Functions | Variables
serial.c File Reference
#include "defs.h"
#include <ctype.h>
#include "serial.h"
#include "gdbcmd.h"
#include "cli/cli-utils.h"

Go to the source code of this file.

Macros

#define SERIAL_BREAK   1235
 

Functions

static const struct serial_opsserial_interface_lookup (const char *)
 
static void serial_logchar (struct ui_file *stream, int ch_type, int ch, int timeout)
 
void serial_log_command (struct target_ops *self, const char *cmd)
 
void serial_add_interface (const struct serial_ops *optable)
 
struct serialserial_for_fd (int fd)
 
static struct serialnew_serial (const struct serial_ops *ops)
 
static struct serialserial_open_ops_1 (const struct serial_ops *ops, const char *open_name)
 
struct serialserial_open (const char *name)
 
struct serialserial_open_ops (const struct serial_ops *ops)
 
static struct serialserial_fdopen_ops (const int fd, const struct serial_ops *ops)
 
struct serialserial_fdopen (const int fd)
 
static void do_serial_close (struct serial *scb, int really_close)
 
void serial_close (struct serial *scb)
 
void serial_un_fdopen (struct serial *scb)
 
int serial_is_open (struct serial *scb)
 
void serial_ref (struct serial *scb)
 
void serial_unref (struct serial *scb)
 
int serial_readchar (struct serial *scb, int timeout)
 
int serial_write (struct serial *scb, const void *buf, size_t count)
 
void serial_printf (struct serial *desc, const char *format,...)
 
int serial_drain_output (struct serial *scb)
 
int serial_flush_output (struct serial *scb)
 
int serial_flush_input (struct serial *scb)
 
int serial_send_break (struct serial *scb)
 
void serial_raw (struct serial *scb)
 
serial_ttystate serial_get_tty_state (struct serial *scb)
 
serial_ttystate serial_copy_tty_state (struct serial *scb, serial_ttystate ttystate)
 
int serial_set_tty_state (struct serial *scb, serial_ttystate ttystate)
 
void serial_print_tty_state (struct serial *scb, serial_ttystate ttystate, struct ui_file *stream)
 
int serial_setbaudrate (struct serial *scb, int rate)
 
int serial_setstopbits (struct serial *scb, int num)
 
int serial_setparity (struct serial *scb, int parity)
 
int serial_can_async_p (struct serial *scb)
 
int serial_is_async_p (struct serial *scb)
 
void serial_async (struct serial *scb, serial_event_ftype *handler, void *context)
 
void serial_debug (struct serial *scb, int debug_p)
 
int serial_debug_p (struct serial *scb)
 
int serial_pipe (struct serial *scbs[2])
 
static void serial_baud_show_cmd (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
static void set_parity (const char *ignore_args, int from_tty, struct cmd_list_element *c)
 
void _initialize_serial ()
 

Variables

static unsigned int global_serial_debug_p
 
static std::vector< const struct serial_ops * > serial_ops_list
 
static struct serialscb_base
 
static std::string serial_logfile
 
static struct ui_fileserial_logfp = NULL
 
static const char logbase_hex [] = "hex"
 
static const char logbase_octal [] = "octal"
 
static const char logbase_ascii [] = "ascii"
 
static const char *const logbase_enums []
 
static const char * serial_logbase = logbase_ascii
 
static int serial_current_type = 0
 
static struct cmd_list_elementserial_set_cmdlist
 
static struct cmd_list_elementserial_show_cmdlist
 
int baud_rate = -1
 
int serial_parity = GDBPARITY_NONE
 
static const char parity_none [] = "none"
 
static const char parity_odd [] = "odd"
 
static const char parity_even [] = "even"
 
static const char *const parity_enums []
 
static const char * parity = parity_none
 

Macro Definition Documentation

◆ SERIAL_BREAK

#define SERIAL_BREAK   1235

Definition at line 61 of file serial.c.

Referenced by serial_logchar(), and serial_send_break().

Function Documentation

◆ _initialize_serial()

void _initialize_serial ( )

Definition at line 658 of file serial.c.

Referenced by initialize_all_files().

◆ do_serial_close()

static void do_serial_close ( struct serial * scb,
int really_close )
static

◆ new_serial()

static struct serial * new_serial ( const struct serial_ops * ops)
static

Definition at line 177 of file serial.c.

References serial::buf, serial::bufp, serial::error_fd, serial::ops, and serial::refcnt.

Referenced by serial_fdopen_ops(), and serial_open_ops_1().

◆ serial_add_interface()

void serial_add_interface ( const struct serial_ops * optable)

Definition at line 154 of file serial.c.

References serial_ops_list.

Referenced by _initialize_ser_dos(), and _initialize_ser_windows().

◆ serial_async()

void serial_async ( struct serial * scb,
serial_event_ftype * handler,
void * context )

◆ serial_baud_show_cmd()

static void serial_baud_show_cmd ( struct ui_file * file,
int from_tty,
struct cmd_list_element * c,
const char * value )
static

Definition at line 625 of file serial.c.

References gdb_printf().

◆ serial_can_async_p()

int serial_can_async_p ( struct serial * scb)

Definition at line 536 of file serial.c.

References serial_ops::async, and serial::ops.

Referenced by remote_target::can_async_p().

◆ serial_close()

void serial_close ( struct serial * scb)

Definition at line 351 of file serial.c.

References do_serial_close().

Referenced by remote_target::open_1().

◆ serial_copy_tty_state()

serial_ttystate serial_copy_tty_state ( struct serial * scb,
serial_ttystate ttystate )

◆ serial_debug()

void serial_debug ( struct serial * scb,
int debug_p )

Definition at line 562 of file serial.c.

References serial::debug_p.

◆ serial_debug_p()

int serial_debug_p ( struct serial * scb)

Definition at line 568 of file serial.c.

References serial::debug_p, and global_serial_debug_p.

Referenced by reschedule(), ser_base_async(), serial_readchar(), and serial_write().

◆ serial_drain_output()

int serial_drain_output ( struct serial * scb)

Definition at line 457 of file serial.c.

References serial_ops::drain_output, and serial::ops.

Referenced by print_flush().

◆ serial_fdopen()

struct serial * serial_fdopen ( const int fd)

Definition at line 303 of file serial.c.

References serial::fd, and serial_fdopen_ops().

Referenced by initialize_stdin_serial(), and print_flush().

◆ serial_fdopen_ops()

static struct serial * serial_fdopen_ops ( const int fd,
const struct serial_ops * ops )
static

◆ serial_flush_input()

int serial_flush_input ( struct serial * scb)

Definition at line 469 of file serial.c.

References serial_ops::flush_input, and serial::ops.

Referenced by remote_target::open_1().

◆ serial_flush_output()

int serial_flush_output ( struct serial * scb)

Definition at line 463 of file serial.c.

References serial_ops::flush_output, and serial::ops.

◆ serial_for_fd()

struct serial * serial_for_fd ( int fd)

Definition at line 163 of file serial.c.

References serial::fd, serial::next, and scb_base.

Referenced by gdb_select().

◆ serial_get_tty_state()

serial_ttystate serial_get_tty_state ( struct serial * scb)

◆ serial_interface_lookup()

static const struct serial_ops * serial_interface_lookup ( const char * name)
static

Definition at line 144 of file serial.c.

References name, and serial_ops_list.

Referenced by serial_fdopen_ops(), serial_open(), and serial_pipe().

◆ serial_is_async_p()

int serial_is_async_p ( struct serial * scb)

◆ serial_is_open()

int serial_is_open ( struct serial * scb)

Definition at line 363 of file serial.c.

References serial::bufp.

Referenced by run_async_handler_and_reschedule().

◆ serial_log_command()

void serial_log_command ( struct target_ops * self,
const char * cmd )

Definition at line 127 of file serial.c.

References gdb_flush(), gdb_puts(), serial_current_type, and serial_logfp.

Referenced by remote_target::log_command().

◆ serial_logchar()

static void serial_logchar ( struct ui_file * stream,
int ch_type,
int ch,
int timeout )
static

◆ serial_open()

struct serial * serial_open ( const char * name)

Definition at line 198 of file serial.c.

References name, serial_interface_lookup(), and serial_open_ops_1().

Referenced by remote_serial_open().

◆ serial_open_ops()

struct serial * serial_open_ops ( const struct serial_ops * ops)

Definition at line 265 of file serial.c.

References serial::ops, and serial_open_ops_1().

Referenced by make_serial_event().

◆ serial_open_ops_1()

static struct serial * serial_open_ops_1 ( const struct serial_ops * ops,
const char * open_name )
static

◆ serial_pipe()

int serial_pipe ( struct serial * scbs[2])

Definition at line 595 of file serial.c.

References gdb_pipe(), serial_fdopen_ops(), and serial_interface_lookup().

◆ serial_print_tty_state()

void serial_print_tty_state ( struct serial * scb,
serial_ttystate ttystate,
struct ui_file * stream )

Definition at line 508 of file serial.c.

References serial::ops, serial_ops::print_tty_state, and serial::ttystate.

Referenced by child_terminal_info().

◆ serial_printf()

void serial_printf ( struct serial * desc,
const char * format,
... )

Definition at line 445 of file serial.c.

References serial::buf, and serial_write().

◆ serial_raw()

void serial_raw ( struct serial * scb)

Definition at line 484 of file serial.c.

References serial_ops::go_raw, and serial::ops.

Referenced by remote_target::open_1().

◆ serial_readchar()

int serial_readchar ( struct serial * scb,
int timeout )

◆ serial_ref()

void serial_ref ( struct serial * scb)

Definition at line 369 of file serial.c.

References serial::refcnt.

Referenced by run_async_handler_and_reschedule().

◆ serial_send_break()

int serial_send_break ( struct serial * scb)

◆ serial_set_tty_state()

int serial_set_tty_state ( struct serial * scb,
serial_ttystate ttystate )

Definition at line 502 of file serial.c.

References serial::ops, serial_ops::set_tty_state, and serial::ttystate.

Referenced by child_terminal_inferior(), and child_terminal_ours_1().

◆ serial_setbaudrate()

int serial_setbaudrate ( struct serial * scb,
int rate )

Definition at line 516 of file serial.c.

References serial::ops, rate, and serial_ops::setbaudrate.

Referenced by remote_target::open_1().

◆ serial_setparity()

int serial_setparity ( struct serial * scb,
int parity )

Definition at line 530 of file serial.c.

References serial::ops, parity, and serial_ops::setparity.

Referenced by remote_target::open_1().

◆ serial_setstopbits()

int serial_setstopbits ( struct serial * scb,
int num )

Definition at line 522 of file serial.c.

References serial::ops, and serial_ops::setstopbits.

◆ serial_un_fdopen()

void serial_un_fdopen ( struct serial * scb)

Definition at line 357 of file serial.c.

References do_serial_close().

Referenced by print_flush().

◆ serial_unref()

void serial_unref ( struct serial * scb)

Definition at line 375 of file serial.c.

References serial::refcnt, and xfree().

Referenced by do_serial_close(), and run_async_handler_and_reschedule().

◆ serial_write()

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

◆ set_parity()

static void set_parity ( const char * ignore_args,
int from_tty,
struct cmd_list_element * c )
static

Variable Documentation

◆ baud_rate

int baud_rate = -1

Definition at line 622 of file serial.c.

Referenced by captured_main_1(), and remote_target::open_1().

◆ global_serial_debug_p

unsigned int global_serial_debug_p
static

Definition at line 28 of file serial.c.

Referenced by serial_debug_p().

◆ logbase_ascii

const char logbase_ascii[] = "ascii"
static

Definition at line 49 of file serial.c.

Referenced by serial_logchar().

◆ logbase_enums

const char* const logbase_enums[]
static
Initial value:
=
static const char logbase_hex[]
Definition serial.c:47
static const char logbase_ascii[]
Definition serial.c:49
static const char logbase_octal[]
Definition serial.c:48

Definition at line 50 of file serial.c.

◆ logbase_hex

const char logbase_hex[] = "hex"
static

Definition at line 47 of file serial.c.

Referenced by serial_logchar().

◆ logbase_octal

const char logbase_octal[] = "octal"
static

Definition at line 48 of file serial.c.

Referenced by serial_logchar().

◆ parity

const char* parity = parity_none
static

Definition at line 641 of file serial.c.

Referenced by hardwire_setparity(), ser_windows_setparity(), serial_setparity(), and set_parity().

◆ parity_enums

const char* const parity_enums[]
static
Initial value:
=
static const char parity_odd[]
Definition serial.c:637
static const char parity_even[]
Definition serial.c:638
static const char parity_none[]
Definition serial.c:636

Definition at line 639 of file serial.c.

◆ parity_even

const char parity_even[] = "even"
static

Definition at line 638 of file serial.c.

Referenced by set_parity().

◆ parity_none

const char parity_none[] = "none"
static

Definition at line 636 of file serial.c.

◆ parity_odd

const char parity_odd[] = "odd"
static

Definition at line 637 of file serial.c.

Referenced by set_parity().

◆ scb_base

struct serial* scb_base
static

Definition at line 36 of file serial.c.

Referenced by do_serial_close(), serial_fdopen_ops(), serial_for_fd(), and serial_open_ops_1().

◆ serial_current_type

int serial_current_type = 0
static

Definition at line 55 of file serial.c.

Referenced by do_serial_close(), serial_log_command(), and serial_logchar().

◆ serial_logbase

const char* serial_logbase = logbase_ascii
static

Definition at line 52 of file serial.c.

Referenced by serial_logchar().

◆ serial_logfile

std::string serial_logfile
static

Definition at line 41 of file serial.c.

Referenced by serial_open_ops_1().

◆ serial_logfp

struct ui_file* serial_logfp = NULL
static

◆ serial_ops_list

std::vector<const struct serial_ops *> serial_ops_list
static

Definition at line 32 of file serial.c.

Referenced by serial_add_interface(), and serial_interface_lookup().

◆ serial_parity

int serial_parity = GDBPARITY_NONE

Definition at line 634 of file serial.c.

Referenced by remote_target::open_1(), and set_parity().

◆ serial_set_cmdlist

struct cmd_list_element* serial_set_cmdlist
static

Definition at line 617 of file serial.c.

◆ serial_show_cmdlist

struct cmd_list_element* serial_show_cmdlist
static

Definition at line 618 of file serial.c.